diff --git a/tester/call_tester.c b/tester/call_tester.c index ea96e611e..1bcc30968 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -437,6 +437,7 @@ static void simple_conference(void) { ms_list_free(lcs); } +#ifdef SRTP_ENABLED static void srtp_call(void) { LinphoneCoreManager* marie = linphone_core_manager_new(liblinphone_tester_file_prefix, "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new(liblinphone_tester_file_prefix, "pauline_rc"); @@ -457,6 +458,7 @@ static void srtp_call(void) { linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } +#endif //SRTP_ENABLED static void early_media_call(void) { LinphoneCoreManager* marie = linphone_core_manager_new(liblinphone_tester_file_prefix, "marie_early_rc"); diff --git a/tester/liblinphone_tester.c b/tester/liblinphone_tester.c index 54f00a698..b7ffea485 100644 --- a/tester/liblinphone_tester.c +++ b/tester/liblinphone_tester.c @@ -232,6 +232,21 @@ static int test_suite_index(const char *suite_name) { return -1; } +static int test_index(const char *suite_name, const char *test_name) { + int j,i; + + j = test_suite_index(suite_name); + if(j != -1) { + for (i = 0; i < test_suite[j]->nb_tests; i++) { + if ((strcmp(test_name, test_suite[j]->tests[i].name) == 0) && (strlen(test_name) == strlen(test_suite[j]->tests[i].name))) { + return i; + } + } + } + + return -1; +} + int liblinphone_tester_nb_test_suites(void) { return nb_test_suites; } @@ -352,6 +367,30 @@ static void linphone_android_ortp_log_handler(OrtpLogLevel lev, const char *fmt, } #endif +void helper(const char *name) { + fprintf(stderr,"%s \t--help\n" + "\t\t\t--verbose\n" + "\t\t\t--list-suites\n" + "\t\t\t--list-tests \n" + "\t\t\t--config \n" + "\t\t\t--domain \n" + "\t\t\t---auth-domain \n" +#if HAVE_CU_GET_SUITE + "\t\t\t--suite \n" + "\t\t\t--test \n" +#endif +#if HAVE_CU_CURSES + "\t\t\t--curses\n" +#endif + , name); +} + +#define CHECK_ARG(argument, index, argc) \ + if(index >= argc) { \ + fprintf(stderr, "Missing argument for \"%s\"\n", argument); \ + return -1; \ + } \ + #ifndef WINAPI_FAMILY_PHONE_APP int main (int argc, char *argv[]) { int i,j; @@ -363,56 +402,60 @@ int main (int argc, char *argv[]) { for(i=1;i\n" - "\t\t\t--config \n" - "\t\t\t--domain \n" - "\t\t\t---auth-domain \n" -#if HAVE_CU_GET_SUITE - "\t\t\t--suite \n" - "\t\t\t--test \n" -#endif -#if HAVE_CU_CURSES - "\t\t\t--curses\n" -#endif - , argv[0]); + helper(argv[0]); return 0; - }else if (strcmp(argv[i],"--verbose")==0){ + } else if (strcmp(argv[i],"--verbose")==0){ #ifndef ANDROID linphone_core_enable_logs(NULL); #else linphone_core_enable_logs_with_cb(linphone_android_ortp_log_handler); #endif - }else if (strcmp(argv[i],"--domain")==0){ - i++; + } else if (strcmp(argv[i],"--domain")==0){ + CHECK_ARG("--domain", ++i, argc); test_domain=argv[i]; - }else if (strcmp(argv[i],"--auth-domain")==0){ - i++; + } else if (strcmp(argv[i],"--auth-domain")==0){ + CHECK_ARG("--auth-domain", ++i, argc); auth_domain=argv[i]; - }else if (strcmp(argv[i],"--test")==0){ - i++; + } else if (strcmp(argv[i],"--test")==0){ + CHECK_ARG("--test", ++i, argc); test_name=argv[i]; - }else if (strcmp(argv[i],"--config")==0){ - i++; + } else if (strcmp(argv[i],"--config")==0){ + CHECK_ARG("--config", ++i, argc); liblinphone_tester_file_prefix=argv[i]; - }else if (strcmp(argv[i],"--suite")==0){ - i++; + } else if (strcmp(argv[i],"--suite")==0){ + CHECK_ARG("--suite", ++i, argc); suite_name=argv[i]; - }else if (strcmp(argv[i],"--list-suites")==0){ + } else if (strcmp(argv[i],"--list-suites")==0){ for(j=0;j