diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d6802c12..16b0d1e4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,11 +100,12 @@ endif() if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) include("${EP_bellesip_CONFIG_DIR}/BelleSIPConfig.cmake") include("${EP_ms2_CONFIG_DIR}/Mediastreamer2Config.cmake") + set(BcToolbox_FIND_COMPONENTS tester) include("${EP_bctoolbox_CONFIG_DIR}/BcToolboxConfig.cmake") else() find_package(BelleSIP REQUIRED) find_package(Mediastreamer2 REQUIRED) - find_package(BcToolbox REQUIRED) + find_package(BcToolbox REQUIRED OPTIONAL_COMPONENTS tester) endif() find_package(XML2 REQUIRED) find_package(Zlib) @@ -194,7 +195,7 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR}/coreapi/ ${BELLESIP_INCLUDE_DIRS} ${MEDIASTREAMER2_INCLUDE_DIRS} - ${BCTOOLBOX_INCLUDE_DIRS} + ${BCTOOLBOX_CORE_INCLUDE_DIRS} ) if(ENABLE_TUNNEL) include_directories(${TUNNEL_INCLUDE_DIRS}) @@ -307,7 +308,7 @@ endif() if(ENABLE_TOOLS) add_subdirectory(tools) endif() -if(ENABLE_UNIT_TESTS) +if(ENABLE_UNIT_TESTS AND BCTOOLBOX_TESTER_FOUND) add_subdirectory(tester) endif() diff --git a/Makefile.am b/Makefile.am index f080b33b1..18d95f563 100644 --- a/Makefile.am +++ b/Makefile.am @@ -244,7 +244,7 @@ pkg: $(MACAPPNAME) cp ${srcdir}/pixmaps/linphone.png ./packaging pkgbuild --install-location /Applications --scripts ${srcdir}/build/macos/pkg-scripts --component $(MACAPPNAME) ./packaging/linphone.pkg productbuild --resources . --distribution ${srcdir}/build/macos/pkg-distribution.xml --package-path ./packaging $(MACAPPPKG) - + signed-pkg: pkg mv $(MACAPPPKG) $(MACAPPPKG).tmp productsign --sign "$(BUNDLE_SIGNING_ID)" $(MACAPPPKG).tmp $(MACAPPPKG) @@ -259,7 +259,7 @@ clean-local: discovery: touch specs.c $(CC) --include $(top_builddir)/config.h \ - $(TUNNEL_CFLAGS) $(CFLAGS) $(MEDIASTREAMER2_CFLAGS) $(ORTP_CFLAGS) $(SIPSTACK_CFLAGS) $(CUNIT_CFLAGS) -E -P -v -dD specs.c + $(TUNNEL_CFLAGS) $(CFLAGS) $(MEDIASTREAMER2_CFLAGS) $(ORTP_CFLAGS) $(SIPSTACK_CFLAGS) $(BCTOOLBOXTESTER_CFLAGS) -E -P -v -dD specs.c .PHONY: $(MACAPPNAME) pkg diff --git a/cmake/LinphoneConfig.cmake.in b/cmake/LinphoneConfig.cmake.in index 1ef175934..8c9ef3944 100644 --- a/cmake/LinphoneConfig.cmake.in +++ b/cmake/LinphoneConfig.cmake.in @@ -36,7 +36,11 @@ endif() find_package(Mediastreamer2 REQUIRED) find_package(BelleSIP REQUIRED) if(@ENABLE_TUNNEL@) - find_package(Tunnel) + if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) + include("${EP_tunnel_CONFIG_DIR}/TunnelConfig.cmake") + else() + find_package(Tunnel) + endif() endif() if(@ENABLE_VCARD@) if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) diff --git a/configure.ac b/configure.ac index 2dbbe48b8..633738e7e 100644 --- a/configure.ac +++ b/configure.ac @@ -1069,36 +1069,11 @@ AC_ARG_ENABLE(tests, ) AM_CONDITIONAL(ENABLE_TESTS, test x$tests_enabled = xyes) -PKG_CHECK_MODULES(CUNIT, cunit, [found_cunit=yes],[found_cunit=no]) +PKG_CHECK_MODULES(BCTOOLBOXTESTER, bctoolbox-tester, [found_pkg_config_bctoolboxtester=yes],[found_pkg_config_bctoolboxtester=no]) -if test "$found_cunit" = "no" ; then - AC_CHECK_HEADERS(CUnit/CUnit.h, - [ - AC_CHECK_LIB(cunit,CU_add_suite,[ - found_cunit=yes - CUNIT_LIBS+=" -lcunit" - ]) - - ]) -fi - -case "$target_os" in - *darwin*) - #hack for macport - CUNIT_LIBS+=" -lncurses" - ;; -esac -AM_CONDITIONAL([BUILD_CUNIT_TESTS], [test x$found_cunit = xyes && test x$tests_enabled != xfalse]) -if test "$found_cunit" = "no" ; then - AC_MSG_WARN([Could not find cunit framework, tests are not compiled.]) -else - AC_CHECK_LIB(cunit,CU_get_suite,[ - AC_DEFINE(HAVE_CU_GET_SUITE,1,[defined when CU_get_suite is available]) - ],[foo=bar],[$CUNIT_LIBS]) - - AC_CHECK_LIB(cunit,CU_curses_run_tests,[ - AC_DEFINE(HAVE_CU_CURSES,1,[defined when CU_curses_run_tests is available]) - ],[foo=bar],[$CUNIT_LIBS]) +AM_CONDITIONAL([ENABLE_TESTS], [test x$found_pkg_config_bctoolboxtester = xyes && test x$tests_enabled != xfalse]) +if test "$found_pkg_config_bctoolboxtester" = "no" ; then + AC_MSG_WARN([Could not find bctoolbox-tester wrapper, tests are not compiled.]) fi diff --git a/coreapi/CMakeLists.txt b/coreapi/CMakeLists.txt index 2b1515939..724fdda86 100644 --- a/coreapi/CMakeLists.txt +++ b/coreapi/CMakeLists.txt @@ -148,7 +148,7 @@ add_definitions( ) set(LIBS - ${BCTOOLBOX_LIBRARIES} + ${BCTOOLBOX_CORE_LIBRARIES} ${BELLESIP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES} ${XML2_LIBRARIES} @@ -186,13 +186,10 @@ apply_compile_flags(LINPHONE_SOURCE_FILES_C "CPP" "C") apply_compile_flags(LINPHONE_SOURCE_FILES_CXX "CPP" "CXX") apply_compile_flags(LINPHONE_SOURCE_FILES_OBJC "CPP" "OBJC") -add_library(linphone-objects OBJECT ${LINPHONE_HEADER_FILES} ${LINPHONE_SOURCE_FILES_C} ${LINPHONE_SOURCE_FILES_CXX} ${LINPHONE_SOURCE_FILES_OBJC}) -set_target_properties(linphone-objects PROPERTIES POSITION_INDEPENDENT_CODE TRUE) -add_dependencies(linphone-objects liblinphone-git-version) - if(ENABLE_STATIC) - add_library(linphone-static STATIC $) + add_library(linphone-static STATIC ${LINPHONE_HEADER_FILES} ${LINPHONE_SOURCE_FILES_C} ${LINPHONE_SOURCE_FILES_CXX} ${LINPHONE_SOURCE_FILES_OBJC}) set_target_properties(linphone-static PROPERTIES OUTPUT_NAME linphone) + add_dependencies(linphone-static liblinphone-git-version) target_link_libraries(linphone-static ${LIBS}) if(IOS) target_link_libraries(linphone-static "-framework Foundation" "-framework AVFoundation") @@ -203,8 +200,9 @@ if(ENABLE_STATIC) ) endif() if(ENABLE_SHARED) - add_library(linphone SHARED $) + add_library(linphone SHARED ${LINPHONE_HEADER_FILES} ${LINPHONE_SOURCE_FILES_C} ${LINPHONE_SOURCE_FILES_CXX} ${LINPHONE_SOURCE_FILES_OBJC}) set_target_properties(linphone PROPERTIES VERSION ${LINPHONE_SO_VERSION} LINKER_LANGUAGE CXX) + add_dependencies(linphone liblinphone-git-version) target_link_libraries(linphone ${LIBS}) if(WIN32 AND CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") set_target_properties(linphone PROPERTIES PREFIX "lib") diff --git a/mediastreamer2 b/mediastreamer2 index b0fa19899..5e653bfe4 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit b0fa19899afe3a30ab85f74cc6711207934cd57d +Subproject commit 5e653bfe4c8ea27d09c80d91794f0178a454851e diff --git a/oRTP b/oRTP index de0aee3f2..82fc70766 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit de0aee3f2024cfd1a24fee5f4ed56be5a2032206 +Subproject commit 82fc707667486072a09ba904a8cf03edf68f700e diff --git a/tester/CMakeLists.txt b/tester/CMakeLists.txt index 086b3ca62..a5f3d2f57 100644 --- a/tester/CMakeLists.txt +++ b/tester/CMakeLists.txt @@ -63,8 +63,8 @@ add_definitions(-DBC_CONFIG_FILE="config.h") if(IOS) add_library(linphonetester STATIC ${SOURCE_FILES}) - target_include_directories(linphonetester PUBLIC ${BCTOOLBOX_INCLUDE_DIRS}) - target_link_libraries(linphonetester linphone ${BCTOOLBOX_LIBRARIES}) + target_include_directories(linphonetester PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS}) + target_link_libraries(linphonetester linphone ${BCTOOLBOX_TESTER_LIBRARIES}) install(TARGETS linphonetester RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} @@ -77,8 +77,8 @@ if(IOS) ) elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") add_library(linphone_tester_static STATIC ${SOURCE_FILES}) - target_include_directories(linphone_tester_static PUBLIC ${BCTOOLBOX_INCLUDE_DIRS}) - target_link_libraries(linphone_tester_static linphone ${BCTOOLBOX_LIBRARIES}) + target_include_directories(linphone_tester_static PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS}) + target_link_libraries(linphone_tester_static linphone ${BCTOOLBOX_TESTER_LIBRARIES}) set(RUNTIME_COMPONENT_SOURCES liblinphone_tester_windows.cpp @@ -107,8 +107,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 ${BCTOOLBOX_INCLUDE_DIRS}) - target_link_libraries(liblinphone_tester linphone ${BCTOOLBOX_LIBRARIES}) + target_include_directories(liblinphone_tester PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS}) + target_link_libraries(liblinphone_tester linphone ${BCTOOLBOX_TESTER_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/Makefile.am b/tester/Makefile.am index e60cc7433..521daf033 100644 --- a/tester/Makefile.am +++ b/tester/Makefile.am @@ -87,7 +87,7 @@ EXTRA_DIST = tester_hosts\ -if BUILD_CUNIT_TESTS +if ENABLE_TESTS sounddir = $(datadir)/liblinphone_tester/sounds sound_DATA = $(TESTER_SOUNDS) @@ -141,7 +141,7 @@ liblinphonetester_la_SOURCES = \ liblinphonetester_ladir = $(includedir)/linphone liblinphonetester_la_LDFLAGS= -no-undefined -liblinphonetester_la_LIBADD= ../coreapi/liblinphone.la $(CUNIT_LIBS) +liblinphonetester_la_LIBADD= ../coreapi/liblinphone.la $(BCTOOLBOXTESTER_LIBS) liblinphone_tester_bindir = $(bindir)/liblinphone_tester liblinphone_testerdir = $(datadir)/liblinphone_tester @@ -151,7 +151,7 @@ dist_liblinphone_tester_DATA = tester_hosts messages.db AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/coreapi -I$(top_srcdir)/tester/common AM_CFLAGS = -DBC_CONFIG_FILE=\"config.h\" $(STRICT_OPTIONS) $(STRICT_OPTIONS_CC) \ - -DIN_LINPHONE $(ORTP_CFLAGS) $(MEDIASTREAMER_CFLAGS) $(CUNIT_CFLAGS) \ + -DIN_LINPHONE $(ORTP_CFLAGS) $(MEDIASTREAMER_CFLAGS) $(BCTOOLBOXTESTER_CFLAGS) \ $(BELLESIP_CFLAGS) $(LIBXML2_CFLAGS) $(SQLITE3_CFLAGS) $(BELCARD_CFLAGS) if BUILD_GTK_UI @@ -178,9 +178,9 @@ endif test: liblinphone_tester ./liblinphone_tester --config $(abs_srcdir) $(TEST_OPTIONS) -else !BUILD_CUNIT_TESTS +else !ENABLE_TESTS test: - @echo "CUnit must be installed to be able to run the tests!" + @echo "bctoolbox-tester must be installed to be able to run the tests!" -endif !BUILD_CUNIT_TESTS +endif !ENABLE_TESTS diff --git a/tester/liblinphone_tester.c b/tester/liblinphone_tester.c index 64cff523d..ff785448a 100644 --- a/tester/liblinphone_tester.c +++ b/tester/liblinphone_tester.c @@ -20,9 +20,6 @@ #include "linphonecore.h" #include "private.h" #include "liblinphone_tester.h" -#if HAVE_CU_CURSES -#include "CUnit/CUCurses.h" -#endif #if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) #pragma GCC diagnostic push @@ -44,7 +41,6 @@ static FILE * log_file = NULL; #include #include -#include #define CALLBACK_BUFFER_SIZE 1024 static JNIEnv *current_env = NULL; @@ -113,10 +109,10 @@ JNIEXPORT jint JNICALL Java_org_linphone_tester_Tester_run(JNIEnv *env, jobject } current_env = env; current_obj = obj; - CU_set_trace_handler(cunit_android_trace_handler); + bc_set_trace_handler(cunit_android_trace_handler); ret = main(argc, argv); current_env = NULL; - CU_set_trace_handler(NULL); + bc_set_trace_handler(NULL); for (i=0; i #if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) #pragma GCC diagnostic push #endif #pragma GCC diagnostic ignored "-Wstrict-prototypes" -#include "CUnit/TestRun.h" -#include "CUnit/Automated.h" -#if HAVE_CU_CURSES -#include "CUnit/CUCurses.h" -#endif #ifdef HAVE_GTK #include #endif @@ -270,7 +266,7 @@ bool_t transport_supported(LinphoneTransportType transport) { void linphone_core_manager_init(LinphoneCoreManager *mgr, const char* rc_file) { char *rc_path = NULL; char *hellopath = bc_tester_res("sounds/hello8000.wav"); - mgr->number_of_cunit_error_at_creation = CU_get_number_of_failures(); + mgr->number_of_cunit_error_at_creation = bc_get_number_of_failures(); mgr->v_table.registration_state_changed=registration_state_changed; mgr->v_table.auth_info_requested=auth_info_requested; mgr->v_table.call_state_changed=call_state_changed; @@ -368,7 +364,7 @@ void linphone_core_manager_start(LinphoneCoreManager *mgr, int check_for_proxies mgr->identity = linphone_address_clone(linphone_proxy_config_get_identity_address(proxy)); linphone_address_clean(mgr->identity); } - + if (linphone_core_get_stun_server(mgr->lc) != NULL){ /*before we go, ensure that the stun server is resolved, otherwise all ice related test will fail*/ BC_ASSERT_TRUE(wait_for_stun_resolution(mgr)); @@ -410,7 +406,7 @@ void linphone_core_manager_uninit(LinphoneCoreManager *mgr) { int unterminated_calls; if (!liblinphone_tester_keep_record_files && record_file){ - if ((CU_get_number_of_failures()-mgr->number_of_cunit_error_at_creation)>0) { + if ((bc_get_number_of_failures()-mgr->number_of_cunit_error_at_creation)>0) { ms_message ("Test has failed, keeping recorded file [%s]",record_file); } else { unlink(record_file);