bc_tester_utils.c: use tester_printf instead of fprintf and fix android log handling

parent 66fa2a03
mediastreamer2 @ ffbe08f5
Subproject commit 29402bc07879edf7895780fc85f72664e1b725c3
Subproject commit ffbe08f56dfb2e5f7aa70d5ac6ab5a84d0a7acc1
......@@ -115,7 +115,7 @@ int bc_tester_nb_tests(const char *suite_name) {
void bc_tester_list_suites() {
int j;
for(j=0;j<nb_test_suites;j++) {
fprintf(stdout, "%s\n", bc_tester_suite_name(j));
tester_printf(verbosity_info, "%s\n", bc_tester_suite_name(j));
}
}
......@@ -123,7 +123,7 @@ void bc_tester_list_tests(const char *suite_name) {
int j;
for( j = 0; j < bc_tester_nb_tests(suite_name); j++) {
const char *test_name = bc_tester_test_name(suite_name, j);
fprintf(stdout, "%s\n", test_name);
tester_printf(verbosity_info, "%s\n", test_name);
}
}
......@@ -252,7 +252,7 @@ int bc_tester_run_tests(const char *suite_name, const char *test_name) {
void bc_tester_helper(const char *name, const char* additionnal_helper) {
fprintf(stdout,"%s --help\n"
tester_printf(verbosity_info,"%s --help\n"
"\t\t\t--list-suites\n"
"\t\t\t--list-tests <suite>\n"
"\t\t\t--suite <suite name>\n"
......@@ -277,7 +277,6 @@ void bc_tester_init(void (*ftester_printf)(int level, const char *fmt, va_list a
int bc_tester_parse_args(int argc, char **argv, int argid)
{
int i = argid;
if (strcmp(argv[i],"--help")==0){
return -1;
} else if (strcmp(argv[i],"--test")==0){
......@@ -301,12 +300,12 @@ int bc_tester_parse_args(int argc, char **argv, int argid)
} else if (strcmp(argv[i], "--xml") == 0){
xml_enabled = 1;
}else {
fprintf(stderr, "Unknown option \"%s\"\n", argv[i]);
tester_printf(verbosity_error, "Unknown option \"%s\"\n", argv[i]);
return -1;
}
if( xml_enabled && (suite_name || test_name) ){
fprintf(stderr, "Cannot use both XML and specific test suite\n");
tester_printf(verbosity_error, "Cannot use both XML and specific test suite\n");
return -1;
}
......
......@@ -132,8 +132,13 @@ static void liblinphone_tester_qnx_log_handler(OrtpLogLevel lev, const char *fmt
#endif /* __QNX__ */
static void log_handler(int lev, const char *fmt, va_list args) {
#ifdef ANDROID
/* IMPORTANT: needed by liblinphone tester to retrieve suite list...*/
cunit_android_trace_handler(lev == ORTP_ERROR, fmt, args);
#else
ortp_set_log_file(stderr);
ortp_log_handler(lev, fmt, args);
#endif
if (log_file){
ortp_set_log_file(log_file);
ortp_log_handler(lev, fmt, args);
......@@ -141,7 +146,6 @@ static void log_handler(int lev, const char *fmt, va_list args) {
}
void liblinphone_tester_init(void) {
ortp_log_handler = ortp_get_log_handler();
#if defined(ANDROID)
linphone_core_set_log_handler(liblinphone_android_ortp_log_handler);
#elif defined(__QNX__)
......@@ -149,6 +153,7 @@ void liblinphone_tester_init(void) {
#else
linphone_core_set_log_handler(ortp_logv_out);
#endif
ortp_log_handler = ortp_get_log_handler();
bc_tester_init(log_handler, ORTP_MESSAGE, ORTP_ERROR);
liblinphone_tester_add_suites();
......
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