From b133c5899fa9249652fc6e230808d4a3b7d1088c Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Fri, 17 Nov 2017 14:14:04 +0100 Subject: [PATCH] fix tester build on ios --- coreapi/CMakeLists.txt | 2 +- tester/account_creator_tester.c | 1 + tester/audio_bypass_tester.c | 1 + tester/call_multi_tester.c | 1 + tester/call_multicast_tester.c | 1 + tester/call_single_tester.c | 59 ++++++++++--------- tester/call_video_tester.c | 1 + tester/clonable-object-tester.cpp | 1 + tester/complex_sip_case_tester.c | 9 +-- tester/conference-event-tester.cpp | 1 + tester/content-manager-tester.cpp | 3 +- tester/cpim-tester.cpp | 1 + tester/dtmf_tester.c | 1 + tester/eventapi_tester.c | 25 ++++---- tester/flexisip_tester.c | 5 +- tester/liblinphone_tester.c | 3 +- tester/liblinphone_tester.h | 1 - tester/liblinphone_tester_ios.m | 2 +- tester/liblinphone_tester_windows.cpp | 1 + tester/log_collection_tester.c | 1 + tester/main-db-tester.cpp | 1 + tester/message_tester.c | 3 +- tester/multipart-tester.cpp | 1 + tester/offeranswer_tester.c | 5 +- tester/player_tester.c | 1 + tester/presence_server_tester.c | 85 ++++++++++++++------------- tester/presence_tester.c | 27 +++++---- tester/property-container-tester.cpp | 1 + tester/proxy_config_tester.c | 19 +++--- tester/quality_reporting_tester.c | 17 +++--- tester/register_tester.c | 7 ++- tester/remote_provisioning_tester.c | 1 + tester/setup_tester.c | 2 + tester/stun_tester.c | 1 + tester/tester.c | 1 + tester/tunnel_tester.c | 5 +- tester/vcard_tester.c | 32 +++++----- tester/video_tester.c | 1 + 38 files changed, 183 insertions(+), 147 deletions(-) diff --git a/coreapi/CMakeLists.txt b/coreapi/CMakeLists.txt index 3b05f7ca9..f0005fc12 100644 --- a/coreapi/CMakeLists.txt +++ b/coreapi/CMakeLists.txt @@ -229,7 +229,7 @@ if(ENABLE_SHARED) set_target_properties(linphone PROPERTIES FRAMEWORK TRUE MACOSX_FRAMEWORK_IDENTIFIER org.linphone.linphone - MACOSX_FRAMEWORK_INFO_PLIST Info.plist.in + MACOSX_FRAMEWORK_INFO_PLIST Info.plist.in PUBLIC_HEADER "${LINPHONE_HEADER_FILES}" ) endif() diff --git a/tester/account_creator_tester.c b/tester/account_creator_tester.c index 5588ae4c1..3ae77ff98 100644 --- a/tester/account_creator_tester.c +++ b/tester/account_creator_tester.c @@ -17,6 +17,7 @@ */ #include "liblinphone_tester.h" +#include "tester_utils.h" #include static const char XMLRPC_URL[] = "https://sip2.linphone.org:446/xmlrpc.php"; diff --git a/tester/audio_bypass_tester.c b/tester/audio_bypass_tester.c index 98809f1f3..c6d1f7e23 100644 --- a/tester/audio_bypass_tester.c +++ b/tester/audio_bypass_tester.c @@ -17,6 +17,7 @@ */ #include "liblinphone_tester.h" +#include "tester_utils.h" #include "audio_bypass_wav_header.h" // This is a copy of mediastreamer2/src/audiofilters/wav_header.h /********************************************************************** diff --git a/tester/call_multi_tester.c b/tester/call_multi_tester.c index 56581a1e8..bf874805e 100644 --- a/tester/call_multi_tester.c +++ b/tester/call_multi_tester.c @@ -22,6 +22,7 @@ #include "linphone/core.h" #include "linphone/lpconfig.h" #include "liblinphone_tester.h" +#include "tester_utils.h" #include "mediastreamer2/msutils.h" #include "belle-sip/sipstack.h" diff --git a/tester/call_multicast_tester.c b/tester/call_multicast_tester.c index cf1758705..4b21370e8 100644 --- a/tester/call_multicast_tester.c +++ b/tester/call_multicast_tester.c @@ -18,6 +18,7 @@ #include "liblinphone_tester.h" +#include "tester_utils.h" #include "linphone/core.h" #include "belle-sip/belle-sip.h" diff --git a/tester/call_single_tester.c b/tester/call_single_tester.c index 7e2d0126a..5e79fdd79 100644 --- a/tester/call_single_tester.c +++ b/tester/call_single_tester.c @@ -22,6 +22,7 @@ #include "linphone/core.h" #include "linphone/lpconfig.h" #include "liblinphone_tester.h" +#include "tester_utils.h" #include "mediastreamer2/msutils.h" #include "belle-sip/sipstack.h" #include @@ -223,7 +224,7 @@ void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreMana } wait_for_until(caller->lc,callee->lc,NULL,0,20); /*just to sleep while iterating*/ }while (!liblinphone_tester_clock_elapsed(&ts,max_time_to_wait)); - + reset_call_stats(audio_stats1, linphone_call_get_audio_stats(c1)); reset_call_stats(video_stats1, linphone_call_get_video_stats(c1)); reset_call_stats(audio_stats2, linphone_call_get_audio_stats(c2)); @@ -262,12 +263,12 @@ void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreMana } } - + if (audio_stats1) linphone_call_stats_unref(audio_stats1); if (audio_stats2) linphone_call_stats_unref(audio_stats2); if (video_stats1) linphone_call_stats_unref(video_stats1); if (video_stats2) linphone_call_stats_unref(video_stats2); - + linphone_call_unref(c1); linphone_call_unref(c2); } @@ -1136,20 +1137,20 @@ static void cancel_other_device_after_accept(void) { BC_ASSERT_TRUE(wait_for(caller_mgr->lc, callee_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallOutgoingProgress, 1)); call_callee = linphone_core_get_current_call(callee_mgr->lc); if (BC_ASSERT_PTR_NOT_NULL(call_callee)) { - + linphone_call_ref(call_callee); - + BC_ASSERT_TRUE(wait_for(caller_mgr->lc, callee_mgr_2->lc, &callee_mgr_2->stat.number_of_LinphoneCallIncomingReceived, 1)); call_callee_2 = linphone_core_get_current_call(callee_mgr_2->lc); linphone_call_ref(call_callee_2); BC_ASSERT_PTR_NOT_NULL(call_callee_2); - + BC_ASSERT_EQUAL( linphone_call_accept(call_callee), 0 , int, "%d"); BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr->lc,&caller_mgr->stat.number_of_LinphoneCallConnected,1)); BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallStreamsRunning, 1)); BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr_2->lc,&callee_mgr_2->stat.number_of_LinphoneCallEnd,1)); BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr_2->lc,&callee_mgr_2->stat.number_of_LinphoneCallReleased,1)); - + rei = linphone_call_get_error_info(call_callee_2); BC_ASSERT_PTR_NOT_NULL(rei); if (rei){ @@ -1189,12 +1190,12 @@ static void cancel_other_device_after_decline(void) { call_callee = linphone_core_get_current_call(callee_mgr->lc); if (BC_ASSERT_PTR_NOT_NULL(call_callee)) { linphone_call_ref(call_callee); - + BC_ASSERT_TRUE(wait_for(caller_mgr->lc, callee_mgr_2->lc, &callee_mgr_2->stat.number_of_LinphoneCallIncomingReceived, 1)); call_callee_2 = linphone_core_get_current_call(callee_mgr_2->lc); linphone_call_ref(call_callee_2); BC_ASSERT_PTR_NOT_NULL(call_callee_2); - + BC_ASSERT_EQUAL(linphone_call_decline(call_callee, LinphoneReasonDeclined), 0 , int, "%d"); BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallEnd,1)); BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallReleased, 1)); @@ -1202,7 +1203,7 @@ static void cancel_other_device_after_decline(void) { BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallReleased, 1)); BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr_2->lc, &callee_mgr_2->stat.number_of_LinphoneCallEnd,1)); BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr_2->lc, &callee_mgr_2->stat.number_of_LinphoneCallReleased,1)); - + rei = linphone_call_get_error_info(call_callee_2); BC_ASSERT_PTR_NOT_NULL(rei); if (rei){ @@ -1324,11 +1325,11 @@ static void cancelled_ringing_call(void) { LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); const bctbx_list_t * call_history; LinphoneCall* out_call; - + char * db_path= bctbx_strdup_printf("%s,%s",bc_tester_get_writable_dir_prefix(),"tmp_call_log.db"); linphone_core_set_call_logs_database_path(marie->lc,db_path); - - + + out_call = linphone_core_invite_address(pauline->lc,marie->identity); linphone_call_ref(out_call); BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallIncomingReceived,1)); @@ -1338,12 +1339,12 @@ static void cancelled_ringing_call(void) { BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallReleased,1)); BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallEnd,1, int, "%d"); BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallEnd,1, int, "%d"); - + call_history = linphone_core_get_call_history(marie->lc); BC_ASSERT_PTR_NOT_NULL(call_history); BC_ASSERT_EQUAL((int)bctbx_list_size(call_history),1, int,"%i"); BC_ASSERT_EQUAL(linphone_call_log_get_status((LinphoneCallLog*)bctbx_list_get_data(call_history)), LinphoneCallMissed, LinphoneCallStatus, "%i"); - + linphone_call_unref(out_call); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -1717,7 +1718,7 @@ static void on_ack_processing(LinphoneCall *call, LinphoneHeaders *ack, bool_t i static void call_created(LinphoneCore *lc, LinphoneCall *call){ LinphoneCallCbs *cbs = linphone_factory_create_call_cbs(linphone_factory_get()); linphone_call_cbs_set_ack_processing(cbs, on_ack_processing); - linphone_call_add_callbacks(call, cbs); + linphone_call_add_callbacks(call, cbs); linphone_call_cbs_unref(cbs); } @@ -1736,7 +1737,7 @@ static void call_with_custom_headers(void) { char* tmp=linphone_address_as_string_uri_only(marie->identity); char tmp2[256]; LinphoneCoreCbs *core_cbs = linphone_factory_create_core_cbs(linphone_factory_get()); - + snprintf(tmp2,sizeof(tmp2),"%s?uriHeader=myUriHeader",tmp); marie_identity=linphone_address_new(tmp2); ms_free(tmp); @@ -1746,7 +1747,7 @@ static void call_with_custom_headers(void) { params=linphone_core_create_call_params(marie->lc, NULL); linphone_call_params_add_custom_header(params,"Weather","bad"); linphone_call_params_add_custom_header(params,"Working","yes"); - + linphone_core_cbs_set_call_created(core_cbs, call_created); linphone_core_add_callbacks(marie->lc, core_cbs); linphone_core_add_callbacks(pauline->lc, core_cbs); @@ -1781,11 +1782,11 @@ static void call_with_custom_headers(void) { BC_ASSERT_PTR_NOT_NULL(marie_remote_contact_header); BC_ASSERT_STRING_EQUAL(pauline_remote_contact,pauline_remote_contact_header); BC_ASSERT_STRING_EQUAL(marie_remote_contact,marie_remote_contact_header); - - + + /*we need to wait for the ack to arrive*/ wait_for_until(marie->lc, pauline->lc, NULL, 0, 3000); - + BC_ASSERT_TRUE(linphone_call_get_user_data(call_marie) == (void*)1); BC_ASSERT_TRUE(linphone_call_get_user_data(call_pauline) == (void*)1); @@ -6228,18 +6229,18 @@ static void simple_call_with_gruu(void) { linphone_core_manager_init(pauline, "pauline_tcp_rc", NULL); linphone_core_add_supported_tag(pauline->lc,"gruu"); linphone_core_manager_start(pauline,TRUE); - + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneRegistrationOk, 1)); BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneRegistrationOk, 1)); pauline_cfg = linphone_core_get_default_proxy_config(pauline->lc); pauline_addr = linphone_proxy_config_get_contact(pauline_cfg); - + BC_ASSERT_PTR_NOT_NULL(pauline_addr); BC_ASSERT_TRUE(linphone_address_has_uri_param(pauline_addr,"gr")); BC_ASSERT_STRING_EQUAL(linphone_address_get_domain(pauline_addr),"sip.example.org"); - + marie_call = linphone_core_invite_address(marie->lc, pauline_addr); BC_ASSERT_PTR_NOT_NULL(marie_call); if(!marie_call) goto end; @@ -6247,7 +6248,7 @@ static void simple_call_with_gruu(void) { pauline_call = linphone_core_get_current_call(pauline->lc); BC_ASSERT_PTR_NOT_NULL(pauline_call); if(!pauline_call) goto end; - + marie_addr = linphone_proxy_config_get_contact(linphone_core_get_default_proxy_config(marie->lc)); BC_ASSERT_TRUE(linphone_address_has_uri_param(marie_addr,"gr")); BC_ASSERT_STRING_EQUAL(linphone_address_get_domain(marie_addr),"sip.example.org"); @@ -6260,12 +6261,12 @@ static void simple_call_with_gruu(void) { ms_free(result); } linphone_address_unref(contact_addr); - + linphone_call_accept(pauline_call); BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1)); BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 1)); - + contact_addr = linphone_address_new(linphone_call_get_remote_contact(marie_call)); if (!BC_ASSERT_TRUE(linphone_address_equal(contact_addr, pauline_addr))) { char* expected = linphone_address_as_string(pauline_addr); @@ -6275,10 +6276,10 @@ static void simple_call_with_gruu(void) { ms_free(result); } linphone_address_unref(contact_addr); - + liblinphone_tester_check_rtcp(marie,pauline); end_call(marie,pauline); - + //BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1)); //BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1)); diff --git a/tester/call_video_tester.c b/tester/call_video_tester.c index 1f3872d05..d12308e70 100644 --- a/tester/call_video_tester.c +++ b/tester/call_video_tester.c @@ -18,6 +18,7 @@ #include "linphone/core.h" #include "liblinphone_tester.h" +#include "tester_utils.h" #ifdef VIDEO_ENABLED static void call_paused_resumed_with_video_base_call_cb(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *message) { diff --git a/tester/clonable-object-tester.cpp b/tester/clonable-object-tester.cpp index 28264732d..c23cd55c1 100644 --- a/tester/clonable-object-tester.cpp +++ b/tester/clonable-object-tester.cpp @@ -20,6 +20,7 @@ #include "object/clonable-object.h" #include "liblinphone_tester.h" +#include "tester_utils.h" // ============================================================================= diff --git a/tester/complex_sip_case_tester.c b/tester/complex_sip_case_tester.c index eacf21aba..e347bd766 100644 --- a/tester/complex_sip_case_tester.c +++ b/tester/complex_sip_case_tester.c @@ -20,6 +20,7 @@ #include "linphone/core.h" #include "liblinphone_tester.h" #include "linphone/lpconfig.h" +#include "tester_utils.h" #if HAVE_SIPP @@ -99,16 +100,16 @@ LinphoneAddress * linphone_core_manager_resolve(LinphoneCoreManager *mgr, const int err; int port = linphone_address_get_port(source); LinphoneAddress * dest; - + sal_resolve_a(linphone_core_get_sal(mgr->lc) ,linphone_address_get_domain(source) ,linphone_address_get_port(source) ,AF_INET ,dest_server_server_resolved ,&addrinfo); - + dest=linphone_address_new(NULL); - + wait_for(mgr->lc, mgr->lc, (int*)&addrinfo, 1); err=bctbx_getnameinfo((struct sockaddr*)addrinfo->ai_addr,addrinfo->ai_addrlen,ipstring,INET6_ADDRSTRLEN,NULL,0,NI_NUMERICHOST); if (err !=0 ){ @@ -117,7 +118,7 @@ LinphoneAddress * linphone_core_manager_resolve(LinphoneCoreManager *mgr, const linphone_address_set_domain(dest, ipstring); if (port > 0) linphone_address_set_port(dest, port); - + return dest; } diff --git a/tester/conference-event-tester.cpp b/tester/conference-event-tester.cpp index 9152e1dac..db70d0896 100644 --- a/tester/conference-event-tester.cpp +++ b/tester/conference-event-tester.cpp @@ -28,6 +28,7 @@ #include "liblinphone_tester.h" #include "linphone/core.h" #include "private.h" +#include "tester_utils.h" #include "tools/private-access.h" #include "tools/tester.h" diff --git a/tester/content-manager-tester.cpp b/tester/content-manager-tester.cpp index db5fc375a..3ce12ac04 100644 --- a/tester/content-manager-tester.cpp +++ b/tester/content-manager-tester.cpp @@ -21,6 +21,7 @@ #include "content/content-manager.h" #include "content/content-type.h" #include "liblinphone_tester.h" +#include "tester_utils.h" using namespace LinphonePrivate; using namespace std; @@ -161,7 +162,7 @@ static const char* part4 = \ void multipart_to_list () { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); ContentManager manager(marie->lc); - + Content multipartContent = Content(); multipartContent.setBody(multipart); multipartContent.setContentType(ContentType("multipart", "related")); diff --git a/tester/cpim-tester.cpp b/tester/cpim-tester.cpp index 5619f5336..4653bc7f4 100644 --- a/tester/cpim-tester.cpp +++ b/tester/cpim-tester.cpp @@ -28,6 +28,7 @@ #include "private.h" #include "liblinphone_tester.h" +#include "tester_utils.h" // ============================================================================= diff --git a/tester/dtmf_tester.c b/tester/dtmf_tester.c index 58723d9b9..6fdb7bdc3 100644 --- a/tester/dtmf_tester.c +++ b/tester/dtmf_tester.c @@ -17,6 +17,7 @@ */ #include "liblinphone_tester.h" +#include "tester_utils.h" void dtmf_received(LinphoneCore *lc, LinphoneCall *call, int dtmf) { stats* counters = get_stats(lc); diff --git a/tester/eventapi_tester.c b/tester/eventapi_tester.c index 8d3e7d600..2119f3500 100644 --- a/tester/eventapi_tester.c +++ b/tester/eventapi_tester.c @@ -22,6 +22,7 @@ #include "linphone/lpconfig.h" #include #include "liblinphone_tester.h" +#include "tester_utils.h" static const char *subscribe_content="blabla"; static const char *notify_content="blabla"; @@ -342,7 +343,7 @@ static void subscribe_loosing_dialog(void) { BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingProgress,1,1000)); BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000)); - + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,1,5000)); BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionActive,1,5000)); @@ -357,7 +358,7 @@ static void subscribe_loosing_dialog(void) { linphone_core_manager_destroy(pauline); pauline = linphone_core_manager_new( "pauline_tcp_rc"); lcs = bctbx_list_append(lcs, pauline->lc); - + /* Marie will retry the subscription. * She will first receive a 503 Service unavailable from flexisip thanks the ICMP error returned by the no longer existing Pauline. * Then she will forge a new SUBSCRIBE in order to restart a new dialog, and this one will reach the new Pauline.*/ @@ -367,10 +368,10 @@ static void subscribe_loosing_dialog(void) { BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionActive,1,5000)); BC_ASSERT_PTR_NOT_NULL(pauline->lev); if (pauline->lev) BC_ASSERT_EQUAL(linphone_event_get_subscription_state(pauline->lev), LinphoneSubscriptionActive, int, "%d"); - + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,2,5000)); linphone_event_terminate(lev); - + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionTerminated,1,5000)); BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,5000)); @@ -405,7 +406,7 @@ static void subscribe_with_io_error(void) { BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingProgress,1,1000)); BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000)); - + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,1,5000)); BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionActive,1,5000)); @@ -414,18 +415,18 @@ static void subscribe_with_io_error(void) { /* now marie gets network errors when refreshing*/ sal_set_send_error(linphone_core_get_sal(marie->lc), -1); - + /*marie will retry the subscription*/ BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingProgress,2,8000)); sal_set_send_error(linphone_core_get_sal(marie->lc), 0); - + /*and get it accepted again*/ BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,2,10000)); BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionActive,2,5000)); BC_ASSERT_EQUAL(linphone_event_get_subscription_state(pauline->lev), LinphoneSubscriptionActive, int, "%d"); BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,2,5000)); linphone_event_terminate(lev); - + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionTerminated,1,5000)); BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,5000)); @@ -459,7 +460,7 @@ static void subscribe_not_timely_responded(void) { BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingProgress,1,1000)); BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000)); - + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,1,5000)); BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionActive,1,5000)); @@ -470,7 +471,7 @@ static void subscribe_not_timely_responded(void) { lcs = bctbx_list_remove(lcs, pauline->lc); /*marie's dialog will expire while the SUBSCRIBE refresh is in progress*/ wait_for_list(lcs, NULL, 0, 8000); - + lcs = bctbx_list_append(lcs, pauline->lc); wait_for_list(lcs, NULL, 0, 3000); linphone_event_terminate(lev); @@ -503,7 +504,7 @@ static void publish_test_with_args(bool_t refresh, int expires){ linphone_event_add_custom_header(lev,"CustomHeader","someValue"); linphone_event_ref(lev); linphone_event_send_publish(lev,content); - + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishProgress,1,1000)); BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishOk,1,3000)); @@ -557,7 +558,7 @@ static void out_of_dialog_notify(void){ linphone_event_ref(lev); linphone_event_add_custom_header(lev,"CustomHeader","someValue"); linphone_event_notify(lev,content); - + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_NotifyReceived,1,3000)); BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionTerminated,1,3000)); diff --git a/tester/flexisip_tester.c b/tester/flexisip_tester.c index 1eca49e28..8443d2ee6 100644 --- a/tester/flexisip_tester.c +++ b/tester/flexisip_tester.c @@ -20,6 +20,7 @@ #include "linphone/core.h" #include "linphone/lpconfig.h" #include "liblinphone_tester.h" +#include "tester_utils.h" static void setPublish(LinphoneProxyConfig * proxy_config, bool_t enable) { linphone_proxy_config_edit(proxy_config); @@ -1208,11 +1209,11 @@ static void redis_publish_subscribe(void) { linphone_call_accept(linphone_core_get_current_call(marie2->lc)); BC_ASSERT_TRUE(wait_for_until(marie2->lc, pauline->lc, &marie2->stat.number_of_LinphoneCallStreamsRunning, 1, 3000)); BC_ASSERT_TRUE(wait_for_until(marie2->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1, 3000)); - + liblinphone_tester_check_rtcp(marie2, pauline); linphone_call_terminate(linphone_core_get_current_call(marie2->lc)); - + BC_ASSERT_TRUE(wait_for_until(marie2->lc, pauline->lc, &marie2->stat.number_of_LinphoneCallEnd, 1, 3000)); BC_ASSERT_TRUE(wait_for_until(marie2->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1, 3000)); diff --git a/tester/liblinphone_tester.c b/tester/liblinphone_tester.c index 67c17d71f..aed90912b 100644 --- a/tester/liblinphone_tester.c +++ b/tester/liblinphone_tester.c @@ -19,6 +19,7 @@ #include "linphone/core.h" #include "liblinphone_tester.h" +#include "tester_utils.h" #if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) #pragma GCC diagnostic push @@ -193,7 +194,7 @@ int liblinphone_tester_set_log_file(const char *filename) { return -1; } ms_message("Redirecting traces to file [%s]", filename); - linphone_core_set_log_file(log_file); + linphone_core_set_log_file(log_file); return 0; } diff --git a/tester/liblinphone_tester.h b/tester/liblinphone_tester.h index 11a7a712c..4c9ed780c 100644 --- a/tester/liblinphone_tester.h +++ b/tester/liblinphone_tester.h @@ -25,7 +25,6 @@ #include #include "linphone/core.h" #include -#include "tester_utils.h" #ifdef HAVE_CONFIG_H #include "config.h" #endif diff --git a/tester/liblinphone_tester_ios.m b/tester/liblinphone_tester_ios.m index 6f3e54495..36dfd5237 100644 --- a/tester/liblinphone_tester_ios.m +++ b/tester/liblinphone_tester_ios.m @@ -25,6 +25,7 @@ #include #include #include "liblinphone_tester.h" +#include "tester_utils.h" int g_argc; char** g_argv; @@ -64,5 +65,4 @@ int main(int argc, char * argv[]) { return 0; } - #endif // target IPHONE diff --git a/tester/liblinphone_tester_windows.cpp b/tester/liblinphone_tester_windows.cpp index 03ae5912a..ebb814d2c 100644 --- a/tester/liblinphone_tester_windows.cpp +++ b/tester/liblinphone_tester_windows.cpp @@ -1,6 +1,7 @@ #include #include "liblinphone_tester_windows.h" +#include "tester_utils.h" using namespace BelledonneCommunications::Linphone::Tester; using namespace Platform; diff --git a/tester/log_collection_tester.c b/tester/log_collection_tester.c index 15c9f6256..6027e7d13 100644 --- a/tester/log_collection_tester.c +++ b/tester/log_collection_tester.c @@ -22,6 +22,7 @@ #include #include "linphone/core.h" #include "liblinphone_tester.h" +#include "tester_utils.h" #ifdef HAVE_ZLIB #include diff --git a/tester/main-db-tester.cpp b/tester/main-db-tester.cpp index 365e63095..681c94303 100644 --- a/tester/main-db-tester.cpp +++ b/tester/main-db-tester.cpp @@ -24,6 +24,7 @@ #include "private.h" #include "liblinphone_tester.h" +#include "tester_utils.h" // ============================================================================= diff --git a/tester/message_tester.c b/tester/message_tester.c index b97a28cb0..f9754608a 100644 --- a/tester/message_tester.c +++ b/tester/message_tester.c @@ -20,6 +20,7 @@ #include "linphone/core.h" #include "liblinphone_tester.h" +#include "tester_utils.h" #include "lime.h" #include "bctoolbox/crypto.h" #include @@ -2336,7 +2337,7 @@ void file_and_text_message(void) { BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text_content(msg), "Text message"); linphone_chat_room_send_chat_message(chat_room, msg); - + BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageReceived, 1, 60000)); if (marie->stat.last_received_chat_message) { diff --git a/tester/multipart-tester.cpp b/tester/multipart-tester.cpp index dea0166f1..9f1c628e5 100644 --- a/tester/multipart-tester.cpp +++ b/tester/multipart-tester.cpp @@ -28,6 +28,7 @@ #include "private.h" #include "liblinphone_tester.h" +#include "tester_utils.h" // ============================================================================= diff --git a/tester/offeranswer_tester.c b/tester/offeranswer_tester.c index 4d1c9f720..ab1a860ba 100644 --- a/tester/offeranswer_tester.c +++ b/tester/offeranswer_tester.c @@ -21,6 +21,7 @@ #include "linphone/core.h" #include "linphone/lpconfig.h" #include "liblinphone_tester.h" +#include "tester_utils.h" static int get_codec_position(const MSList *l, const char *mime_type, int rate){ const MSList *elem; @@ -446,7 +447,7 @@ static void compatible_avpf_features(void) { bool_t call_ok; if (configure_core_for_avpf_and_video(marie->lc) == NULL) goto end; - + pt = configure_core_for_avpf_and_video(pauline->lc); BC_ASSERT_TRUE((call_ok=call(marie, pauline))); @@ -470,7 +471,7 @@ static void incompatible_avpf_features(void) { bool_t call_ok; if (configure_core_for_avpf_and_video(marie->lc) == NULL) goto end; - + pt = configure_core_for_avpf_and_video(pauline->lc); pt->avpf.features = PAYLOAD_TYPE_AVPF_NONE; diff --git a/tester/player_tester.c b/tester/player_tester.c index 533ceec09..f4171f6fc 100644 --- a/tester/player_tester.c +++ b/tester/player_tester.c @@ -17,6 +17,7 @@ */ #include "liblinphone_tester.h" +#include "tester_utils.h" #include static bool_t wait_for_eof(bool_t *eof, int *time,int time_refresh, int timeout) { diff --git a/tester/presence_server_tester.c b/tester/presence_server_tester.c index 50e0955c7..7c4639687 100644 --- a/tester/presence_server_tester.c +++ b/tester/presence_server_tester.c @@ -19,6 +19,7 @@ #include "linphone/core.h" #include "liblinphone_tester.h" +#include "tester_utils.h" #include "linphone/core_utils.h" static void enable_publish(LinphoneCoreManager *mgr, bool_t enable) { @@ -49,7 +50,7 @@ static void simple(void) { LinphoneFriend* f = linphone_core_create_friend_with_address(marie->lc, get_identity(pauline)); LinphonePresenceActivity *activity = NULL; LinphoneCoreCbs *callbacks = linphone_factory_create_core_cbs(linphone_factory_get()); - + linphone_core_cbs_set_publish_state_changed(callbacks, linphone_publish_state_changed); _linphone_core_add_callbacks(pauline->lc, callbacks, TRUE); linphone_core_cbs_unref(callbacks); @@ -74,7 +75,7 @@ static void simple(void) { } BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphonePublishOk,2)); - + linphone_friend_invalidate_subscription(f); linphone_friend_enable_subscribes(f, FALSE); wait_for_until(marie->lc, NULL, NULL, 0, 5000); @@ -85,7 +86,7 @@ static void simple(void) { linphone_core_manager_stop(marie); linphone_core_manager_destroy(marie); - + linphone_core_manager_stop(pauline); BC_ASSERT_EQUAL(pauline->stat.number_of_LinphonePublishCleared,1,int,"%i"); BC_ASSERT_EQUAL(pauline->stat.number_of_LinphonePublishOk,2,int,"%i"); @@ -766,7 +767,7 @@ static void presence_list_subscribe_network_changes(void) { BC_ASSERT_FALSE(linphone_friend_is_presence_received(lf)); BC_ASSERT_TRUE(wait_for_until(laure->lc, pauline->lc, &laure->stat.number_of_LinphonePresenceActivityVacation, 2, 6000)); - + // Simulate network changes linphone_core_set_network_reachable(laure->lc,FALSE); ms_sleep(1); @@ -860,14 +861,14 @@ static void long_term_presence_phone_alias2(void) { static void long_term_presence_list(void) { if (linphone_core_vcard_supported()){ - + LinphoneFriend *f1, *f2; LinphoneFriendList* friends; const LinphonePresenceModel *presence; const char *e164_phone_number = "+33" "123456789"; const char *nationnal_phone_number = "0123456789"; LinphoneProxyConfig * pauline_proxy_config; - + LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); linphone_core_set_user_agent(pauline->lc, "bypass", NULL); enable_publish(pauline, FALSE); @@ -891,9 +892,9 @@ static void long_term_presence_list(void) { f1 = linphone_friend_list_find_friend_by_uri(linphone_core_get_default_friend_list(pauline->lc), "sip:liblinphone_tester@sip.example.org"); BC_ASSERT_EQUAL(linphone_presence_model_get_basic_status(linphone_friend_get_presence_model(f1)), LinphonePresenceBasicStatusOpen, int, "%d"); - + presence = linphone_friend_get_presence_model_for_uri_or_tel(f1, e164_phone_number); - + if (BC_ASSERT_PTR_NOT_NULL(presence)) { BC_ASSERT_STRING_EQUAL(linphone_presence_model_get_contact(presence), "sip:liblinphone_tester@sip.example.org"); } @@ -905,9 +906,9 @@ static void long_term_presence_list(void) { linphone_proxy_config_set_dial_prefix(pauline_proxy_config, "33"); linphone_proxy_config_done(pauline_proxy_config); presence = linphone_friend_get_presence_model_for_uri_or_tel(f1, nationnal_phone_number); - + BC_ASSERT_PTR_NOT_NULL(presence); - + f2 = linphone_friend_list_find_friend_by_uri(linphone_core_get_default_friend_list(pauline->lc), "sip:random_unknown@sip.example.org"); BC_ASSERT_EQUAL(linphone_presence_model_get_basic_status(linphone_friend_get_presence_model(f2)), LinphonePresenceBasicStatusClosed, int, "%d"); BC_ASSERT_FALSE(linphone_friend_is_presence_received(f2)); @@ -968,36 +969,36 @@ static void long_term_presence_with_phone_without_sip(void) { char *presence_contact; LinphoneCoreManager *marie = NULL; char * identity=NULL; - + while ((dialPlan = linphone_dial_plan_by_ccc_as_int(bctbx_random()%900)) == linphone_dial_plan_by_ccc(NULL)); /*now with have a dialplan*/ for (i = 0; i < MIN((size_t)linphone_dial_plan_get_national_number_length(dialPlan),sizeof(phone)-1); i++) { phone[i] = '0' + rand() % 10; } phone[i]='\0'; - + e164=ms_strdup_printf("+%s%s",linphone_dial_plan_get_country_calling_code(dialPlan),phone); - + ms_message("Phone number is %s, e164 is %s", phone, e164); - + marie = linphone_core_manager_new3("marie_rc", TRUE, e164); linphone_core_set_user_agent(marie->lc, "bypass", NULL); identity = linphone_address_as_string_uri_only(marie->identity); - + LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); linphone_core_set_user_agent(pauline->lc, "full-presence-support-bypass", NULL); - + friend2=linphone_core_create_friend(pauline->lc); linphone_friend_add_phone_number(friend2, phone); linphone_core_add_friend(pauline->lc,friend2); - + linphone_friend_list_set_rls_uri(linphone_core_get_default_friend_list(pauline->lc), "sip:rls@sip.example.org"); linphone_friend_list_enable_subscriptions(linphone_core_get_default_friend_list(pauline->lc), TRUE); linphone_core_refresh_registers(pauline->lc); - + /*because phone is not normalized*/ BC_ASSERT_FALSE(wait_for_until(pauline->lc,NULL,&pauline->stat.number_of_LinphonePresenceActivityAway,1,2000)); - + /*know adding ccc to proxy config*/ proxy_config = linphone_core_get_default_proxy_config(pauline->lc); linphone_proxy_config_edit(proxy_config); @@ -1005,11 +1006,11 @@ static void long_term_presence_with_phone_without_sip(void) { linphone_proxy_config_done(proxy_config); /*re-create sub list*/ linphone_friend_list_enable_subscriptions(linphone_core_get_default_friend_list(pauline->lc), FALSE); - + wait_for_until(pauline->lc, NULL, NULL, 0,2000); /*wait for unsubscribe*/ linphone_friend_list_enable_subscriptions(linphone_core_get_default_friend_list(pauline->lc), TRUE); - + BC_ASSERT_TRUE(wait_for(pauline->lc,NULL,&pauline->stat.number_of_LinphonePresenceActivityAway,1)); BC_ASSERT_EQUAL(pauline->stat.number_of_LinphonePresenceActivityAway, 1, int, "%d"); BC_ASSERT_EQUAL(linphone_presence_model_get_basic_status(linphone_friend_get_presence_model(friend2)), LinphonePresenceBasicStatusOpen, int, "%d"); @@ -1036,7 +1037,7 @@ static char * generate_random_e164_phone_from_dial_plan(const LinphoneDialPlan * phone[i] = '0' + rand() % 10; } phone[i]='\0'; - + return ms_strdup_printf("+%s%s",linphone_dial_plan_get_country_calling_code(dialPlan),phone); } /* use case: @@ -1051,14 +1052,14 @@ static void long_term_presence_with_crossed_references(void) { const LinphoneDialPlan *dialPlan; char *e164_marie, *e164_pauline, *e164_laure; LinphoneFriend* friend2; - - + + while ((dialPlan = linphone_dial_plan_by_ccc_as_int(bctbx_random()%900)) == linphone_dial_plan_by_ccc(NULL)); - + ms_message("Marie's phone number is %s", e164_marie=generate_random_e164_phone_from_dial_plan(dialPlan)); ms_message("Pauline's phone number is %s", e164_pauline=generate_random_e164_phone_from_dial_plan(dialPlan)); ms_message("Laure's phone number is %s", e164_laure=generate_random_e164_phone_from_dial_plan(dialPlan)); - + /*pauline has marie as friend*/ LinphoneCoreManager *pauline = linphone_core_manager_new3("pauline_tcp_rc",TRUE,e164_pauline); linphone_core_set_user_agent(pauline->lc, "full-presence-support-bypass", NULL); @@ -1069,7 +1070,7 @@ static void long_term_presence_with_crossed_references(void) { linphone_friend_list_set_rls_uri(linphone_core_get_default_friend_list(pauline->lc), "sip:rls@sip.example.org"); linphone_friend_list_enable_subscriptions(linphone_core_get_default_friend_list(pauline->lc), TRUE); linphone_core_refresh_registers(pauline->lc); - + //Laure has marie as friend LinphoneCoreManager *laure = linphone_core_manager_new3("laure_tcp_rc",TRUE,e164_laure); linphone_core_set_user_agent(laure->lc, "full-presence-support-bypass", NULL); @@ -1080,11 +1081,11 @@ static void long_term_presence_with_crossed_references(void) { linphone_friend_list_set_rls_uri(linphone_core_get_default_friend_list(laure->lc), "sip:rls@sip.example.org"); linphone_friend_list_enable_subscriptions(linphone_core_get_default_friend_list(laure->lc), TRUE); linphone_core_refresh_registers(laure->lc); - + /*because marie is not registered yet*/ BC_ASSERT_FALSE(wait_for_until(pauline->lc,laure->lc,&pauline->stat.number_of_LinphonePresenceActivityAway,1,2000)); BC_ASSERT_FALSE(wait_for_until(pauline->lc,laure->lc,&laure->stat.number_of_LinphonePresenceActivityAway,1,2000)); - + //Now, marie register to the service LinphoneCoreManager *marie = linphone_core_manager_new3("marie_rc", TRUE, e164_marie); linphone_core_set_user_agent(marie->lc, "bypass", NULL); @@ -1095,21 +1096,21 @@ static void long_term_presence_with_crossed_references(void) { linphone_friend_list_set_rls_uri(linphone_core_get_default_friend_list(marie->lc), "sip:rls@sip.example.org"); linphone_friend_list_enable_subscriptions(linphone_core_get_default_friend_list(marie->lc), TRUE); linphone_core_refresh_registers(marie->lc); - + //Pauline is already registered so I must be notified very rapidely BC_ASSERT_TRUE(wait_for_until(marie->lc,marie->lc,&marie->stat.number_of_LinphonePresenceActivityAway,1,4000)); - + //For Pauline and Laure long term presence check was already performed so they will not be notified until new subscription BC_ASSERT_FALSE(wait_for_until(pauline->lc,laure->lc,&laure->stat.number_of_LinphonePresenceActivityAway,1,4000)); BC_ASSERT_FALSE(wait_for_until(pauline->lc,laure->lc,&pauline->stat.number_of_LinphonePresenceActivityAway,1,4000)); - + //re-subscribe to get notification. linphone_friend_list_enable_subscriptions(linphone_core_get_default_friend_list(pauline->lc), FALSE); wait_for_until(pauline->lc, NULL, NULL, 0,2000); /*wait for unsubscribe*/ linphone_friend_list_enable_subscriptions(linphone_core_get_default_friend_list(pauline->lc), TRUE); - + BC_ASSERT_TRUE(wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_LinphonePresenceActivityAway,1,4000)); - + linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(laure); @@ -1251,7 +1252,7 @@ static void extended_notify_only_both_side_subscribed(void) { BC_ASSERT_FALSE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivityDinner,1)); BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_NotifyPresenceReceived,1)); - + linphone_friend_enable_subscribes(f2, TRUE); linphone_friend_set_inc_subscribe_policy(f2,LinphoneSPAccept); /* Accept incoming subscription request for this friend*/ linphone_core_add_friend(pauline->lc, f2); @@ -1323,7 +1324,7 @@ static void extended_notify_only_both_side_subscribed2(void) { BC_ASSERT_FALSE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivityDinner,1)); BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_NotifyPresenceReceived,1)); - + linphone_friend_enable_subscribes(f2, TRUE); linphone_friend_set_inc_subscribe_policy(f2,LinphoneSPAccept); /* Accept incoming subscription request for this friend*/ linphone_core_add_friend(pauline->lc, f2); @@ -1349,7 +1350,7 @@ static void extended_notify_only_both_side_subscribed2(void) { linphone_friend_list_enable_subscriptions(linphone_core_get_default_friend_list(marie->lc), FALSE); linphone_friend_list_enable_subscriptions(linphone_core_get_default_friend_list(pauline->lc), FALSE); wait_for_list(lcs,NULL, 0, 2000); // wait for unsubscritptions - + linphone_core_manager_stop(marie); BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishCleared,1,int,"%i"); BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,2,int,"%i"); @@ -1392,7 +1393,7 @@ static void extended_notify_sub_unsub_sub(void) { linphone_friend_enable_subscribes(f, TRUE); linphone_friend_set_inc_subscribe_policy(f,LinphoneSPAccept); /* Accept incoming subscription request for this friend*/ linphone_core_add_friend(marie->lc, f); - + linphone_friend_enable_subscribes(f2, TRUE); linphone_friend_set_inc_subscribe_policy(f2,LinphoneSPAccept); /* Accept incoming subscription request for this friend*/ linphone_core_add_friend(pauline->lc, f2); @@ -1433,7 +1434,7 @@ static void extended_notify_sub_unsub_sub(void) { linphone_friend_list_enable_subscriptions(linphone_core_get_default_friend_list(marie->lc), FALSE); linphone_friend_list_enable_subscriptions(linphone_core_get_default_friend_list(pauline->lc), FALSE); wait_for_list(lcs,NULL, 0, 2000); // wait for unsubscritptions - + linphone_core_manager_stop(marie); BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishCleared,1,int,"%i"); BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,1,int,"%i"); @@ -1482,11 +1483,11 @@ static void extended_notify_sub_unsub_sub2(void) { linphone_presence_model_unref(pauline_presence); linphone_presence_model_unref(pauline_presence2); linphone_presence_model_unref(marie_presence); - + linphone_friend_enable_subscribes(f2, TRUE); linphone_friend_set_inc_subscribe_policy(f2,LinphoneSPAccept); /* Accept incoming subscription request for this friend*/ linphone_core_add_friend(pauline->lc, f2); - + linphone_friend_enable_subscribes(f3, TRUE); linphone_friend_set_inc_subscribe_policy(f3,LinphoneSPAccept); /* Accept incoming subscription request for this friend*/ linphone_core_add_friend(pauline2->lc, f3); @@ -1546,7 +1547,7 @@ static void extended_notify_sub_unsub_sub2(void) { linphone_friend_list_enable_subscriptions(linphone_core_get_default_friend_list(pauline->lc), FALSE); linphone_friend_list_enable_subscriptions(linphone_core_get_default_friend_list(pauline2->lc), FALSE); wait_for_list(lcs,NULL, 0, 2000); // wait for unsubscritptions - + linphone_core_manager_stop(marie); BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishCleared,1,int,"%i"); BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,1,int,"%i"); diff --git a/tester/presence_tester.c b/tester/presence_tester.c index 176bba7d5..c14ce5b8e 100644 --- a/tester/presence_tester.c +++ b/tester/presence_tester.c @@ -19,6 +19,7 @@ #include "linphone/core.h" #include "liblinphone_tester.h" +#include "tester_utils.h" static LinphoneCoreManager* presence_linphone_core_manager_new_with_rc_name(char* username, char * rc_name) { LinphoneCoreManager* mgr= linphone_core_manager_new2( rc_name, FALSE); @@ -146,7 +147,7 @@ static void simple_publish_with_expire(int expires) { LinphoneProxyConfig* proxy; LinphonePresenceModel* presence; LinphoneCoreCbs *cbs = linphone_factory_create_core_cbs(linphone_factory_get()); - + linphone_core_cbs_set_publish_state_changed(cbs, linphone_publish_state_changed); _linphone_core_add_callbacks(marie->lc, cbs, TRUE); linphone_core_cbs_unref(cbs); @@ -215,26 +216,26 @@ static void publish_with_dual_identity(void) { LinphoneCoreManager* pauline = linphone_core_manager_new("multi_account_rc"); const bctbx_list_t* proxies; LinphoneCoreCbs *cbs = linphone_factory_create_core_cbs(linphone_factory_get()); - + linphone_core_cbs_set_publish_state_changed(cbs, linphone_publish_state_changed); _linphone_core_add_callbacks(pauline->lc, cbs, TRUE); linphone_core_cbs_unref(cbs); - + for (proxies = linphone_core_get_proxy_config_list(pauline->lc); proxies!=NULL; proxies = proxies->next) { LinphoneProxyConfig *proxy = (LinphoneProxyConfig *) proxies->data; linphone_proxy_config_edit(proxy); linphone_proxy_config_enable_publish(proxy,TRUE); linphone_proxy_config_done(proxy); } - + BC_ASSERT_TRUE(wait_for(pauline->lc,pauline->lc,&pauline->stat.number_of_LinphonePublishProgress,4)); BC_ASSERT_TRUE(wait_for(pauline->lc,pauline->lc,&pauline->stat.number_of_LinphonePublishOk,4)); - + linphone_core_manager_stop(pauline); BC_ASSERT_EQUAL(pauline->stat.number_of_LinphonePublishCleared,4,int,"%i"); BC_ASSERT_EQUAL(pauline->stat.number_of_LinphonePublishOk,4,int,"%i"); linphone_core_manager_destroy(pauline); - + } static bool_t subscribe_to_callee_presence(LinphoneCoreManager* caller_mgr,LinphoneCoreManager* callee_mgr) { stats initial_caller=caller_mgr->stat; @@ -309,30 +310,30 @@ static void publish_with_network_state_changes(void) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneProxyConfig* proxy; LinphoneCoreCbs *cbs = linphone_factory_create_core_cbs(linphone_factory_get()); - + linphone_core_cbs_set_publish_state_changed(cbs, linphone_publish_state_changed); _linphone_core_add_callbacks(marie->lc, cbs,TRUE); linphone_core_cbs_unref(cbs); - + proxy = linphone_core_get_default_proxy_config(marie->lc); linphone_proxy_config_edit(proxy); linphone_proxy_config_enable_publish(proxy,TRUE); linphone_proxy_config_done(proxy); - + BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphonePublishProgress,1)); BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphonePublishOk,1)); - + linphone_core_set_network_reachable(marie->lc, FALSE); BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneRegistrationNone,1)); BC_ASSERT_FALSE(wait_for_until(marie->lc,marie->lc,&marie->stat.number_of_LinphonePublishProgress,2,1000)); BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,1,int,"%i"); BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishError,0,int,"%i"); - + linphone_core_set_network_reachable(marie->lc, TRUE); BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphonePublishProgress,2)); BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphonePublishOk,2)); - - + + linphone_core_manager_stop(marie); BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishCleared,1,int,"%i"); /*yes it is 3 because when we change the expires, a new LinphoneEvent is created*/ BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,2,int,"%i"); diff --git a/tester/property-container-tester.cpp b/tester/property-container-tester.cpp index 2decc9164..17b4fcc2a 100644 --- a/tester/property-container-tester.cpp +++ b/tester/property-container-tester.cpp @@ -19,6 +19,7 @@ #include "object/property-container.h" #include "liblinphone_tester.h" +#include "tester_utils.h" // ============================================================================= diff --git a/tester/proxy_config_tester.c b/tester/proxy_config_tester.c index c11f352db..a2bf63066 100644 --- a/tester/proxy_config_tester.c +++ b/tester/proxy_config_tester.c @@ -17,6 +17,7 @@ */ #include "liblinphone_tester.h" +#include "tester_utils.h" #include @@ -131,15 +132,15 @@ static void phone_normalization_with_proxy(void) { linphone_proxy_config_set_dial_prefix(proxy, "52"); BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+5217227718184"), "+5217227718184"); /*this is a mobile phone number */ BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+528127718184"), "+528127718184"); /*this is a landline phone number from Monterrey*/ - + // Phone normalization for myanmar dial plans linphone_proxy_config_set_dial_prefix(proxy, "95"); BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "9965066691"), "+959965066691"); - + // Phone normalization for cameroon dial plans linphone_proxy_config_set_dial_prefix(proxy, "237"); BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "674788175"), "+237674788175"); - + linphone_proxy_config_unref(proxy); } @@ -220,16 +221,16 @@ static void load_dynamic_proxy_config(void) { ""; BC_ASSERT_FALSE(linphone_config_load_from_xml_string(linphone_core_get_config(lauriane->lc),config)); proxy = linphone_core_create_proxy_config(lauriane->lc); - + read = linphone_address_new(linphone_proxy_config_get_server_addr(proxy)); expected = linphone_address_new("sip:sip.linphone.org;transport=tls"); - + BC_ASSERT_TRUE(linphone_address_equal(read,expected)); linphone_address_unref(read); linphone_address_unref(expected); - + nat_policy = linphone_proxy_config_get_nat_policy(proxy); - + if (BC_ASSERT_PTR_NOT_NULL(nat_policy)) { BC_ASSERT_TRUE(linphone_nat_policy_ice_enabled(nat_policy)); BC_ASSERT_TRUE(linphone_nat_policy_stun_enabled(nat_policy)); @@ -237,9 +238,9 @@ static void load_dynamic_proxy_config(void) { } linphone_proxy_config_unref(proxy); linphone_core_manager_destroy(lauriane); - + //BC_ASSERT_STRING_EQUAL(linphone_proxy_config_get(proxy), "sip:sip.linphone.org;transport=tls"); - + } test_t proxy_config_tests[] = { diff --git a/tester/quality_reporting_tester.c b/tester/quality_reporting_tester.c index 590ab6694..1ebe8e1d0 100644 --- a/tester/quality_reporting_tester.c +++ b/tester/quality_reporting_tester.c @@ -19,6 +19,7 @@ #include #include "linphone/core.h" #include "liblinphone_tester.h" +#include "tester_utils.h" #include "quality_reporting.h" /*avoid crash if x is NULL on libc versions <4.5.26 */ @@ -133,7 +134,7 @@ static void quality_reporting_not_used_without_config(void) { LinphoneCall* call_marie = NULL; LinphoneCall* call_pauline = NULL; reporting_session_report_t **quality_reports = NULL; - + if (create_call_for_quality_reporting_tests(marie, pauline, &call_marie, &call_pauline, NULL, NULL)) { // marie has stats collection enabled but pauline has not @@ -329,7 +330,7 @@ static void quality_reporting_session_report_if_video_stopped(void) { BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishOk,2,5000)); } linphone_call_params_unref(marie_params); - + linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -420,7 +421,7 @@ static void quality_reporting_interval_report_video_and_rtt(void) { } linphone_chat_room_send_chat_message(pauline_chat_room, rtt_message); } - + end_call(marie, pauline); /*wait that all publish complete*/ BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishOk,marie->stat.number_of_LinphonePublishProgress,60000)); @@ -439,30 +440,30 @@ static void video_bandwidth_estimation(void){ LinphoneCoreManager *pauline = linphone_core_manager_new("pauline_rc"); LinphoneVideoPolicy pol = {0}; OrtpNetworkSimulatorParams simparams = { 0 }; - + linphone_core_set_video_device(marie->lc, "Mire: Mire (synthetic moving picture)"); linphone_core_enable_video_capture(marie->lc, TRUE); linphone_core_enable_video_display(marie->lc, TRUE); linphone_core_enable_video_capture(pauline->lc, TRUE); linphone_core_enable_video_display(pauline->lc, TRUE); - + pol.automatically_accept = TRUE; pol.automatically_initiate = TRUE; linphone_core_set_video_policy(marie->lc, &pol); linphone_core_set_video_policy(pauline->lc, &pol); - + linphone_core_set_preferred_video_size_by_name(marie->lc, "vga"); simparams.mode = OrtpNetworkSimulatorOutbound; simparams.enabled = TRUE; simparams.max_bandwidth = 300000; linphone_core_set_network_simulator_params(marie->lc, &simparams); - + if (BC_ASSERT_TRUE(call(marie, pauline))){ /*wait for the first TMMBR*/ BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &marie->stat.number_of_tmmbr_received, 1, 50000)); BC_ASSERT_GREATER((float)marie->stat.last_tmmbr_value_received, 270000.f, float, "%f"); BC_ASSERT_LOWER((float)marie->stat.last_tmmbr_value_received, 330000.f, float, "%f"); - + end_call(marie, pauline); } linphone_core_manager_destroy(marie); diff --git a/tester/register_tester.c b/tester/register_tester.c index eeeec13ec..a40817f89 100644 --- a/tester/register_tester.c +++ b/tester/register_tester.c @@ -19,6 +19,7 @@ #include "linphone/core.h" #include "liblinphone_tester.h" +#include "tester_utils.h" static void authentication_requested(LinphoneCore *lc, LinphoneAuthInfo *auth_info, LinphoneAuthMethod method) { @@ -1205,14 +1206,14 @@ static void multi_devices_register_with_gruu(void) { linphone_core_add_supported_tag(marie->lc,"gruu"); linphone_core_manager_start(marie,TRUE); LinphoneProxyConfig *cfg=linphone_core_get_default_proxy_config(marie->lc); - + if(cfg) { const LinphoneAddress *addr = linphone_proxy_config_get_contact(cfg); BC_ASSERT_PTR_NOT_NULL(addr); BC_ASSERT_STRING_EQUAL(linphone_address_get_domain(addr),linphone_proxy_config_get_domain(cfg)); BC_ASSERT_TRUE(linphone_address_has_uri_param(addr,"gr")); } - + linphone_core_set_network_reachable(marie->lc,FALSE); /*to make sure first instance is not unregistered*/ linphone_core_manager_destroy(marie); @@ -1224,7 +1225,7 @@ static void multi_devices_register_with_gruu(void) { BC_ASSERT_STRING_EQUAL(linphone_address_get_domain(addr),linphone_proxy_config_get_domain(cfg)); BC_ASSERT_TRUE(linphone_address_has_uri_param(addr,"gr")); } - + linphone_core_manager_destroy(marie); } diff --git a/tester/remote_provisioning_tester.c b/tester/remote_provisioning_tester.c index 25fc22d17..8aba68be2 100644 --- a/tester/remote_provisioning_tester.c +++ b/tester/remote_provisioning_tester.c @@ -19,6 +19,7 @@ #include "linphone/core.h" #include "liblinphone_tester.h" +#include "tester_utils.h" void linphone_configuration_status(LinphoneCore *lc, LinphoneConfiguringState status, const char *message) { stats* counters; diff --git a/tester/setup_tester.c b/tester/setup_tester.c index 3e37b6965..e34dcc4cb 100644 --- a/tester/setup_tester.c +++ b/tester/setup_tester.c @@ -19,7 +19,9 @@ #include "linphone/core.h" #include "liblinphone_tester.h" +#include "tester_utils.h" #include "linphone/lpconfig.h" +#include "tester_utils.h" static void linphone_version_test(void){ const char *version=linphone_core_get_version(); diff --git a/tester/stun_tester.c b/tester/stun_tester.c index 3c6768c86..d9e123a79 100644 --- a/tester/stun_tester.c +++ b/tester/stun_tester.c @@ -18,6 +18,7 @@ #include "linphone/core.h" #include "liblinphone_tester.h" +#include "tester_utils.h" #include "mediastreamer2/stun.h" #include "ortp/port.h" diff --git a/tester/tester.c b/tester/tester.c index 38394a740..22138b0ee 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -21,6 +21,7 @@ #include "linphone/core.h" #include "liblinphone_tester.h" #include +#include "tester_utils.h" #if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) #pragma GCC diagnostic push diff --git a/tester/tunnel_tester.c b/tester/tunnel_tester.c index 03df655db..ac66c4591 100644 --- a/tester/tunnel_tester.c +++ b/tester/tunnel_tester.c @@ -21,6 +21,7 @@ #include "linphone/core.h" #include "linphone/lpconfig.h" #include "liblinphone_tester.h" +#include "tester_utils.h" /* Retrieve the public IP from a given hostname */ int get_ip_from_hostname(const char * tunnel_hostname, char *ip, size_t ip_size){ @@ -59,7 +60,7 @@ static void call_with_tunnel_base(LinphoneTunnelMode tunnel_mode, bool_t with_si BC_ASSERT_FALSE(get_ip_from_hostname("tunnel.linphone.org",tunnel_ip,sizeof(tunnel_ip))); linphone_core_remove_supported_tag(pauline->lc,"gruu"); /*with gruu, we have no access to the "public IP from contact*/ linphone_core_remove_supported_tag(marie->lc,"gruu"); - + BC_ASSERT_TRUE(wait_for(pauline->lc,NULL,&pauline->stat.number_of_LinphoneRegistrationOk,1)); public_ip = get_public_contact_ip(pauline->lc); BC_ASSERT_STRING_NOT_EQUAL(public_ip, tunnel_ip); @@ -263,7 +264,7 @@ static void register_on_second_tunnel(void) { LinphoneTunnelConfig *config2 = linphone_tunnel_config_new(); char tunnel_ip[64]; char* public_ip; - + BC_ASSERT_FALSE(get_ip_from_hostname("tunnel.linphone.org",tunnel_ip,sizeof(tunnel_ip))); linphone_tunnel_simulate_udp_loss(tunnel, TRUE); diff --git a/tester/vcard_tester.c b/tester/vcard_tester.c index abad43f2d..ee131cdf4 100644 --- a/tester/vcard_tester.c +++ b/tester/vcard_tester.c @@ -18,10 +18,12 @@ #include "linphone/core.h" + #ifdef VCARD_ENABLED #include "liblinphone_tester.h" +#include "tester_utils.h" #include "carddav.h" #include @@ -37,7 +39,7 @@ static void linphone_vcard_import_export_friends_test(void) { char *export_filepath = bc_tester_file("export_vcards.vcf"); int count = 0; BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(friends), 0, unsigned int, "%u"); - + count = linphone_friend_list_import_friends_from_vcard4_file(lfl, import_filepath); BC_ASSERT_EQUAL(count, 3, int, "%d"); friends = linphone_friend_list_get_friends(lfl); @@ -344,7 +346,7 @@ static void friends_sqlite_storage(void) { laddress2 = linphone_friend_get_address(lf2); address2 = linphone_address_as_string(laddress2); BC_ASSERT_STRING_EQUAL(address2, address); - + ms_free(address); ms_free(address2); @@ -392,7 +394,7 @@ static void friends_sqlite_store_lot_of_friends(void) { BC_ASSERT_TRUE(ret ==SQLITE_OK); ret = sqlite3_exec(db,"BEGIN",0,0,&errmsg); BC_ASSERT_TRUE(ret ==SQLITE_OK); - + ret = sqlite3_exec(db, "CREATE TABLE IF NOT EXISTS friends (" "id INTEGER PRIMARY KEY AUTOINCREMENT," @@ -430,12 +432,12 @@ static void friends_sqlite_store_lot_of_friends(void) { BC_ASSERT_TRUE(ret ==SQLITE_OK); sqlite3_free(buf); } - + ret = sqlite3_exec(db,"END",0,0,&errmsg); BC_ASSERT_TRUE(ret ==SQLITE_OK); - + ms_message("End :\n"); - + ret = sqlite3_exec(db,"BEGIN",0,0,&errmsg); BC_ASSERT_TRUE(ret ==SQLITE_OK); ret = sqlite3_exec(db, "DELETE FROM friends;",0,0,&errmsg); @@ -460,7 +462,7 @@ static void friends_sqlite_find_friend_in_lot_of_friends(void) { BC_ASSERT_TRUE(ret ==SQLITE_OK); ret = sqlite3_exec(db,"BEGIN",0,0,&errmsg); BC_ASSERT_TRUE(ret ==SQLITE_OK); - + ret = sqlite3_exec(db, "CREATE TABLE IF NOT EXISTS friends (" "id INTEGER PRIMARY KEY AUTOINCREMENT," @@ -477,7 +479,7 @@ static void friends_sqlite_find_friend_in_lot_of_friends(void) { BC_ASSERT_TRUE(ret ==SQLITE_OK); ret = sqlite3_exec(db,"END",0,0,&errmsg); BC_ASSERT_TRUE(ret ==SQLITE_OK); - + ret = sqlite3_exec(db,"BEGIN",0,0,&errmsg); BC_ASSERT_TRUE(ret ==SQLITE_OK); for (i = 0; i < 20000; i++) { @@ -492,30 +494,30 @@ static void friends_sqlite_find_friend_in_lot_of_friends(void) { NULL, 0 ); - + ret = sqlite3_exec(db,buf,0,0,&errmsg); BC_ASSERT_TRUE(ret ==SQLITE_OK); sqlite3_free(buf); //ms_message("%i",i); } - + ret = sqlite3_exec(db,"END",0,0,&errmsg); BC_ASSERT_TRUE(ret ==SQLITE_OK); - + bctbx_get_cur_time(&t1); ms_message("Start : %li : %li\n", (long int)t1.tv_sec, (long int)t1.tv_nsec); for (i = 0; i < 20000; i++) { buf = sqlite3_mprintf("SELECT * FROM friends WHERE ref_key LIKE 'key_%i';", i); - + ret = sqlite3_exec(db,buf,0,0,&errmsg); BC_ASSERT_TRUE(ret ==SQLITE_OK); sqlite3_free(buf); } - + bctbx_get_cur_time(&t2); ms_message("End : %li : %li\n", (long int)t2.tv_sec, (long int)t2.tv_nsec); - + ret = sqlite3_exec(db,"BEGIN",0,0,&errmsg); BC_ASSERT_TRUE(ret ==SQLITE_OK); ret = sqlite3_exec(db, "DELETE FROM friends;",0,0,&errmsg); @@ -977,7 +979,7 @@ static void insert_lot_of_friends_map_test(void) { int i; bctbx_map_t *friends_map = bctbx_mmap_cchar_new(); bctbx_pair_cchar_t *pair; - + char key[64]; ms_message("Start\n"); for(i = 0; i < 20000; i++) { diff --git a/tester/video_tester.c b/tester/video_tester.c index 95cc03ef0..2f168b1ac 100644 --- a/tester/video_tester.c +++ b/tester/video_tester.c @@ -21,6 +21,7 @@ #include "linphone/core.h" #include "liblinphone_tester.h" +#include "tester_utils.h" #include "linphone/lpconfig.h" #if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)