diff --git a/CMakeLists.txt b/CMakeLists.txt
index d1d10d336..0596bcb1c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -106,20 +106,6 @@ else()
endif()
find_package(XML2 REQUIRED)
find_package(Zlib)
-if(ENABLE_UNIT_TESTS)
- find_package(CUnit)
- if(CUNIT_FOUND)
- cmake_push_check_state(RESET)
- list(APPEND CMAKE_REQUIRED_INCLUDES ${CUNIT_INCLUDE_DIRS})
- list(APPEND CMAKE_REQUIRED_LIBRARIES ${CUNIT_LIBRARIES})
- check_symbol_exists("CU_get_suite" "CUnit/CUnit.h" HAVE_CU_GET_SUITE)
- check_symbol_exists("CU_curses_run_tests" "CUnit/CUnit.h" HAVE_CU_CURSES)
- cmake_pop_check_state()
- else()
- message(WARNING "Could not find the cunit library!")
- set(ENABLE_UNIT_TESTS OFF CACHE BOOL "Enable compilation of unit tests." FORCE)
- endif()
-endif()
if(ENABLE_TUNNEL)
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
include("${EP_tunnel_CONFIG_DIR}/TunnelConfig.cmake")
diff --git a/cmake/FindCUnit.cmake b/cmake/FindCUnit.cmake
deleted file mode 100644
index 10c1a10b6..000000000
--- a/cmake/FindCUnit.cmake
+++ /dev/null
@@ -1,58 +0,0 @@
-############################################################################
-# FindCUnit.txt
-# Copyright (C) 2015 Belledonne Communications, Grenoble France
-#
-############################################################################
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-############################################################################
-#
-# - Find the CUnit include file and library
-#
-# CUNIT_FOUND - system has CUnit
-# CUNIT_INCLUDE_DIRS - the CUnit include directory
-# CUNIT_LIBRARIES - The libraries needed to use CUnit
-
-include(CheckIncludeFile)
-include(CheckLibraryExists)
-
-set(_CUNIT_ROOT_PATHS
- ${CMAKE_INSTALL_PREFIX}
-)
-
-find_path(CUNIT_INCLUDE_DIRS
- NAMES CUnit/CUnit.h
- HINTS _CUNIT_ROOT_PATHS
- PATH_SUFFIXES include
-)
-
-if(CUNIT_INCLUDE_DIRS)
- set(HAVE_CUNIT_CUNIT_H 1)
-endif()
-
-find_library(CUNIT_LIBRARIES
- NAMES cunit
- HINTS ${_CUNIT_ROOT_PATHS}
- PATH_SUFFIXES bin lib
-)
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(CUnit
- DEFAULT_MSG
- CUNIT_INCLUDE_DIRS CUNIT_LIBRARIES
-)
-
-mark_as_advanced(CUNIT_INCLUDE_DIRS CUNIT_LIBRARIES)
diff --git a/mediastreamer2 b/mediastreamer2
index 491ab7ecd..ec7ca51d8 160000
--- a/mediastreamer2
+++ b/mediastreamer2
@@ -1 +1 @@
-Subproject commit 491ab7ecd0611841964c46e33e76f5d23f786265
+Subproject commit ec7ca51d8e96d38549e9331e3476c21ee43c65c4
diff --git a/tester/CMakeLists.txt b/tester/CMakeLists.txt
index c6caa5d21..1cf6c75fa 100644
--- a/tester/CMakeLists.txt
+++ b/tester/CMakeLists.txt
@@ -21,7 +21,6 @@
############################################################################
set(SOURCE_FILES
- common/bc_tester_utils.c
accountmanager.c
call_tester.c
complex_sip_call_tester.c
@@ -63,29 +62,28 @@ add_definitions(-DBC_CONFIG_FILE="config.h")
if(IOS)
add_library(linphonetester STATIC ${SOURCE_FILES})
- target_include_directories(linphonetester PUBLIC ${CUNIT_INCLUDE_DIRS} PRIVATE common)
- target_link_libraries(linphonetester linphone ${CUNIT_LIBRARIES})
+ target_include_directories(linphonetester PUBLIC ${BCTOOLBOX_INCLUDE_DIRS})
+ target_link_libraries(linphonetester linphone ${BCTOOLBOX_LIBRARIES})
install(TARGETS linphonetester
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
- install(FILES "liblinphone_tester.h" "common/bc_tester_utils.h"
+ install(FILES "liblinphone_tester.h"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/linphone
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
add_library(linphone_tester_static STATIC ${SOURCE_FILES})
- target_include_directories(linphone_tester_static PUBLIC ${CUNIT_INCLUDE_DIRS} PRIVATE common)
- target_link_libraries(linphone_tester_static linphone ${CUNIT_LIBRARIES})
+ target_include_directories(linphone_tester_static PUBLIC ${BCTOOLBOX_INCLUDE_DIRS})
+ target_link_libraries(linphone_tester_static linphone ${BCTOOLBOX_LIBRARIES})
set(RUNTIME_COMPONENT_SOURCES
liblinphone_tester_windows.cpp
liblinphone_tester_windows.h
)
add_library(linphone_tester_runtime MODULE ${RUNTIME_COMPONENT_SOURCES})
- target_include_directories(linphone_tester_runtime PRIVATE common)
target_compile_options(linphone_tester_runtime PRIVATE "/wd4996")
target_link_libraries(linphone_tester_runtime linphone_tester_static)
set_target_properties(linphone_tester_runtime PROPERTIES VS_WINRT_COMPONENT TRUE)
@@ -108,8 +106,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
else()
add_executable(liblinphone_tester ${SOURCE_FILES})
set_target_properties(liblinphone_tester PROPERTIES LINKER_LANGUAGE CXX)
- target_include_directories(liblinphone_tester PUBLIC ${CUNIT_INCLUDE_DIRS} PRIVATE common)
- target_link_libraries(liblinphone_tester linphone ${CUNIT_LIBRARIES})
+ target_include_directories(liblinphone_tester PUBLIC ${BCTOOLBOX_INCLUDE_DIRS})
+ target_link_libraries(liblinphone_tester linphone ${BCTOOLBOX_LIBRARIES})
if (GTK2_FOUND)
target_compile_definitions(liblinphone_tester PRIVATE HAVE_GTK)
target_include_directories(liblinphone_tester PUBLIC ${GTK2_INCLUDE_DIRS})
diff --git a/tester/common/bc_completion b/tester/common/bc_completion
deleted file mode 100644
index c5bd543d2..000000000
--- a/tester/common/bc_completion
+++ /dev/null
@@ -1,115 +0,0 @@
-# Copyright (C) 2012 Belledonne Comunications, Grenoble, France
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-# Created by Gautier Pelloux-Prayer on 2014/10/24.
-# This script adds auto-completion for liblinphone_tester binary for Bash and
-# Zsh. To use it, just type: `source liblinphone_completion`, then for each
-# supported exectuable (see end of file), you will get auto-completions.
-# To use it permanently, source this file in your .rc file (.bashrc or .zshrc).
-
-_liblinphone_complete() {
- local completions command_requiring_argument prev_arg latest_arg available_tasks has_not_set_suite suite_name
-
- if [ -n "$BASH_VERSION" ]; then
- set -- "${COMP_WORDS[@]}" #convert them to arguments (eg $1,$#,$@,etc.)
- elif [ -n "$ZSH_VERSION" ]; then
- local args
- read -cA args #read list of arguments user entered
- set -- "${args[@]}" #convert them to arguments (eg $1,$#,$@,etc.)
- fi
- #skip program name
- program=$1
- shift
-
- # if user required help, do not complete anything
- if ! grep -q -- "--help" <<< "$@"; then
- # retrieve the last argument
- latest_arg=""
- prev_arg=""
- latest_is_empty=0
- for arg in "$@"; do
- if [ ! -z "$arg" ]; then
- prev_arg="$latest_arg"
- latest_arg="$arg"
- else
- latest_is_empty=1
- fi
- done
-
- # get the tasks available, from --help
- available_tasks="$($program 2>&1 --help | sed -nE "s/.*--([^ ]*).*/--\\1/p")"
-
- # these commands expect an argument
- command_requiring_argument="$($program 2>&1 --help | sed -nE "s/.*--(.*) <.*/--\\1/p")"
-
- # remove all already provided tasks (it's useless to provide them twice)
- if [[ ! -z "$@" ]]; then
- current_tasks=$(echo $@ | grep -Eo -- "--([^ ])*" | tr '\n' '|' | sed 's/|/$|/g')--$
- if [ ! -z "$current_tasks" ]; then
- available_tasks=$(echo "$available_tasks" | grep -vE -- "(${current_tasks})")
- fi
- fi
- # remove --test option if --suite is not provided yet!
- has_not_set_suite=$(grep -q -- "--suite" <<< "$@"; echo $?)
- if [ $has_not_set_suite = 1 ]; then
- available_tasks=$(echo "$available_tasks" | grep -v -- --test)
- fi
-
- # if latest arg does not start with '--', it is a custom value
- if [ $latest_is_empty = 0 ] && ! grep -q -- '^--' <<< "$latest_arg"; then
- if [ "$prev_arg" = "--test" ] && [ $has_not_set_suite = 0 ]; then
- suite_name=$(echo $@ | sed -nE 's/.*--suite ([^(--)]*) (--.*)$/\1/p' |sed "s@\\\\@@g")
- completions="$($program --list-tests $suite_name)"
- elif [ "$prev_arg" = "--suite" ] || [ "$prev_arg" = "--list-tests" ]; then
- completions="$($program --list-suites)"
- fi
- elif [ "$latest_arg" = "--test" ]; then
- # list available tests if --suite was provided
- if [ $has_not_set_suite = 0 ]; then
- suite_name=$(echo $@ | sed -nE 's/.*--suite ([^(--)]*) (--.*)/\1/p' |sed "s@\\\\@@g")
- completions="$($program --list-tests $suite_name)"
- fi
- elif [ "$latest_arg" = "--suite" ] || [ "$latest_arg" = "--list-tests" ]; then
- completions="$($program --list-suites)"
- # we are waiting for a custom value, so do not hint anything
- elif [[ ! -z "$latest_arg" ]] && grep -q -- "^$latest_arg$" <<< "$command_requiring_argument"; then
- completions=""
- else
- completions="$available_tasks"
- fi
- fi
-
- if [ ! -z "$completions" ]; then
- if [ -n "$BASH_VERSION" ]; then
- IFS=$'\n' #if that even necessary?
- COMPREPLY=($(compgen -W "${completions}" -- ${COMP_WORDS[COMP_CWORD]}))
- elif [ -n "$ZSH_VERSION" ]; then
- reply=( "${(ps:\n:)completions}" )
- fi
- fi
-}
-
-for tester in liblinphone_tester mediastreamer2_tester belle_sip_tester pcap_playback \
- bench mediastream msaudiocmp mtudiscover videodisplay linphone lpc2xml_test \
- lp-gen-wrappers xml2lpc_test; do
- if [ -n "$BASH_VERSION" ]; then
- complete -F _liblinphone_complete $tester
- elif [ -n "$ZSH_VERSION" ]; then
- compctl -K _liblinphone_complete $tester
- else
- echo "Your shell might be not supported! Only bash and zsh tested."
- fi
-done
diff --git a/tester/common/bc_tester_utils.c b/tester/common/bc_tester_utils.c
deleted file mode 100644
index 500851942..000000000
--- a/tester/common/bc_tester_utils.c
+++ /dev/null
@@ -1,731 +0,0 @@
-/*
-tester - liblinphone test suite
-Copyright (C) 2013 Belledonne Communications SARL
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-*/
-
-
-/* this must be provided at compile time*/
-#include BC_CONFIG_FILE
-
-#include "bc_tester_utils.h"
-
-#include
-#include
-#include
-
-#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
-#pragma GCC diagnostic push
-#endif
-#pragma GCC diagnostic ignored "-Wstrict-prototypes"
-
-#include "CUnit/Basic.h"
-#include "CUnit/Automated.h"
-#include "CUnit/MyMem.h"
-
-#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
-#pragma GCC diagnostic pop
-#endif
-
-#ifdef _WIN32
-#if defined(__MINGW32__) || !defined(WINAPI_FAMILY_PARTITION) || !defined(WINAPI_PARTITION_DESKTOP)
-#define BC_TESTER_WINDOWS_DESKTOP 1
-#elif defined(WINAPI_FAMILY_PARTITION)
-#if defined(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-#define BC_TESTER_WINDOWS_DESKTOP 1
-#endif
-#if defined(WINAPI_PARTITION_PHONE_APP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
-#define BC_TESTER_WINDOWS_PHONE 1
-#endif
-#if defined(WINAPI_PARTITION_APP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
-#define BC_TESTER_WINDOWS_UNIVERSAL 1
-#endif
-#endif
-#endif
-
-#ifdef __linux
-/*for monitoring total space allocated via malloc*/
-#include
-#endif
-
-static char *bc_tester_resource_dir_prefix = NULL;
-// by default writable will always write near the executable
-static char *bc_tester_writable_dir_prefix = NULL;
-
-static char *bc_current_suite_name = NULL;
-static char *bc_current_test_name = NULL;
-
-int bc_printf_verbosity_info;
-int bc_printf_verbosity_error;
-
-static test_suite_t **test_suite = NULL;
-static int nb_test_suites = 0;
-
-#ifdef HAVE_CU_CURSES
-#include "CUnit/CUCurses.h"
-static unsigned char curses = 0;
-#endif
-
-char* xml_file = "CUnitAutomated-Results.xml";
-int xml_enabled = 0;
-char * suite_name = NULL;
-char * test_name = NULL;
-char * tag_name = NULL;
-static long max_vm_kb = 0;
-
-void (*tester_printf_va)(int level, const char *format, va_list args);
-
-void bc_tester_printf(int level, const char *format, ...) {
- va_list args;
- va_start (args, format);
- tester_printf_va(level, format, args);
- va_end (args);
-}
-
-int bc_tester_run_suite(test_suite_t *suite, const char *tag_name) {
- int i;
- CU_pSuite pSuite;
-
- if (tag_name != NULL) {
- int j;
- int nb_tests_for_tag = 0;
- for (i = 0; i < suite->nb_tests; i++) {
- for (j = 0; j < (sizeof(suite->tests[i].tags) / sizeof(suite->tests[i].tags[0])); j++) {
- if ((suite->tests[i].tags[j] != NULL) && (strcasecmp(tag_name, suite->tests[i].tags[j]) == 0)) {
- nb_tests_for_tag++;
- }
- }
- }
- if (nb_tests_for_tag > 0) {
- pSuite = CU_add_suite(suite->name, suite->before_all, suite->after_all);
- for (i = 0; i < suite->nb_tests; i++) {
- for (j = 0; j < (sizeof(suite->tests[i].tags) / sizeof(suite->tests[i].tags[0])); j++) {
- if ((suite->tests[i].tags[j] != NULL) && (strcasecmp(tag_name, suite->tests[i].tags[j]) == 0)) {
- if (NULL == CU_add_test(pSuite, suite->tests[i].name, suite->tests[i].func)) {
- return CU_get_error();
- }
- }
- }
- }
- }
- } else {
- pSuite = CU_add_suite(suite->name, suite->before_all, suite->after_all);
- for (i = 0; i < suite->nb_tests; i++) {
- if (NULL == CU_add_test(pSuite, suite->tests[i].name, suite->tests[i].func)) {
- return CU_get_error();
- }
- }
- }
-
- return 0;
-}
-
-const char * bc_tester_suite_name(int suite_index) {
- if (suite_index >= nb_test_suites) return NULL;
- return test_suite[suite_index]->name;
-}
-
-int bc_tester_suite_index(const char *suite_name) {
- int i;
-
- for (i = 0; i < nb_test_suites; i++) {
- if (strcmp(suite_name, test_suite[i]->name) == 0) {
- return i;
- }
- }
-
- return -1;
-}
-
-
-int bc_tester_test_index(test_suite_t *suite, const char *test_name) {
- int i;
-
- for (i = 0; i < suite->nb_tests; i++) {
- if (strcmp(test_name, suite->tests[i].name) == 0) {
- return i;
- }
- }
-
- return -1;
-}
-
-int bc_tester_nb_suites(void) {
- return nb_test_suites;
-}
-
-const char * bc_tester_test_name(const char *suite_name, int test_index) {
- int suite_index = bc_tester_suite_index(suite_name);
- if ((suite_index < 0) || (suite_index >= nb_test_suites)) return NULL;
- if (test_index >= test_suite[suite_index]->nb_tests) return NULL;
- return test_suite[suite_index]->tests[test_index].name;
-}
-
-int bc_tester_nb_tests(const char *suite_name) {
- int i = bc_tester_suite_index(suite_name);
- if (i < 0) return 0;
- return test_suite[i]->nb_tests;
-}
-
-void bc_tester_list_suites(void) {
- int j;
- for(j=0;jpName);
-}
-
-static void suite_cleanup_failure_message_handler(const CU_pSuite pSuite) {
- bc_tester_printf(bc_printf_verbosity_error,"Suite cleanup failed for [%s]", pSuite->pName);
-}
-
-#ifdef HAVE_CU_GET_SUITE
-static time_t suite_start_time = 0;
-static void suite_start_message_handler(const CU_pSuite pSuite) {
- bc_tester_printf(bc_printf_verbosity_info,"Suite [%s] started\n", pSuite->pName);
- suite_start_time = time(NULL);
- bc_current_suite_name = pSuite->pName;
-}
-static void suite_complete_message_handler(const CU_pSuite pSuite, const CU_pFailureRecord pFailure) {
- bc_tester_printf(bc_printf_verbosity_info, "Suite [%s] ended in %lu sec\n", pSuite->pName,
- time(NULL) - suite_start_time);
-}
-
-static time_t test_start_time = 0;
-static void test_start_message_handler(const CU_pTest pTest, const CU_pSuite pSuite) {
- int suite_index = bc_tester_suite_index(pSuite->pName);
- if (test_suite[suite_index]->before_each) {
- test_suite[suite_index]->before_each();
- }
- bc_tester_printf(bc_printf_verbosity_info,"Suite [%s] Test [%s] started", pSuite->pName,pTest->pName);
- test_start_time = time(NULL);
- bc_current_test_name = pTest->pName;
-}
-
-/*derivated from cunit*/
-static void test_complete_message_handler(const CU_pTest pTest, const CU_pSuite pSuite,
- const CU_pFailureRecord pFailureList) {
- int i;
- int suite_index = bc_tester_suite_index(pSuite->pName);
- CU_pFailureRecord pFailure = pFailureList;
- char *buffer = NULL;
- char* result = bc_sprintf("Suite [%s] Test [%s] %s in %lu secs", pSuite->pName, pTest->pName,
- pFailure ? "failed" : "passed", (unsigned long)(time(NULL) - test_start_time));
-
- if (pFailure) {
- for (i = 1; (NULL != pFailure); pFailure = pFailure->pNext, i++) {
- buffer = bc_sprintf("%s\n %d. %s:%u - %s",
- result,
- i,
- (NULL != pFailure->strFileName) ? pFailure->strFileName : "",
- pFailure->uiLineNumber,
- (NULL != pFailure->strCondition) ? pFailure->strCondition : "");
- free(result);
- result = buffer;
- }
- }
-
- bc_tester_printf(bc_printf_verbosity_info,"%s", result);
- free(result);
-
- if (test_suite[suite_index]->after_each) {
- int err = test_suite[suite_index]->after_each();
- //if test passed but not after_each, count it as failure
- if (err && !pFailure) {
- CU_get_run_summary()->nTestsFailed++;
- }
- }
- //insert empty line
- bc_tester_printf(bc_printf_verbosity_info,"");
-
-#ifdef __linux
- /* use mallinfo() to monitor allocated space. It is linux specific but other methods don't work:
- * setrlimit() RLIMIT_DATA doesn't count memory allocated via mmap() (which is used internally by malloc)
- * setrlimit() RLIMIT_AS works but also counts virtual memory allocated by thread stacks, which is very big and
- * hardly controllable.
- * setrlimit() RLIMIT_RSS does nothing interesting on linux.
- * getrusage() of RSS is unreliable: memory blocks can be leaked without being read or written, which would not
- * appear in RSS.
- * mallinfo() itself is the less worse solution. Allocated bytes are returned as 'int' so limited to 2GB
- */
- if (max_vm_kb) {
- struct mallinfo minfo = mallinfo();
- if (minfo.uordblks > max_vm_kb * 1024) {
- bc_tester_printf(
- bc_printf_verbosity_error,
- "The program exceeded the maximum amount of memory allocatable (%i bytes), aborting now.\n",
- minfo.uordblks);
- abort();
- }
- }
-#endif
-}
-#endif
-
-int bc_tester_run_tests(const char *suite_name, const char *test_name, const char *tag_name) {
- int i;
-
- /* initialize the CUnit test registry */
- if (CUE_SUCCESS != CU_initialize_registry())
- return CU_get_error();
-
- for (i = 0; i < nb_test_suites; i++) {
- bc_tester_run_suite(test_suite[i], tag_name);
- }
-#ifdef HAVE_CU_GET_SUITE
- CU_set_suite_start_handler(suite_start_message_handler);
- CU_set_suite_complete_handler(suite_complete_message_handler);
- CU_set_test_start_handler(test_start_message_handler);
- CU_set_test_complete_handler(test_complete_message_handler);
-#endif
- CU_set_all_test_complete_handler(all_complete_message_handler);
- CU_set_suite_init_failure_handler(suite_init_failure_message_handler);
- CU_set_suite_cleanup_failure_handler(suite_cleanup_failure_message_handler);
-
- if( xml_enabled != 0 ){
- CU_automated_run_tests();
- } else {
-
-#ifndef HAVE_CU_GET_SUITE
- if( suite_name ){
- bc_tester_printf(bc_printf_verbosity_info, "Tester compiled without CU_get_suite() function, running all tests instead of suite '%s'", suite_name);
- }
-#else
- if (suite_name){
- CU_pSuite suite;
- suite=CU_get_suite(suite_name);
- if (!suite) {
- if (tag_name != NULL) {
- bc_tester_printf(bc_printf_verbosity_error, "Could not find suite '%s' or this suite has no tests with tag '%s'. Available suites are:", suite_name, tag_name);
- } else {
- bc_tester_printf(bc_printf_verbosity_error, "Could not find suite '%s'. Available suites are:", suite_name);
- }
- bc_tester_list_suites();
- return -1;
- } else if (test_name) {
- CU_pTest test=CU_get_test_by_name(test_name, suite);
- if (!test) {
- if (tag_name != NULL) {
- bc_tester_printf(bc_printf_verbosity_error, "Could not find test '%s' in suite '%s' or this test is not tagged '%s'. Available tests are:", test_name, suite_name, tag_name);
- } else {
- bc_tester_printf(bc_printf_verbosity_error, "Could not find test '%s' in suite '%s'. Available tests are:", test_name, suite_name);
- }
- // do not use suite_name here, since this method is case sensitive
- bc_tester_list_tests(suite->pName);
- return -2;
- } else {
- CU_ErrorCode err= CU_run_test(suite, test);
- if (err != CUE_SUCCESS) bc_tester_printf(bc_printf_verbosity_error, "CU_basic_run_test error %d", err);
- }
- } else {
- CU_run_suite(suite);
- }
- }
- else
-#endif
- {
-#ifdef HAVE_CU_CURSES
- if (curses) {
- /* Run tests using the CUnit curses interface */
- CU_curses_run_tests();
- }
- else
-#endif
- {
- /* Run all tests using the CUnit Basic interface */
- CU_run_all_tests();
- }
- }
- }
-#ifdef __linux
- bc_tester_printf(bc_printf_verbosity_info, "Still %i kilobytes allocated when all tests are finished.",
- mallinfo().uordblks / 1024);
-#endif
-
- return CU_get_number_of_tests_failed()!=0;
-
-}
-
-
-void bc_tester_helper(const char *name, const char* additionnal_helper) {
- bc_tester_printf(bc_printf_verbosity_info,
- "%s --help\n"
-#ifdef HAVE_CU_CURSES
- "\t\t\t--curses\n"
-#endif
- "\t\t\t--list-suites\n"
- "\t\t\t--list-tests \n"
- "\t\t\t--suite \n"
- "\t\t\t--test \n"
- "\t\t\t--resource-dir (directory where tester resource are located)\n"
- "\t\t\t--writable-dir (directory where temporary files should be created)\n"
- "\t\t\t--xml\n"
- "\t\t\t--xml-file \n"
- "\t\t\t--max-alloc (maximum ammount of memory obtained via malloc allocator)\n"
- "And additionally:\n"
- "%s",
- name,
- additionnal_helper);
-}
-
-#if !defined(BC_TESTER_WINDOWS_PHONE) && !defined(BC_TESTER_WINDOWS_UNIVERSAL) && !defined(__QNX__) && !defined(ANDROID) && !defined(IOS)
-static int file_exists(const char* root_path) {
- char * res_path = bc_sprintf("%s/common/bc_completion", root_path);
- FILE* file = fopen(res_path, "r");
- int found = (file != NULL);
- free(res_path);
- if (file) {
- fclose(file);
- }
- return found;
-}
-#endif
-
-static void detect_res_prefix(const char* prog) {
- char* progpath = NULL;
- FILE* writable_file = NULL;
-
- if (prog != NULL) {
- progpath = strdup(prog);
- if (strchr(prog, '/') != NULL) {
- progpath[strrchr(prog, '/') - prog + 1] = '\0';
- } else if (strchr(prog, '\\') != NULL) {
- progpath[strrchr(prog, '\\') - prog + 1] = '\0';
- }
- }
-#if !defined(BC_TESTER_WINDOWS_PHONE) && !defined(BC_TESTER_WINDOWS_UNIVERSAL) && !defined(__QNX__) && !defined(ANDROID) && !defined(IOS)
- {
- char* prefix = NULL;
-
- if (file_exists(".")) {
- prefix = strdup(".");
- } else if (file_exists("..")) {
- prefix = strdup("..");
- } else if (progpath) {
- //for autotools, binary is in .libs/ subdirectory
- char * progpath2 = bc_sprintf("%s/../", progpath);
- if (file_exists(progpath)) {
- prefix = strdup(progpath);
- } else if (file_exists(progpath2)) {
- prefix = strdup(progpath2);
- }
- free(progpath2);
- }
-
- if (bc_tester_resource_dir_prefix != NULL && !file_exists(bc_tester_resource_dir_prefix)) {
- bc_tester_printf(bc_printf_verbosity_error, "Invalid provided resource directory: could not find expected resources in %s.\n", bc_tester_resource_dir_prefix);
- free(bc_tester_resource_dir_prefix);
- bc_tester_resource_dir_prefix = NULL;
- }
-
- if (prefix != NULL) {
- if (bc_tester_resource_dir_prefix == NULL) {
- bc_tester_printf(bc_printf_verbosity_error, "Resource directory set to %s\n", prefix);
- bc_tester_set_resource_dir_prefix(prefix);
- }
-
- if (bc_tester_writable_dir_prefix == NULL) {
- bc_tester_printf(bc_printf_verbosity_error, "Writable directory set to %s\n", prefix);
- bc_tester_set_writable_dir_prefix(prefix);
- }
- free(prefix);
- }
- }
-#endif
-
- // check that we can write in writable directory
- if (bc_tester_writable_dir_prefix != NULL) {
- char * writable_file_path = bc_sprintf("%s/%s", bc_tester_writable_dir_prefix, ".bc_tester_utils.tmp");
- writable_file = fopen(writable_file_path, "w");
- if (writable_file) {
- fclose(writable_file);
- }
- free(writable_file_path);
- }
- if (bc_tester_resource_dir_prefix == NULL || writable_file == NULL) {
- if (bc_tester_resource_dir_prefix == NULL) {
- bc_tester_printf(bc_printf_verbosity_error, "Failed to detect resources for %s.\n", prog);
- bc_tester_printf(bc_printf_verbosity_error, "Could not find resource directory in %s! Please try again using option --resource-dir.\n", progpath);
- }
- if (writable_file == NULL) {
- bc_tester_printf(bc_printf_verbosity_error, "Failed to write file in %s. Please try again using option --writable-dir.\n", bc_tester_writable_dir_prefix);
- }
- abort();
- }
-
- if (progpath != NULL) {
- free(progpath);
- }
-}
-
-void bc_tester_init(void (*ftester_printf)(int level, const char *format, va_list args), int iverbosity_info, int iverbosity_error) {
- tester_printf_va = ftester_printf;
- bc_printf_verbosity_error = iverbosity_error;
- bc_printf_verbosity_info = iverbosity_info;
- bc_tester_writable_dir_prefix = strdup(".");
-}
-
-void bc_tester_set_max_vm(long amax_vm_kb) {
-#ifdef __linux
- max_vm_kb = amax_vm_kb;
- bc_tester_printf(bc_printf_verbosity_info, "Maximum virtual memory space set to %li kilo bytes", max_vm_kb);
-#else
- bc_tester_printf(bc_printf_verbosity_error, "Maximum virtual memory space setting is only implemented on Linux.");
-#endif
-}
-
-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){
- CHECK_ARG("--test", ++i, argc);
- test_name=argv[i];
- } else if (strcmp(argv[i],"--suite")==0){
- CHECK_ARG("--suite", ++i, argc);
- suite_name=argv[i];
- } else if (strcmp(argv[i], "--tag") == 0) {
- CHECK_ARG("--tag", ++i, argc);
- tag_name = argv[i];
- } else if (strcmp(argv[i],"--list-suites")==0){
- bc_tester_list_suites();
- return 0;
- } else if (strcmp(argv[i],"--list-tests")==0){
- CHECK_ARG("--list-tests", ++i, argc);
- suite_name = argv[i];
- bc_tester_list_tests(suite_name);
- return 0;
- } else if (strcmp(argv[i], "--xml-file") == 0){
- CHECK_ARG("--xml-file", ++i, argc);
- xml_file = argv[i];
- xml_enabled = 1;
- } else if (strcmp(argv[i], "--xml") == 0){
- xml_enabled = 1;
- } else if (strcmp(argv[i], "--max-alloc") == 0) {
- CHECK_ARG("--max-alloc", ++i, argc);
- max_vm_kb = atol(argv[i]);
- } else if (strcmp(argv[i], "--resource-dir") == 0) {
- CHECK_ARG("--resource-dir", ++i, argc);
- bc_tester_resource_dir_prefix = strdup(argv[i]);
- } else if (strcmp(argv[i], "--writable-dir") == 0) {
- CHECK_ARG("--writable-dir", ++i, argc);
- bc_tester_writable_dir_prefix = strdup(argv[i]);
- } else {
- bc_tester_printf(bc_printf_verbosity_error, "Unknown option \"%s\"\n", argv[i]);
- return -1;
- }
-
- if( xml_enabled && (suite_name || test_name) ){
- bc_tester_printf(bc_printf_verbosity_error, "Cannot use both XML and specific test suite\n");
- return -1;
- }
-
- /* returns number of arguments read + 1 */
- return i - argid + 1;
-}
-
-int bc_tester_start(const char* prog_name) {
- int ret;
-
- detect_res_prefix(prog_name);
-
- if (max_vm_kb)
- bc_tester_set_max_vm(max_vm_kb);
-
- if( xml_enabled ){
- char * xml_tmp_file = bc_sprintf("%s.tmp", xml_file);
- CU_set_output_filename(xml_tmp_file);
- free(xml_tmp_file);
- }
-
- ret = bc_tester_run_tests(suite_name, test_name, tag_name);
-
- return ret;
-}
-void bc_tester_add_suite(test_suite_t *suite) {
- if (test_suite == NULL) {
- test_suite = (test_suite_t **)malloc(10 * sizeof(test_suite_t *));
- }
- test_suite[nb_test_suites] = suite;
- nb_test_suites++;
- if ((nb_test_suites % 10) == 0) {
- test_suite = (test_suite_t **)realloc(test_suite, (nb_test_suites + 10) * sizeof(test_suite_t *));
- }
-}
-
-void bc_tester_uninit(void) {
- /* Redisplay list of failed tests on end */
- /*BUG: do not display list of failures on mingw, it crashes mysteriously*/
-#if !defined(WIN32) && !defined(_MSC_VER)
- /* Redisplay list of failed tests on end */
- if (CU_get_number_of_failure_records()){
- CU_basic_show_failures(CU_get_failure_list());
- }
-#endif
- CU_cleanup_registry();
- /*add missing final newline*/
- bc_tester_printf(bc_printf_verbosity_info,"");
-
- if( xml_enabled ){
- /*create real xml file only if tester did not crash*/
- char * xml_tmp_file = bc_sprintf("%s.tmp-Results.xml", xml_file);
- rename(xml_tmp_file, xml_file);
- free(xml_tmp_file);
- }
-
- if (test_suite != NULL) {
- free(test_suite);
- test_suite = NULL;
- nb_test_suites = 0;
- }
-
- if (bc_tester_resource_dir_prefix != NULL) {
- free(bc_tester_resource_dir_prefix);
- bc_tester_resource_dir_prefix = NULL;
- }
- if (bc_tester_writable_dir_prefix != NULL) {
- free(bc_tester_writable_dir_prefix);
- bc_tester_writable_dir_prefix = NULL;
- }
-}
-
-static void bc_tester_set_dir_prefix(char **prefix, const char *name) {
- if (*prefix != NULL) free(*prefix);
- *prefix = strdup(name);
-}
-
-const char * bc_tester_get_resource_dir_prefix(void) {
- return bc_tester_resource_dir_prefix;
-}
-
-void bc_tester_set_resource_dir_prefix(const char *name) {
- bc_tester_set_dir_prefix(&bc_tester_resource_dir_prefix, name);
-}
-
-const char * bc_tester_get_writable_dir_prefix(void) {
- return bc_tester_writable_dir_prefix;
-}
-
-void bc_tester_set_writable_dir_prefix(const char *name) {
- bc_tester_set_dir_prefix(&bc_tester_writable_dir_prefix, name);
-}
-
-static char * bc_tester_path(const char *prefix, const char *name) {
- if (name) {
- return bc_sprintf("%s/%s", prefix, name);
- } else {
- return NULL;
- }
-}
-
-char * bc_tester_res(const char *name) {
- return bc_tester_path(bc_tester_resource_dir_prefix, name);
-}
-
-char * bc_tester_file(const char *name) {
- return bc_tester_path(bc_tester_writable_dir_prefix, name);
-}
-
-char* bc_sprintfva(const char* format, va_list args) {
- /* Guess we need no more than 100 bytes. */
- int n, size = 200;
- char *p,*np;
-#ifndef WIN32
- va_list cap;/*copy of our argument list: a va_list cannot be re-used (SIGSEGV on linux 64 bits)*/
-#endif
- if ((p = malloc(size)) == NULL)
- return NULL;
- while (1)
- {
- /* Try to print in the allocated space. */
-#ifndef WIN32
- va_copy(cap,args);
- n = vsnprintf (p, size, format, cap);
- va_end(cap);
-#else
- /*this works on 32 bits, luckily*/
- n = vsnprintf (p, size, format, args);
-#endif
- /* If that worked, return the string. */
- if (n > -1 && n < size)
- return p;
- //bc_tester_printf(bc_printf_verbosity_error, "Reallocing space.\n");
- /* Else try again with more space. */
- if (n > -1) /* glibc 2.1 */
- size = n + 1; /* precisely what is needed */
- else /* glibc 2.0 */
- size *= 2; /* twice the old size */
- if ((np = realloc (p, size)) == NULL)
- {
- free(p);
- return NULL;
- }
- else
- {
- p = np;
- }
- }
-}
-
-char* bc_sprintf(const char* format, ...) {
- va_list args;
- char* res;
- va_start(args, format);
- res = bc_sprintfva(format, args);
- va_end (args);
- return res;
-}
-
-void bc_free(void *ptr) {
- free(ptr);
-}
-
-const char * bc_tester_current_suite_name(void) {
- return bc_current_suite_name;
-}
-
-const char * bc_tester_current_test_name(void) {
- return bc_current_test_name;
-}
-
-const char ** bc_tester_current_test_tags(void) {
- if (bc_current_suite_name && bc_current_test_name) {
- int suite_index = bc_tester_suite_index(bc_current_suite_name);
- int test_index = bc_tester_test_index(test_suite[suite_index], bc_current_test_name);
- return test_suite[suite_index]->tests[test_index].tags;
- }
- return NULL;
-}
diff --git a/tester/common/bc_tester_utils.h b/tester/common/bc_tester_utils.h
deleted file mode 100644
index 90fa53664..000000000
--- a/tester/common/bc_tester_utils.h
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- tester - liblinphone test suite
- Copyright (C) 2013 Belledonne Communications SARL
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-*/
-
-#ifndef TESTER_UTILS_H
-#define TESTER_UTILS_H
-
-#include
-#include
-#include
-#include
-
-#ifdef _WIN32
-#ifndef snprintf
-#define snprintf _snprintf
-#define strcasecmp _stricmp
-#endif
-#ifndef strdup
-#define strdup _strdup
-#endif
-#endif
-
-extern int bc_printf_verbosity_info;
-extern int bc_printf_verbosity_error;
-
-typedef void (*test_function_t)(void);
-/** Function used in all suites - it is invoked before all and each tests and also after each and all tests
- * @return 0 means success, otherwise it's an error
-**/
-typedef int (*pre_post_function_t)(void);
-// typedef int (*test_suite_function_t)(const char *name);
-
-typedef struct {
- const char *name;
- test_function_t func;
- const char *tags[2];
-} test_t;
-
-#define TEST_NO_TAG(name, func) \
- { name, func, { NULL, NULL } }
-#define TEST_ONE_TAG(name, func, tag) \
- { name, func, { tag, NULL } }
-#define TEST_TWO_TAGS(name, func, tag1, tag2) \
- { name, func, { tag1, tag2 } }
-
-typedef struct {
- const char *name; /*suite name*/
- pre_post_function_t
- before_all; /*function invoked before running the suite. If not returning 0, suite is not launched. */
- pre_post_function_t after_all; /*function invoked at the end of the suite, even if some tests failed. */
- test_function_t before_each; /*function invoked before each test within this suite. */
- pre_post_function_t after_each; /*function invoked after each test within this suite, even if it failed. */
- int nb_tests; /* number of tests */
- test_t *tests; /* tests within this suite */
-} test_suite_t;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#define CHECK_ARG(argument, index, argc) \
-if(index >= argc) { \
-fprintf(stderr, "Missing argument for \"%s\"\n", argument); \
-return -1; \
-} \
-
-void bc_tester_init(void (*ftester_printf)(int level, const char *fmt, va_list args)
- , int verbosity_info, int verbosity_error);
-void bc_tester_helper(const char *name, const char* additionnal_helper);
-int bc_tester_parse_args(int argc, char** argv, int argid);
-int bc_tester_start(const char* prog_name);
-void bc_tester_add_suite(test_suite_t *suite);
-void bc_tester_uninit(void);
-void bc_tester_printf(int level, const char *fmt, ...);
-const char * bc_tester_get_resource_dir_prefix(void);
-void bc_tester_set_resource_dir_prefix(const char *name);
-const char * bc_tester_get_writable_dir_prefix(void);
-void bc_tester_set_writable_dir_prefix(const char *name);
-
-int bc_tester_nb_suites(void);
-int bc_tester_nb_tests(const char* name);
-void bc_tester_list_suites(void);
-void bc_tester_list_tests(const char *suite_name);
-const char * bc_tester_suite_name(int suite_index);
-const char * bc_tester_test_name(const char *suite_name, int test_index);
-int bc_tester_run_suite(test_suite_t *suite, const char *tag_name);
-int bc_tester_run_tests(const char *suite_name, const char *test_name, const char *tag_name);
-int bc_tester_suite_index(const char *suite_name);
-const char * bc_tester_current_suite_name(void);
-const char * bc_tester_current_test_name(void);
-const char ** bc_tester_current_test_tags(void);
-
-char* bc_sprintfva(const char* format, va_list args);
-char* bc_sprintf(const char* format, ...);
-void bc_free(void *ptr);
-
-/**
- * Get full path to the given resource
- *
- * @param name relative resource path
- * @return path to the resource. Must be freed by caller.
-*/
-char * bc_tester_res(const char *name);
-
-/**
-* Get full path to the given writable_file
-*
-* @param name relative writable file path
-* @return path to the writable file. Must be freed by caller.
-*/
-char * bc_tester_file(const char *name);
-
-
-/*Redefine the CU_... macros WITHOUT final ';' semicolon, to allow IF conditions and smarter error message */
-extern int CU_assertImplementation(int bValue,
- unsigned int uiLine,
- const char *strCondition,
- const char *strFile,
- const char *strFunction,
- int bFatal);
-
-#ifdef _WIN32
-#define BC_INLINE __inline
-#else
-#define BC_INLINE inline
-#endif
-
-static BC_INLINE int _BC_ASSERT(const char* file, int line, int predicate, const char* format, int fatal) {
- if (!predicate) bc_tester_printf(bc_printf_verbosity_info, format, NULL);
- return CU_assertImplementation(predicate, line, format, file, "", fatal);
-}
-
-#define _BC_ASSERT_PRED(name, pred, actual, expected, type, fatal, ...) \
- do { \
- char format[4096] = {0}; \
- type cactual = (actual); \
- type cexpected = (expected); \
- snprintf(format, 4096, name "(" #actual ", " #expected ") - " __VA_ARGS__); \
- _BC_ASSERT(__FILE__, __LINE__, pred, format, fatal); \
- } while (0)
-
-#define BC_PASS(msg) _BC_ASSERT(__FILE__, __LINE__, TRUE, "BC_PASS(" #msg ").", FALSE)
-#define BC_FAIL(msg) _BC_ASSERT(__FILE__, __LINE__, FALSE, "BC_FAIL(" #msg ").", FALSE)
-#define BC_ASSERT(value) _BC_ASSERT(__FILE__, __LINE__, (value), #value, FALSE)
-#define BC_ASSERT_FATAL(value) _BC_ASSERT(__FILE__, __LINE__, (value), #value, TRUE)
-#define BC_TEST(value) _BC_ASSERT(__FILE__, __LINE__, (value), #value, FALSE)
-#define BC_TEST_FATAL(value) _BC_ASSERT(__FILE__, __LINE__, (value), #value, TRUE)
-#define BC_ASSERT_TRUE(value) _BC_ASSERT(__FILE__, __LINE__, (value), ("BC_ASSERT_TRUE(" #value ")"), FALSE)
-#define BC_ASSERT_TRUE_FATAL(value) _BC_ASSERT(__FILE__, __LINE__, (value), ("BC_ASSERT_TRUE_FATAL(" #value ")"), TRUE)
-#define BC_ASSERT_FALSE(value) _BC_ASSERT(__FILE__, __LINE__, !(value), ("BC_ASSERT_FALSE(" #value ")"), FALSE)
-#define BC_ASSERT_FALSE_FATAL(value) _BC_ASSERT(__FILE__, __LINE__, !(value), ("BC_ASSERT_FALSE_FATAL(" #value ")"), TRUE)
-#define BC_ASSERT_EQUAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_EQUAL", ((cactual) == (cexpected)), actual, expected, type, FALSE, "Expected " type_format " but was " type_format ".", cexpected, cactual)
-#define BC_ASSERT_EQUAL_FATAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_EQUAL_FATAL", ((cactual) == (cexpected)), actual, expected, type, TRUE, "Expected " type_format " but was " type_format ".", cexpected, cactual)
-#define BC_ASSERT_NOT_EQUAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_NOT_EQUAL", ((cactual) != (cexpected)), actual, expected, type, FALSE, "Expected NOT " type_format " but it was.", cexpected)
-#define BC_ASSERT_NOT_EQUAL_FATAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_NOT_EQUAL_FATAL", ((cactual) != (cexpected)), actual, expected, type, TRUE, "Expected NOT " type_format " but it was.", cexpected)
-#define BC_ASSERT_PTR_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_EQUAL", ((cactual) == (cexpected)), (const void*)(actual), (const void*)(expected), const void*, FALSE, "Expected %p but was %p.", cexpected, cactual)
-#define BC_ASSERT_PTR_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_EQUAL_FATAL", ((cactual) == (cexpected)), (const void*)(actual), (const void*)(expected), const void*, TRUE, "Expected %p but was %p.", cexpected, cactual)
-#define BC_ASSERT_PTR_NOT_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_EQUAL", ((cactual) != (cexpected)), (const void*)(actual), (const void*)(expected), const void*, FALSE, "Expected NOT %p but it was.", cexpected)
-#define BC_ASSERT_PTR_NOT_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_EQUAL_FATAL", ((cactual) != (cexpected)), (const void*)(actual), (const void*)(expected), const void*, TRUE, "Expected NOT %p but it was.", cexpected)
-#define BC_ASSERT_PTR_NULL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NULL", ((cactual) == (cexpected)), (const void*)(value), NULL, const void*, FALSE, "Expected NULL but was %p.", cactual)
-#define BC_ASSERT_PTR_NULL_FATAL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NULL_FATAL", ((cactual) == (cexpected)), (const void*)(value), NULL, const void*, TRUE, "Expected NULL but was %p.", cactual)
-#define BC_ASSERT_PTR_NOT_NULL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_NULL", ((cactual) != (cexpected)), (const void*)(value), NULL, const void*, FALSE, "Expected NOT NULL but it was.")
-#define BC_ASSERT_PTR_NOT_NULL_FATAL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_NULL_FATAL", ((cactual) != (cexpected)), (const void*)(value), NULL, const void*, TRUE, "Expected NOT NULL but it was.")
-#define BC_ASSERT_STRING_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_EQUAL", !(strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, FALSE, "Expected %s but was %s.", cexpected, cactual)
-#define BC_ASSERT_STRING_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_EQUAL_FATAL", !(strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, TRUE, "Expected %s but was %s.", cexpected, cactual)
-#define BC_ASSERT_STRING_NOT_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_NOT_EQUAL", (strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, FALSE, "Expected NOT %s but it was.", cexpected)
-#define BC_ASSERT_STRING_NOT_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_NOT_EQUAL_FATAL", (strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, TRUE, "Expected NOT %s but it was.", cexpected)
-#define BC_ASSERT_NSTRING_EQUAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_EQUAL", !(strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, FALSE, "Expected %*s but was %*s.", (int)(count), cexpected, (int)(count), cactual)
-#define BC_ASSERT_NSTRING_EQUAL_FATAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_EQUAL_FATAL", !(strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, TRUE, "Expected %*s but was %*s.", (int)count, cexpected, (int)count, cactual)
-#define BC_ASSERT_NSTRING_NOT_EQUAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_NOT_EQUAL", (strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, FALSE, "Expected %*s but it was.", (int)count, cexpected)
-#define BC_ASSERT_NSTRING_NOT_EQUAL_FATAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_NOT_EQUAL_FATAL", (strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, TRUE, "Expected %*s but it was.", (int)count, cexpected)
-#define BC_ASSERT_DOUBLE_EQUAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_EQUAL", ((fabs((double)(cactual) - (cexpected)) <= fabs((double)(granularity)))), actual, expected, double, FALSE, "Expected %f but was %f.", cexpected, cactual)
-#define BC_ASSERT_DOUBLE_EQUAL_FATAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_EQUAL_FATAL", ((fabs((double)(cactual) - (cexpected)) <= fabs((double)(granularity)))), actual, expected, double, TRUE, "Expected %f but was %f.", cexpected, cactual)
-#define BC_ASSERT_DOUBLE_NOT_EQUAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_NOT_EQUAL", ((fabs((double)(cactual) - (cexpected)) > fabs((double)(granularity)))), actual, expected, double, FALSE, "Expected %f but was %f.", cexpected, cactual)
-#define BC_ASSERT_DOUBLE_NOT_EQUAL_FATAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_NOT_EQUAL_FATAL", ((fabs((double)(cactual) - (cexpected)) > fabs((double)(granularity)))), actual, expected, double, TRUE, "Expected %f but was %f.", cexpected, cactual)
-
-/*Custom defines*/
-#define BC_ASSERT_GREATER(actual, lower, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_GREATER", ((cactual) >= (cexpected)), actual, lower, type, FALSE, "Expected at least " type_format " but was " type_format ".", cexpected, cactual)
-#define BC_ASSERT_LOWER(actual, lower, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_LOWER", ((cactual) <= (cexpected)), actual, lower, type, FALSE, "Expected at most " type_format " but was " type_format ".", cexpected, cactual)
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/tester/liblinphone_tester.c b/tester/liblinphone_tester.c
index f6531ea75..64cff523d 100644
--- a/tester/liblinphone_tester.c
+++ b/tester/liblinphone_tester.c
@@ -163,7 +163,7 @@ void liblinphone_tester_init(void(*ftester_printf)(int level, const char *fmt, v
}
if (ftester_printf == NULL) ftester_printf = log_handler;
- bc_tester_init(ftester_printf, ORTP_MESSAGE, ORTP_ERROR);
+ bc_tester_init(ftester_printf, ORTP_MESSAGE, ORTP_ERROR, "rcfiles");
liblinphone_tester_add_suites();
}
diff --git a/tester/liblinphone_tester.h b/tester/liblinphone_tester.h
index e4ad68522..b56908e12 100644
--- a/tester/liblinphone_tester.h
+++ b/tester/liblinphone_tester.h
@@ -22,7 +22,7 @@
-#include "bc_tester_utils.h"
+#include
#include "linphonecore.h"
#include
#ifdef HAVE_CONFIG_H