tester: check that no linphone core exists before each test fixing crash on iOS

parent 060dfb0f
......@@ -4377,7 +4377,7 @@ test_t call_tests[] = {
test_suite_t call_test_suite = {
"Single Call",
NULL,
liblinphone_tester_setup,
NULL,
sizeof(call_tests) / sizeof(call_tests[0]),
call_tests
......
......@@ -173,7 +173,7 @@ test_t dtmf_tests[] = {
test_suite_t dtmf_test_suite = {
"DTMF",
NULL,
liblinphone_tester_setup,
NULL,
sizeof(dtmf_tests) / sizeof(dtmf_tests[0]),
dtmf_tests
......
......@@ -242,10 +242,11 @@ static void subscribe_test_with_args2(bool_t terminated_by_subscriber, RefreshTe
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000));
/*check good receipt of custom headers*/
BC_ASSERT_STRING_EQUAL(linphone_event_get_custom_header(pauline->lev,"My-Header"),"pouet");
BC_ASSERT_STRING_EQUAL(linphone_event_get_custom_header(pauline->lev,"My-Header2"),"pimpon");
if (pauline->stat.number_of_LinphoneSubscriptionIncomingReceived == 1) {
/*check good receipt of custom headers*/
BC_ASSERT_STRING_EQUAL(linphone_event_get_custom_header(pauline->lev,"My-Header"),"pouet");
BC_ASSERT_STRING_EQUAL(linphone_event_get_custom_header(pauline->lev,"My-Header2"),"pimpon");
}
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));
......@@ -368,7 +369,7 @@ test_t event_tests[] = {
test_suite_t event_test_suite = {
"Event",
NULL,
liblinphone_tester_setup,
NULL,
sizeof(event_tests) / sizeof(event_tests[0]),
event_tests
......
......@@ -936,7 +936,7 @@ test_t flexisip_tests[] = {
test_suite_t flexisip_test_suite = {
"Flexisip",
NULL,
liblinphone_tester_setup,
NULL,
sizeof(flexisip_tests) / sizeof(flexisip_tests[0]),
flexisip_tests
......
......@@ -52,6 +52,7 @@ extern test_suite_t video_test_suite;
extern test_suite_t multicast_call_test_suite;
extern test_suite_t multi_call_test_suite;
extern test_suite_t proxy_config_test_suite;
extern int manager_count;
extern int liblinphone_tester_ipv6_available(void);
......@@ -329,5 +330,7 @@ static const int audio_cmp_max_shift=20;
int linphone_core_manager_get_max_audio_down_bw(const LinphoneCoreManager *mgr);
int linphone_core_manager_get_max_audio_up_bw(const LinphoneCoreManager *mgr);
void video_call_base_2(LinphoneCoreManager* pauline,LinphoneCoreManager* marie, bool_t using_policy,LinphoneMediaEncryption mode, bool_t callee_video_enabled, bool_t caller_video_enabled);
#endif /* LIBLINPHONE_TESTER_H_ */
int liblinphone_tester_setup();
#endif /* LIBLINPHONE_TESTER_H_ */
......@@ -326,7 +326,7 @@ test_t log_collection_tests[] = {
test_suite_t log_collection_test_suite = {
"LogCollection",
NULL,
liblinphone_tester_setup,
NULL,
sizeof(log_collection_tests) / sizeof(log_collection_tests[0]),
log_collection_tests
......
......@@ -1717,7 +1717,7 @@ test_t message_tests[] = {
test_suite_t message_test_suite = {
"Message",
NULL,
liblinphone_tester_setup,
NULL,
sizeof(message_tests) / sizeof(message_tests[0]),
message_tests
......
......@@ -283,9 +283,9 @@ static void simple_encrypted_conference_with_ice(LinphoneMediaEncryption mode) {
...
linphone_core_iterate() at linphonecore.c:2 620
...
linphone_core_set_stun_server() initiates an asynchronous resolution, but it needs a few iteration before it is completed.
By calling private function linphone_core_get_stun_server_addrinfo() we make sure to wait that the resolution is done before the
By calling private function linphone_core_get_stun_server_addrinfo() we make sure to wait that the resolution is done before the
test calls actually start.
*/
linphone_core_get_stun_server_addrinfo(marie->lc);
......@@ -555,7 +555,7 @@ test_t multi_call_tests[] = {
test_suite_t multi_call_test_suite = {
"Multi call",
NULL,
liblinphone_tester_setup,
NULL,
sizeof(multi_call_tests) / sizeof(multi_call_tests[0]),
multi_call_tests
......
......@@ -271,7 +271,7 @@ test_t multicast_call_tests[] = {
test_suite_t multicast_call_test_suite = {
"Multicast Call",
NULL,
liblinphone_tester_setup,
NULL,
sizeof(multicast_call_tests) / sizeof(multicast_call_tests[0]),
multicast_call_tests
......
......@@ -418,7 +418,7 @@ static test_t offeranswer_tests[] = {
test_suite_t offeranswer_test_suite = {
"Offer-answer",
NULL,
liblinphone_tester_setup,
NULL,
sizeof(offeranswer_tests) / sizeof(offeranswer_tests[0]),
offeranswer_tests
......
......@@ -84,7 +84,7 @@ test_t player_tests[] = {
test_suite_t player_test_suite = {
"Player",
NULL,
liblinphone_tester_setup,
NULL,
sizeof(player_tests) / sizeof(test_t),
player_tests
......
......@@ -484,7 +484,7 @@ test_t presence_tests[] = {
test_suite_t presence_test_suite = {
"Presence",
NULL,
liblinphone_tester_setup,
NULL,
sizeof(presence_tests) / sizeof(presence_tests[0]),
presence_tests
......
......@@ -68,7 +68,7 @@ test_t proxy_config_tests[] = {
test_suite_t proxy_config_test_suite = {
"Proxy config",
NULL,
liblinphone_tester_setup,
NULL,
sizeof(proxy_config_tests) / sizeof(proxy_config_tests[0]),
proxy_config_tests
......
......@@ -396,7 +396,7 @@ test_t quality_reporting_tests[] = {
test_suite_t quality_reporting_test_suite = {
"QualityReporting",
NULL,
liblinphone_tester_setup,
NULL,
sizeof(quality_reporting_tests) / sizeof(quality_reporting_tests[0]),
quality_reporting_tests
......
......@@ -314,6 +314,7 @@ static void simple_authenticated_register(){
counters = &lcm->stat;
register_with_refresh(lcm,FALSE,auth_domain,route);
BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,0, int, "%d");
linphone_core_manager_destroy(lcm);
}
static void ha1_authenticated_register(){
......@@ -329,6 +330,7 @@ static void ha1_authenticated_register(){
counters = &lcm->stat;
register_with_refresh(lcm,FALSE,auth_domain,route);
BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,0, int, "%d");
linphone_core_manager_destroy(lcm);
}
static void authenticated_register_with_no_initial_credentials(){
......@@ -892,7 +894,7 @@ test_t register_tests[] = {
test_suite_t register_test_suite = {
"Register",
NULL,
liblinphone_tester_setup,
NULL,
sizeof(register_tests) / sizeof(register_tests[0]),
register_tests
......
......@@ -268,7 +268,7 @@ static void devices_reload_test(void) {
static void codec_usability_test(void) {
LinphoneCoreManager *mgr = linphone_core_manager_new2("empty_rc", FALSE);
PayloadType *pt = linphone_core_find_payload_type(mgr->lc, "PCMU", 8000, -1);
BC_ASSERT_TRUE(pt!=NULL);
if (!pt) goto end;
/*no limit*/
......@@ -279,12 +279,12 @@ static void codec_usability_test(void) {
linphone_core_set_upload_bandwidth(mgr->lc, 50);
linphone_core_set_download_bandwidth(mgr->lc, 50);
BC_ASSERT_FALSE(linphone_core_check_payload_type_usability(mgr->lc, pt));
/*reasonable limit*/
linphone_core_set_upload_bandwidth(mgr->lc, 200);
linphone_core_set_download_bandwidth(mgr->lc, 200);
BC_ASSERT_TRUE(linphone_core_check_payload_type_usability(mgr->lc, pt));
end:
linphone_core_manager_destroy(mgr);
}
......@@ -308,7 +308,7 @@ test_t setup_tests[] = {
test_suite_t setup_test_suite = {
"Setup",
NULL,
liblinphone_tester_setup,
NULL,
sizeof(setup_tests) / sizeof(setup_tests[0]),
setup_tests
......
......@@ -112,7 +112,7 @@ test_t stun_tests[] = {
test_suite_t stun_test_suite = {
"Stun",
NULL,
liblinphone_tester_setup,
NULL,
sizeof(stun_tests) / sizeof(stun_tests[0]),
stun_tests
......
......@@ -32,7 +32,7 @@
static bool_t liblinphone_tester_ipv6_enabled=FALSE;
static int liblinphone_tester_keep_accounts_flag = 0;
static int liblinphone_tester_keep_record_files = FALSE;
static int manager_count = 0;
int manager_count = 0;
const char* test_domain="sipopen.example.org";
const char* auth_domain="sip.example.org";
......@@ -233,6 +233,7 @@ bool_t transport_supported(LinphoneTransportType transport) {
return supported;
}
LinphoneCoreManager* linphone_core_manager_init(const char* rc_file) {
LinphoneCoreManager* mgr= ms_new0(LinphoneCoreManager,1);
char *rc_path = NULL;
......@@ -441,3 +442,11 @@ int linphone_core_manager_get_max_audio_up_bw(const LinphoneCoreManager *mgr) {
return linphone_core_manager_get_max_audio_bw_base(mgr->stat.audio_upload_bandwidth
, sizeof(mgr->stat.audio_upload_bandwidth)/sizeof(int));
}
int liblinphone_tester_setup() {
if (manager_count != 0) {
ms_error("%d linphone core manager still alive!", manager_count);
return 1;
}
return 0;
}
......@@ -270,7 +270,7 @@ test_t tunnel_tests[] = {
test_suite_t tunnel_test_suite = {
"Tunnel",
NULL,
liblinphone_tester_setup,
NULL,
sizeof(tunnel_tests) / sizeof(tunnel_tests[0]),
tunnel_tests
......
......@@ -58,7 +58,7 @@ test_t upnp_tests[] = {
test_suite_t upnp_test_suite = {
"Upnp",
NULL,
liblinphone_tester_setup,
NULL,
sizeof(upnp_tests) / sizeof(upnp_tests[0]),
upnp_tests
......
......@@ -538,7 +538,7 @@ test_t video_tests[] = {
test_suite_t video_test_suite = {
"Video",
NULL,
liblinphone_tester_setup,
NULL,
sizeof(video_tests) / sizeof(video_tests[0]),
video_tests
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment