From dca7132fe4c07bc7fd62ebecbcd0efa576875c70 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Thu, 2 Jun 2016 17:09:24 +0200 Subject: [PATCH] tester: fix crash on iOS, and do NOT check for stun when not in ICE test --- tester/log_collection_tester.c | 2 +- tester/multi_call_tester.c | 23 +++++++++++++++-------- tester/tester.c | 10 +++++++--- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/tester/log_collection_tester.c b/tester/log_collection_tester.c index a18c90e69..4f58223d3 100644 --- a/tester/log_collection_tester.c +++ b/tester/log_collection_tester.c @@ -215,7 +215,6 @@ static time_t check_file(LinphoneCoreManager* mgr) { timediff = labs((long int)log_time - (long int)cur_time); - (void)timediff; #ifndef _WIN32 BC_ASSERT_LOWER(timediff, 1, unsigned, "%u"); if( !(timediff <= 1) ){ @@ -230,6 +229,7 @@ static time_t check_file(LinphoneCoreManager* mgr) { ); } #else + (void)timediff; ms_warning("strptime() not available for this platform, test is incomplete."); #endif } diff --git a/tester/multi_call_tester.c b/tester/multi_call_tester.c index 968d72529..e1f2ebef3 100644 --- a/tester/multi_call_tester.c +++ b/tester/multi_call_tester.c @@ -216,7 +216,7 @@ static void incoming_call_accepted_when_outgoing_call_in_state(LinphoneCallState linphone_core_terminate_all_calls(marie->lc); - + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,10000)); BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,2,10000)); BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,1,10000)); @@ -580,12 +580,18 @@ static void call_transfer_existing_call_outgoing_call(void) { marie_call_pauline=linphone_core_get_current_call(marie->lc); pauline_called_by_marie=linphone_core_get_current_call(pauline->lc); /*marie pause pauline*/ - BC_ASSERT_TRUE(pause_call_1(marie,marie_call_pauline,pauline,pauline_called_by_marie)); + if (!BC_ASSERT_TRUE(pause_call_1(marie,marie_call_pauline,pauline,pauline_called_by_marie))) { + goto end; + } /*marie call laure*/ - BC_ASSERT_TRUE(call(marie,laure)); + if (!BC_ASSERT_TRUE(call(marie,laure))) { + end_call(marie, pauline); + goto end; + } marie_call_laure=linphone_core_get_current_call(marie->lc); laure_called_by_marie=linphone_core_get_current_call(laure->lc); + /*marie pause laure*/ BC_ASSERT_TRUE(pause_call_1(marie,marie_call_laure,laure,laure_called_by_marie)); @@ -629,6 +635,7 @@ static void call_transfer_existing_call_outgoing_call(void) { end_call(pauline, laure); } +end: linphone_core_manager_destroy(marie); linphone_core_manager_destroy(laure); linphone_core_manager_destroy(pauline); @@ -808,23 +815,23 @@ static void eject_from_4_participants_conference(void) { BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(pauline->lc)); BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(laure->lc)); BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(michelle->lc)); - + linphone_core_terminate_all_calls(laure->lc); linphone_core_terminate_all_calls(pauline->lc); linphone_core_terminate_all_calls(michelle->lc); - + BC_ASSERT_TRUE(wait_for_list(lcs, &laure->stat.number_of_LinphoneCallEnd, 1, 10000)); BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallEnd, 1, 10000)); BC_ASSERT_TRUE(wait_for_list(lcs, &michelle->stat.number_of_LinphoneCallEnd, 1, 10000)); BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallEnd, 3, 10000)); - + BC_ASSERT_PTR_NULL(linphone_core_get_conference(marie->lc)); - + BC_ASSERT_TRUE(wait_for_list(lcs, &laure->stat.number_of_LinphoneCallReleased, 1, 10000)); BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallReleased, 1, 10000)); BC_ASSERT_TRUE(wait_for_list(lcs, &michelle->stat.number_of_LinphoneCallReleased, 1, 10000)); BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallEnd, 3, 10000)); - + end: linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); diff --git a/tester/tester.c b/tester/tester.c index 9accb8719..5e4414dd1 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -149,9 +149,9 @@ LinphoneCore* configure_lc_from(LinphoneCoreVTable* v_table, const char* path, c linphone_core_set_ringback(lc, ringbackpath); linphone_core_set_root_ca(lc,rootcapath); } - + linphone_core_enable_ipv6(lc, liblinphonetester_ipv6); - + sal_enable_test_features(lc->sal,TRUE); sal_set_dns_user_hosts_file(lc->sal, dnsuserhostspath); linphone_core_set_static_picture(lc,nowebcampath); @@ -375,7 +375,11 @@ void linphone_core_manager_start(LinphoneCoreManager *mgr, int check_for_proxies 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)); + const char **tags = bc_tester_current_test_tags(); + int ice_test = (tags && ((tags[0] && !strcmp(tags[0], "ICE")) || (tags[1] && !strcmp(tags[1], "ICE")))); + if (ice_test) { + BC_ASSERT_TRUE(wait_for_stun_resolution(mgr)); + } } if (!check_for_proxies){ /*now that stun server resolution is done, we can start registering*/