diff --git a/mediastreamer2 b/mediastreamer2 index 1a596c780..a9374f30b 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 1a596c780c9631f686cd4245b618035398264654 +Subproject commit a9374f30b2e5098e646608b0562e50a156fba820 diff --git a/tester/CMakeLists.txt b/tester/CMakeLists.txt index 12454c80f..e9583b955 100644 --- a/tester/CMakeLists.txt +++ b/tester/CMakeLists.txt @@ -26,6 +26,8 @@ endif() find_package(GTK2 2.18 COMPONENTS gtk) set(SOURCE_FILES + common/bc_tester_utils.c + common/bc_tester_utils.h accountmanager.c call_tester.c dtmf_tester.c @@ -50,6 +52,8 @@ set(SOURCE_FILES video_tester.c ) +add_definitions(-DBC_CONFIG_FILE="config.h") + add_executable(liblinphone_tester ${SOURCE_FILES}) set_target_properties(liblinphone_tester PROPERTIES LINKER_LANGUAGE CXX) target_include_directories(liblinphone_tester PUBLIC ${CUNIT_INCLUDE_DIRS}) diff --git a/tester/common/bc_tester_utils.c b/tester/common/bc_tester_utils.c index 0c7bb7038..25e92143f 100644 --- a/tester/common/bc_tester_utils.c +++ b/tester/common/bc_tester_utils.c @@ -44,11 +44,12 @@ const char *bc_tester_writable_dir_prefix = "."; static test_suite_t **test_suite = NULL; static int nb_test_suites = 0; -#if HAVE_CU_CURSES +#ifdef HAVE_CU_CURSES +#include "CUnit/CUCurses.h" static unsigned char curses = 0; #endif -char* xml_file = NULL; +char* xml_file = "CUnitAutomated-Results.xml"; int xml_enabled = 0; char * suite_name; char * test_name; @@ -155,8 +156,8 @@ static void test_complete_message_handler(const CU_pTest pTest, const CU_pFailureRecord pFailureList) { int i; char * result = malloc(sizeof(char)*2048);//not very pretty but... - sprintf(result, "Suite [%s] Test [%s]", pSuite->pName, pTest->pName); CU_pFailureRecord pFailure = pFailureList; + sprintf(result, "Suite [%s] Test [%s]", pSuite->pName, pTest->pName); if (pFailure) { strncat(result, " failed:", strlen(" failed:")); for (i = 1 ; (NULL != pFailure) ; pFailure = pFailure->pNext, i++) { @@ -197,7 +198,7 @@ static int tester_run_tests(const char *suite_name, const char *test_name) { CU_automated_run_tests(); } else { -#if !HAVE_CU_GET_SUITE +#ifndef HAVE_CU_GET_SUITE if( suite_name ){ tester_printf(verbosity_info, "Tester compiled without CU_get_suite() function, running all tests instead of suite '%s'", suite_name); } @@ -227,7 +228,7 @@ static int tester_run_tests(const char *suite_name, const char *test_name) { else #endif { -#if HAVE_CU_CURSES +#ifdef HAVE_CU_CURSES if (curses) { /* Run tests using the CUnit curses interface */ CU_curses_run_tests(); @@ -251,7 +252,7 @@ void bc_tester_helper(const char *name, const char* additionnal_helper) { "\t\t\t--list-tests \n" "\t\t\t--suite \n" "\t\t\t--test \n" -#if HAVE_CU_CURSES +#ifdef HAVE_CU_CURSES "\t\t\t--curses\n" #endif "\t\t\t--xml\n" @@ -312,7 +313,7 @@ int bc_tester_start() { int ret; if( xml_enabled ){ char * xml_tmp_file = malloc(sizeof(char) * (strlen(xml_file) + strlen(".tmp") + 1)); - snprintf(xml_tmp_file, sizeof(xml_tmp_file), "%s.tmp", xml_file); + sprintf(xml_tmp_file, "%s.tmp", xml_file); CU_set_output_filename(xml_tmp_file); free(xml_tmp_file); } @@ -342,8 +343,8 @@ void bc_tester_uninit() { if( xml_enabled ){ /*create real xml file only if tester did not crash*/ - char * xml_tmp_file = malloc(sizeof(char) * (strlen(xml_file) + strlen(".tmp") + 1)); - snprintf(xml_tmp_file, sizeof(xml_tmp_file), "%s.tmp", xml_file); + char * xml_tmp_file = malloc(sizeof(char) * (strlen(xml_file) + strlen(".tmp-Results.xml") + 1)); + sprintf(xml_tmp_file, "%s.tmp-Results.xml", xml_file); rename(xml_tmp_file, xml_file); free(xml_tmp_file); } diff --git a/tester/common/bc_tester_utils.h b/tester/common/bc_tester_utils.h index f12916c7f..a8b952d02 100644 --- a/tester/common/bc_tester_utils.h +++ b/tester/common/bc_tester_utils.h @@ -21,6 +21,7 @@ #define TESTER_UTILS_H #include "CUnit/Basic.h" +#include extern const char *bc_tester_read_dir_prefix; extern const char *bc_tester_writable_dir_prefix;