Commit 648f2fc6 authored by Nicolas Michon's avatar Nicolas Michon

Tests: changes following factorization of logs options into bc_tester

parent 251b017e
......@@ -44,7 +44,25 @@ static void log_handler(int lev, const char *fmt, va_list args) {
}
}
int silent_arg_func(const char *arg) {
ortp_set_log_level_mask(ORTP_LOG_DOMAIN, ORTP_FATAL);
return 0;
}
int verbose_arg_func(const char *arg) {
ortp_set_log_level_mask(ORTP_LOG_DOMAIN, ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
return 0;
}
int logfile_arg_func(const char *arg) {
if (mediastreamer2_tester_set_log_file(arg) < 0) return -2;
return 0;
}
void mediastreamer2_tester_init(void(*ftester_printf)(int level, const char *fmt, va_list args)) {
bc_tester_set_silent_func(silent_arg_func);
bc_tester_set_verbose_func(verbose_arg_func);
bc_tester_set_logfile_func(logfile_arg_func);
if (ftester_printf == NULL) ftester_printf = log_handler;
bc_tester_init(ftester_printf, ORTP_MESSAGE, ORTP_ERROR, "sounds");
......@@ -101,12 +119,6 @@ int mediastreamer2_tester_set_log_file(const char *filename) {
return 0;
}
static const char* mediastreamer2_helper =
"\t\t\t--verbose\n"
"\t\t\t--silent\n"
"\t\t\t--log-file <output log file path>\n";
#if defined(_WIN32) && !defined(MS2_WINDOWS_DESKTOP)
#define BUILD_ENTRY_POINT 0
#else
......@@ -134,23 +146,14 @@ int main (int argc, char *argv[]) {
ms_free(prefix);
}
for(i = 1; i < argc; ++i) {
if (strcmp(argv[i], "--verbose") == 0) {
ortp_set_log_level_mask(ORTP_LOG_DOMAIN, ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
} else if (strcmp(argv[i], "--silent") == 0) {
ortp_set_log_level_mask(ORTP_LOG_DOMAIN, ORTP_FATAL);
} else if (strcmp(argv[i],"--log-file")==0){
CHECK_ARG("--log-file", ++i, argc);
if (mediastreamer2_tester_set_log_file(argv[i]) < 0) return -2;
} else {
int ret = bc_tester_parse_args(argc, argv, i);
if (ret>0) {
i += ret - 1;
continue;
} else if (ret<0) {
bc_tester_helper(argv[0], mediastreamer2_helper);
}
return ret;
int ret = bc_tester_parse_args(argc, argv, i);
if (ret>0) {
i += ret - 1;
continue;
} else if (ret<0) {
bc_tester_helper(argv[0], "");
}
return ret;
}
ret = bc_tester_start(argv[0]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment