diff --git a/CMakeLists.txt b/CMakeLists.txt index 69759f76b..f8f184fba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,7 +105,7 @@ if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) else() find_package(BelleSIP REQUIRED) find_package(Mediastreamer2 REQUIRED) - find_package(BcToolbox REQUIRED OPTIONAL_COMPONENTS tester) + find_package(BcToolbox 0.0.3 REQUIRED OPTIONAL_COMPONENTS tester) endif() find_package(XML2 REQUIRED) find_package(Zlib) diff --git a/mediastreamer2 b/mediastreamer2 index 2f5bff8c2..64c7fbaa4 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 2f5bff8c241a866e8afb05b1dc0c4f78956c2384 +Subproject commit 64c7fbaa469825f81baf1afe5c3e569483b987c2 diff --git a/tester/call_tester.c b/tester/call_tester.c index e4476b145..83ca92b88 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -564,8 +564,7 @@ static void call_outbound_with_multiple_proxy(void) { lpc = linphone_core_get_default_proxy_config(marie->lc); linphone_core_set_default_proxy(marie->lc,NULL); - BC_ASSERT_FATAL(lpc != NULL); - BC_ASSERT_FATAL(registered_lpc != NULL); + if (!BC_ASSERT_PTR_NOT_NULL(lpc) || !BC_ASSERT_PTR_NOT_NULL(registered_lpc)) return; // create new LPC that will successfully register linphone_proxy_config_set_identity(registered_lpc, linphone_proxy_config_get_identity(lpc)); @@ -671,19 +670,19 @@ static void multiple_answers_call_with_media_relay(void) { call1 = linphone_core_get_current_call(marie1->lc); call2 = linphone_core_get_current_call(marie2->lc); - BC_ASSERT_PTR_NOT_NULL_FATAL(call1); - BC_ASSERT_PTR_NOT_NULL_FATAL(call2); + if (BC_ASSERT_PTR_NOT_NULL(call1) && BC_ASSERT_PTR_NOT_NULL(call2)) { + BC_ASSERT_EQUAL( linphone_core_accept_call(marie1->lc, call1), 0, int, "%d"); + ms_sleep(1); /*sleep to make sure that the 200OK of marie1 reaches the server first*/ + BC_ASSERT_EQUAL( linphone_core_accept_call(marie2->lc, call2), 0, int, "%d"); - BC_ASSERT_EQUAL( linphone_core_accept_call(marie1->lc, call1), 0, int, "%d"); - ms_sleep(1); /*sleep to make sure that the 200OK of marie1 reaches the server first*/ - BC_ASSERT_EQUAL( linphone_core_accept_call(marie2->lc, call2), 0, int, "%d"); + BC_ASSERT_TRUE( wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1, 2000) ); + BC_ASSERT_TRUE( wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallStreamsRunning, 1, 2000) ); + /*the server will send a bye to marie2, as is 200Ok arrived second*/ + BC_ASSERT_TRUE( wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallEnd, 1, 4000) ); - BC_ASSERT_TRUE( wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1, 2000) ); - BC_ASSERT_TRUE( wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallStreamsRunning, 1, 2000) ); - /*the server will send a bye to marie2, as is 200Ok arrived second*/ - BC_ASSERT_TRUE( wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallEnd, 1, 4000) ); + end_call(marie1, pauline); + } - end_call(marie1, pauline); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(marie1); linphone_core_manager_destroy(marie2); @@ -933,8 +932,9 @@ void disable_all_audio_codecs_except_one(LinphoneCore *lc, const char *mime, int linphone_core_enable_payload_type(lc,pt,FALSE); } pt=linphone_core_find_payload_type(lc,mime,rate,-1); - BC_ASSERT_PTR_NOT_NULL_FATAL(pt); - linphone_core_enable_payload_type(lc,pt,TRUE); + if (BC_ASSERT_PTR_NOT_NULL(pt)) { + linphone_core_enable_payload_type(lc,pt,TRUE); + } } #ifdef VIDEO_ENABLED @@ -947,8 +947,9 @@ void disable_all_video_codecs_except_one(LinphoneCore *lc, const char *mime) { linphone_core_enable_payload_type(lc, (PayloadType *)it->data, FALSE); } pt = linphone_core_find_payload_type(lc, mime, -1, -1); - BC_ASSERT_PTR_NOT_NULL_FATAL(pt); - linphone_core_enable_payload_type(lc, pt, TRUE); + if (BC_ASSERT_PTR_NOT_NULL(pt)) { + linphone_core_enable_payload_type(lc, pt, TRUE); + } } #endif @@ -3246,26 +3247,26 @@ static void early_media_call_with_ice(void) { LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); LinphoneCall *marie_call; MSList *lcs = NULL; - + lcs = ms_list_append(lcs, marie->lc); lcs = ms_list_append(lcs, pauline->lc); /*in this test, pauline has ICE activated, marie not, but marie proposes early media. * We want to check that ICE processing is not disturbing early media*/ linphone_core_set_firewall_policy(pauline->lc, LinphonePolicyUseIce); - + linphone_core_invite_address(pauline->lc, marie->identity); - + BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallIncomingReceived,1,3000)); BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallIncomingEarlyMedia,1,3000)); BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,1000)); - + wait_for_until(pauline->lc,marie->lc,NULL,0,1000); - + marie_call = linphone_core_get_current_call(marie->lc); if (!marie_call) goto end; - + linphone_core_accept_call(marie->lc, marie_call); BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallConnected,1,3000)); BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallConnected,1,3000)); @@ -3798,18 +3799,18 @@ static void video_early_media_call(void) { LinphoneCoreManager *marie = linphone_core_manager_new("marie_early_rc"); LinphoneCoreManager *pauline = linphone_core_manager_new("pauline_rc"); LinphoneCall *pauline_to_marie; - + linphone_core_set_video_device(pauline->lc, "Mire: Mire (synthetic moving picture)"); - + video_call_base_3(pauline, marie, TRUE, LinphoneMediaEncryptionNone, TRUE, TRUE); - + BC_ASSERT_PTR_NOT_NULL(pauline_to_marie = linphone_core_get_current_call(pauline->lc)); if(pauline_to_marie) { BC_ASSERT_EQUAL(pauline_to_marie->videostream->source->desc->id, MS_MIRE_ID, int, "%d"); } - + end_call(pauline, marie); - + linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } @@ -4275,20 +4276,20 @@ static void call_with_custom_supported_tags(void) { linphone_core_add_supported_tag(marie->lc,"pouet-tag"); linphone_core_add_supported_tag(marie->lc,"truc-tag"); linphone_core_add_supported_tag(marie->lc,"machin-tag"); - + linphone_core_invite_address(marie->lc, pauline->identity); BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallIncomingReceived,1)); BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingRinging,1)); pauline_call = linphone_core_get_current_call(pauline->lc); if (!pauline_call) goto end; - + remote_params=linphone_call_get_remote_params(pauline_call); recv_supported=linphone_call_params_get_custom_header(remote_params,"supported"); BC_ASSERT_PTR_NOT_NULL(recv_supported); if (recv_supported){ BC_ASSERT_PTR_NOT_NULL(strstr(recv_supported,"pouet-tag, truc-tag, machin-tag")); } - + end_call(marie,pauline); end: linphone_core_manager_destroy(marie); @@ -5633,7 +5634,7 @@ static void _call_with_network_switch(bool_t use_ice, bool_t with_socket_refresh pauline_params = linphone_core_create_call_params(pauline->lc, NULL); linphone_call_params_enable_realtime_text(pauline_params, TRUE); } - + BC_ASSERT_TRUE((call_ok=call_with_params(pauline, marie, pauline_params, NULL))); if (!call_ok) goto end; diff --git a/tester/eventapi_tester.c b/tester/eventapi_tester.c index e3b6344ee..170d749df 100644 --- a/tester/eventapi_tester.c +++ b/tester/eventapi_tester.c @@ -38,7 +38,7 @@ const char *liblinphone_tester_get_notify_content(void){ void linphone_notify_received(LinphoneCore *lc, LinphoneEvent *lev, const char *eventname, const LinphoneContent *content){ LinphoneCoreManager *mgr; const char * ua = linphone_event_get_custom_header(lev, "User-Agent"); - BC_ASSERT_PTR_NOT_NULL_FATAL(content); + if (!BC_ASSERT_PTR_NOT_NULL(content)) return; if (!linphone_content_is_multipart(content) && (!ua || !strstr(ua, "flexisip"))) { /*disable check for full presence serveur support*/ /*hack to disable content checking for list notify */ BC_ASSERT_STRING_EQUAL(notify_content,(const char*)linphone_content_get_buffer(content)); @@ -206,7 +206,7 @@ static void subscribe_test_with_args(bool_t terminated_by_subscriber, RefreshTes if (terminated_by_subscriber){ linphone_event_terminate(lev); }else{ - BC_ASSERT_PTR_NOT_NULL_FATAL(pauline->lev); + BC_ASSERT_PTR_NOT_NULL(pauline->lev); linphone_event_terminate(pauline->lev); } @@ -268,7 +268,7 @@ static void subscribe_test_with_args2(bool_t terminated_by_subscriber, RefreshTe if (terminated_by_subscriber){ linphone_event_terminate(lev); }else{ - BC_ASSERT_PTR_NOT_NULL_FATAL(pauline->lev); + BC_ASSERT_PTR_NOT_NULL(pauline->lev); linphone_event_terminate(pauline->lev); } diff --git a/tester/message_tester.c b/tester/message_tester.c index 6d8ff9fa1..cde331c07 100644 --- a/tester/message_tester.c +++ b/tester/message_tester.c @@ -959,8 +959,8 @@ static void lime_unit(void) { memcpy(associatedKeys.peerURI, "pipo1@pipo.com", 15); associatedKeys.associatedZIDNumber = 0; retval = lime_getCachedSndKeysByURI(cacheBuffer, &associatedKeys); - BC_ASSERT_EQUAL_FATAL(retval, 0, int, "%d"); - BC_ASSERT_EQUAL_FATAL(associatedKeys.associatedZIDNumber, 2, int, "%d"); /* there are 2 keys associated to pipo1@pipo.com address in the cache above*/ + BC_ASSERT_EQUAL(retval, 0, int, "%d"); + BC_ASSERT_EQUAL(associatedKeys.associatedZIDNumber, 2, int, "%d"); /* there are 2 keys associated to pipo1@pipo.com address in the cache above*/ ms_message("Get cached key by URI, for sender, return %d keys", associatedKeys.associatedZIDNumber); for (i=0; ipeerZID, 12); memcpy(associatedKeys.peerKeys[0]->peerZID, senderZID, 12); retval = lime_decryptMessage(associatedKeys.peerKeys[0], encryptedMessage, strlen(PLAIN_TEXT_TEST_MESSAGE)+16, receiverZID, plainMessage); - BC_ASSERT_EQUAL_FATAL(retval, 0, int, "%d"); + BC_ASSERT_EQUAL(retval, 0, int, "%d"); BC_ASSERT_STRING_EQUAL((char *)plainMessage, (char *)PLAIN_TEXT_TEST_MESSAGE); ms_message("Decrypt and auth returned %d\nPlain text is %s\n", retval, plainMessage); @@ -995,14 +995,14 @@ static void lime_unit(void) { associatedKey.key[0]++; associatedKey.sessionId[0]++; retval = lime_setCachedKey(cacheBuffer, &associatedKey, LIME_RECEIVER); - BC_ASSERT_EQUAL_FATAL(retval, 0, int, "%d"); + BC_ASSERT_EQUAL(retval, 0, int, "%d"); /* update sender data */ associatedKeys.peerKeys[0]->sessionIndex++; associatedKeys.peerKeys[0]->key[0]++; associatedKeys.peerKeys[0]->sessionId[0]++; retval = lime_setCachedKey(cacheBuffer, associatedKeys.peerKeys[0], LIME_SENDER); - BC_ASSERT_EQUAL_FATAL(retval, 0, int, "%d"); + BC_ASSERT_EQUAL(retval, 0, int, "%d"); /* free memory */ lime_freeKeys(associatedKeys); @@ -1047,7 +1047,7 @@ static void lime_unit(void) { /* encrypt a msg */ retval = lime_createMultipartMessage(cacheBufferAlice, (uint8_t *)PLAIN_TEXT_TEST_MESSAGE, (uint8_t *)"sip:pauline@sip.example.org", &multipartMessage); - BC_ASSERT_EQUAL_FATAL(retval, 0, int, "%d"); + BC_ASSERT_EQUAL(retval, 0, int, "%d"); if (retval == 0) { ms_message("Encrypted msg created is %s", multipartMessage); } @@ -1055,7 +1055,7 @@ static void lime_unit(void) { /* decrypt the multipart msg */ retval = lime_decryptMultipartMessage(cacheBufferBob, multipartMessage, &decryptedMessage); - BC_ASSERT_EQUAL_FATAL(retval, 0, int, "%d"); + BC_ASSERT_EQUAL(retval, 0, int, "%d"); if (retval == 0) { BC_ASSERT_STRING_EQUAL((char *)decryptedMessage, (char *)PLAIN_TEXT_TEST_MESSAGE); ms_message("Succesfully decrypted msg is %s", decryptedMessage); @@ -1154,7 +1154,7 @@ static void database_migration(void) { char *tmp_db = bc_tester_file("tmp.db"); const MSList* chatrooms; - BC_ASSERT_EQUAL_FATAL(message_tester_copy_file(src_db, tmp_db), 0, int, "%d"); + BC_ASSERT_EQUAL(message_tester_copy_file(src_db, tmp_db), 0, int, "%d"); // enable to test the performances of the migration step //linphone_core_message_storage_set_debug(marie->lc, TRUE); @@ -1182,7 +1182,7 @@ static void history_range(void){ char *src_db = bc_tester_res("messages.db"); char *tmp_db = bc_tester_file("tmp.db"); - BC_ASSERT_EQUAL_FATAL(message_tester_copy_file(src_db, tmp_db), 0, int, "%d"); + BC_ASSERT_EQUAL(message_tester_copy_file(src_db, tmp_db), 0, int, "%d"); linphone_core_set_chat_database_path(marie->lc, tmp_db); @@ -1223,7 +1223,7 @@ static void history_count(void) { char *src_db = bc_tester_res("messages.db"); char *tmp_db = bc_tester_file("tmp.db"); - BC_ASSERT_EQUAL_FATAL(message_tester_copy_file(src_db, tmp_db), 0, int, "%d"); + BC_ASSERT_EQUAL(message_tester_copy_file(src_db, tmp_db), 0, int, "%d"); linphone_core_set_chat_database_path(marie->lc, tmp_db); diff --git a/tester/multi_call_tester.c b/tester/multi_call_tester.c index a749f905e..8dba9d0f7 100644 --- a/tester/multi_call_tester.c +++ b/tester/multi_call_tester.c @@ -269,7 +269,7 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag marie_call_laure=linphone_core_get_current_call(marie->lc); - BC_ASSERT_PTR_NOT_NULL_FATAL(marie_call_laure); + if (!BC_ASSERT_PTR_NOT_NULL(marie_call_laure)) goto end; linphone_core_add_to_conference(marie->lc,marie_call_laure); if(!is_remote_conf) { BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallUpdating,initial_marie_stat.number_of_LinphoneCallUpdating+1,5000)); @@ -344,7 +344,7 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,is_remote_conf?3:2,10000)); BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,is_remote_conf?2:1,10000)); if(is_remote_conf) BC_ASSERT_TRUE(wait_for_list(lcs,&focus->stat.number_of_LinphoneCallEnd,3,10000)); - + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallReleased,is_remote_conf?2:1,10000)); BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallReleased,is_remote_conf?3:2,10000)); BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallReleased,is_remote_conf?2:1,10000)); @@ -444,7 +444,7 @@ static void simple_call_transfer(void) { BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,2000)); marie_calling_laure=linphone_core_get_current_call(marie->lc); - BC_ASSERT_PTR_NOT_NULL_FATAL(marie_calling_laure); + if (!BC_ASSERT_PTR_NOT_NULL(marie_calling_laure)) goto end; BC_ASSERT_PTR_EQUAL(linphone_call_get_transferer_call(marie_calling_laure),marie_calling_pauline); BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneTransferCallConnected,1,2000)); @@ -456,6 +456,7 @@ static void simple_call_transfer(void) { end_call(marie, laure); BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallReleased,1,2000)); +end: linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(laure); @@ -656,7 +657,7 @@ static void eject_from_3_participants_conference(LinphoneCoreManager *marie, Lin marie_call_laure=linphone_core_get_current_call(marie->lc); - BC_ASSERT_PTR_NOT_NULL_FATAL(marie_call_laure); + if (!BC_ASSERT_PTR_NOT_NULL(marie_call_laure)) goto end; linphone_core_add_to_conference(marie->lc,marie_call_laure); @@ -718,7 +719,7 @@ static void eject_from_3_participants_conference(LinphoneCoreManager *marie, Lin BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,initial_laure_stat.number_of_LinphoneCallEnd+2,3000)); BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,initial_marie_stat.number_of_LinphoneCallEnd+3,3000)); } - +end: ms_list_free(lcs); } @@ -769,7 +770,7 @@ static void eject_from_4_participants_conference(void) { marie_call_laure=linphone_core_get_current_call(marie->lc); - BC_ASSERT_PTR_NOT_NULL_FATAL(marie_call_laure); + if (!BC_ASSERT_PTR_NOT_NULL(marie_call_laure)) goto end; linphone_core_add_to_conference(marie->lc,marie_call_laure); linphone_core_add_to_conference(marie->lc,marie_call_michelle); @@ -806,7 +807,7 @@ static void eject_from_4_participants_conference(void) { BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,10000)); BC_ASSERT_TRUE(wait_for_list(lcs,&laure->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,&pauline->stat.number_of_LinphoneCallReleased,1,10000)); BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallReleased,1,10000)); BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallReleased,1,10000)); @@ -814,6 +815,7 @@ static void eject_from_4_participants_conference(void) { ms_list_free(lcs); +end: linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(laure); diff --git a/tester/setup_tester.c b/tester/setup_tester.c index d1a5531f9..fa88e4999 100644 --- a/tester/setup_tester.c +++ b/tester/setup_tester.c @@ -35,8 +35,9 @@ static void core_init_test(void) { lc = linphone_core_new(&v_table,NULL,NULL,NULL); /* until we have good certificates on our test server... */ linphone_core_verify_server_certificates(lc,FALSE); - BC_ASSERT_PTR_NOT_NULL_FATAL(lc); - linphone_core_destroy(lc); + if (BC_ASSERT_PTR_NOT_NULL(lc)) { + linphone_core_destroy(lc); + } } static void linphone_address_test(void) { @@ -51,7 +52,7 @@ static void core_sip_transport_test(void) { LCSipTransports tr; memset (&v_table,0,sizeof(v_table)); lc = linphone_core_new(&v_table,NULL,NULL,NULL); - BC_ASSERT_PTR_NOT_NULL_FATAL(lc); + if (!BC_ASSERT_PTR_NOT_NULL(lc)) return; linphone_core_get_sip_transports(lc,&tr); BC_ASSERT_EQUAL(tr.udp_port,5060, int, "%d"); /*default config*/ BC_ASSERT_EQUAL(tr.tcp_port,5060, int, "%d"); /*default config*/ @@ -83,7 +84,7 @@ static void linphone_interpret_url_test(void) char *tmp; memset ( &v_table,0,sizeof ( v_table ) ); lc = linphone_core_new ( &v_table,NULL,NULL,NULL ); - BC_ASSERT_PTR_NOT_NULL_FATAL ( lc ); + if (!BC_ASSERT_PTR_NOT_NULL( lc )) return; proxy_config =linphone_core_create_proxy_config(lc); linphone_proxy_config_set_identity(proxy_config, "sip:moi@sip.linphone.org"); @@ -94,10 +95,10 @@ static void linphone_interpret_url_test(void) linphone_proxy_config_unref(proxy_config); address = linphone_core_interpret_url(lc, sips_address); - BC_ASSERT_PTR_NOT_NULL_FATAL(address); - BC_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_scheme(address), "sips"); - BC_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_username(address), "margaux"); - BC_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_domain(address), "sip.linphone.org"); + BC_ASSERT_PTR_NOT_NULL(address); + BC_ASSERT_STRING_EQUAL(linphone_address_get_scheme(address), "sips"); + BC_ASSERT_STRING_EQUAL(linphone_address_get_username(address), "margaux"); + BC_ASSERT_STRING_EQUAL(linphone_address_get_domain(address), "sip.linphone.org"); linphone_address_destroy(address); address = linphone_core_interpret_url(lc,"23"); @@ -272,7 +273,7 @@ static void chat_room_test(void) { LinphoneCore* lc; memset (&v_table,0,sizeof(v_table)); lc = linphone_core_new(&v_table,NULL,NULL,NULL); - BC_ASSERT_PTR_NOT_NULL_FATAL(lc); + if (!BC_ASSERT_PTR_NOT_NULL(lc)) return; BC_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room_from_uri(lc,"sip:toto@titi.com")); linphone_core_destroy(lc); } diff --git a/tester/tester.c b/tester/tester.c index b5b1f49bf..be29d5ace 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -83,7 +83,7 @@ void liblinphone_tester_enable_ipv6(bool_t enabled){ LinphoneAddress * create_linphone_address(const char * domain) { LinphoneAddress *addr = linphone_address_new(NULL); - BC_ASSERT_PTR_NOT_NULL_FATAL(addr); + if (!BC_ASSERT_PTR_NOT_NULL(addr)) return NULL; linphone_address_set_username(addr,test_username); BC_ASSERT_STRING_EQUAL(test_username,linphone_address_get_username(addr)); if (!domain) domain= test_route; diff --git a/tester/vcard_tester.c b/tester/vcard_tester.c index 5bb38fb22..04e3de744 100644 --- a/tester/vcard_tester.c +++ b/tester/vcard_tester.c @@ -116,7 +116,7 @@ static void linphone_vcard_import_a_lot_of_friends_test(void) { static void linphone_vcard_update_existing_friends_test(void) { LinphoneFriend *lf = linphone_friend_new_with_addr("sip:oldfriend@sip.linphone.org"); - BC_ASSERT_PTR_NOT_NULL_FATAL(lf); + BC_ASSERT_PTR_NOT_NULL(lf); BC_ASSERT_PTR_NULL(linphone_friend_get_vcard(lf)); linphone_friend_edit(lf); @@ -135,52 +135,52 @@ static void linphone_vcard_phone_numbers_and_sip_addresses(void) { MSList *sip_addresses = linphone_friend_get_addresses(lf); MSList *phone_numbers = linphone_friend_get_phone_numbers(lf); LinphoneAddress *addr = NULL; - + BC_ASSERT_EQUAL(ms_list_size(sip_addresses), 2, int, "%i"); BC_ASSERT_EQUAL(ms_list_size(phone_numbers), 1, int, "%i"); if (sip_addresses) ms_list_free_with_data(sip_addresses, (void (*)(void *))linphone_address_unref); if (phone_numbers) ms_list_free(phone_numbers); linphone_friend_unref(lf); - + lvc = linphone_vcard_new_from_vcard4_buffer("BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nTEL;TYPE=work:0952636505\r\nTEL:0476010203\r\nEND:VCARD\r\n"); lf = linphone_friend_new_from_vcard(lvc); sip_addresses = linphone_friend_get_addresses(lf); phone_numbers = linphone_friend_get_phone_numbers(lf); - + BC_ASSERT_EQUAL(ms_list_size(sip_addresses), 0, int, "%i"); BC_ASSERT_EQUAL(ms_list_size(phone_numbers), 2, int, "%i"); if (sip_addresses) ms_list_free_with_data(sip_addresses, (void (*)(void *))linphone_address_unref); if (phone_numbers) ms_list_free(phone_numbers); - + addr = linphone_address_new("sip:sylvain@sip.linphone.org"); linphone_friend_add_address(lf, addr); linphone_address_unref(addr); sip_addresses = linphone_friend_get_addresses(lf); BC_ASSERT_EQUAL(ms_list_size(sip_addresses), 1, int, "%i"); if (sip_addresses) ms_list_free_with_data(sip_addresses, (void (*)(void *))linphone_address_unref); - + linphone_friend_remove_phone_number(lf, "0952636505"); phone_numbers = linphone_friend_get_phone_numbers(lf); BC_ASSERT_EQUAL(ms_list_size(phone_numbers), 1, int, "%i"); if (phone_numbers) ms_list_free(phone_numbers); - + linphone_friend_remove_phone_number(lf, "0476010203"); phone_numbers = linphone_friend_get_phone_numbers(lf); BC_ASSERT_EQUAL(ms_list_size(phone_numbers), 0, int, "%i"); if (phone_numbers) ms_list_free(phone_numbers); - + addr = linphone_address_new("sip:sylvain@sip.linphone.org"); linphone_friend_remove_address(lf, addr); linphone_address_unref(addr); sip_addresses = linphone_friend_get_addresses(lf); BC_ASSERT_EQUAL(ms_list_size(sip_addresses), 0, int, "%i"); if (sip_addresses) ms_list_free_with_data(sip_addresses, (void (*)(void *))linphone_address_unref); - + linphone_friend_add_phone_number(lf, "+33952636505"); phone_numbers = linphone_friend_get_phone_numbers(lf); BC_ASSERT_EQUAL(ms_list_size(phone_numbers), 1, int, "%i"); if (phone_numbers) ms_list_free(phone_numbers); - + linphone_friend_unref(lf); lf = NULL; lvc = NULL; @@ -292,7 +292,7 @@ static void friends_sqlite_storage(void) { BC_ASSERT_EQUAL(stats->new_list_count, 1, int, "%i"); linphone_friend_list_unref(lfl); linphone_friend_list_set_display_name(lfl, "Test"); - BC_ASSERT_EQUAL_FATAL(linphone_friend_list_add_friend(lfl, lf), LinphoneFriendListOK, int, "%i"); + BC_ASSERT_EQUAL(linphone_friend_list_add_friend(lfl, lf), LinphoneFriendListOK, int, "%i"); linphone_friend_unref(lf); BC_ASSERT_EQUAL(lfl->storage_id, 1, int, "%d"); BC_ASSERT_EQUAL(lf->storage_id, 1, int, "%d"); @@ -367,20 +367,20 @@ static void carddav_sync_done(LinphoneCardDavContext *c, bool_t success, const c static void carddav_new_contact(LinphoneCardDavContext *c, LinphoneFriend *lf) { LinphoneCardDAVStats *stats = (LinphoneCardDAVStats *)linphone_carddav_get_user_data(c); - BC_ASSERT_PTR_NOT_NULL_FATAL(lf); + BC_ASSERT_PTR_NOT_NULL(lf); stats->new_contact_count++; } static void carddav_removed_contact(LinphoneCardDavContext *c, LinphoneFriend *lf) { LinphoneCardDAVStats *stats = (LinphoneCardDAVStats *)linphone_carddav_get_user_data(c); - BC_ASSERT_PTR_NOT_NULL_FATAL(lf); + BC_ASSERT_PTR_NOT_NULL(lf); stats->removed_contact_count++; } static void carddav_updated_contact(LinphoneCardDavContext *c, LinphoneFriend *new_lf, LinphoneFriend *old_lf) { LinphoneCardDAVStats *stats = (LinphoneCardDAVStats *)linphone_carddav_get_user_data(c); - BC_ASSERT_PTR_NOT_NULL_FATAL(new_lf); - BC_ASSERT_PTR_NOT_NULL_FATAL(old_lf); + BC_ASSERT_PTR_NOT_NULL(new_lf); + BC_ASSERT_PTR_NOT_NULL(old_lf); stats->updated_contact_count++; } @@ -394,7 +394,7 @@ static void carddav_sync(void) { linphone_core_add_friend_list(manager->lc, lfl); linphone_friend_list_unref(lfl); c = linphone_carddav_context_new(lfl); - BC_ASSERT_PTR_NOT_NULL_FATAL(c); + BC_ASSERT_PTR_NOT_NULL(c); linphone_carddav_set_user_data(c, stats); linphone_carddav_set_synchronization_done_callback(c, carddav_sync_done); @@ -425,11 +425,11 @@ static void carddav_sync_2(void) { linphone_core_add_friend_list(manager->lc, lfl); linphone_friend_list_unref(lfl); c = linphone_carddav_context_new(lfl); - BC_ASSERT_PTR_NOT_NULL_FATAL(c); + BC_ASSERT_PTR_NOT_NULL(c); unlink(friends_db); linphone_core_set_friends_database_path(manager->lc, friends_db); - BC_ASSERT_EQUAL_FATAL(linphone_friend_list_add_friend(lfl, lf), LinphoneFriendListOK, int, "%d"); + BC_ASSERT_EQUAL(linphone_friend_list_add_friend(lfl, lf), LinphoneFriendListOK, int, "%d"); linphone_friend_unref(lf); linphone_carddav_set_user_data(c, stats); @@ -467,11 +467,11 @@ static void carddav_sync_3(void) { linphone_core_add_friend_list(manager->lc, lfl); linphone_friend_list_unref(lfl); c = linphone_carddav_context_new(lfl); - BC_ASSERT_PTR_NOT_NULL_FATAL(c); + BC_ASSERT_PTR_NOT_NULL(c); unlink(friends_db); linphone_core_set_friends_database_path(manager->lc, friends_db); - BC_ASSERT_EQUAL_FATAL(linphone_friend_list_add_friend(lfl, lf), LinphoneFriendListOK, int, "%d"); + BC_ASSERT_EQUAL(linphone_friend_list_add_friend(lfl, lf), LinphoneFriendListOK, int, "%d"); linphone_friend_unref(lf); linphone_carddav_set_user_data(c, stats); @@ -506,7 +506,7 @@ static void carddav_sync_4(void) { linphone_core_add_friend_list(manager->lc, lfl); linphone_friend_list_unref(lfl); c = linphone_carddav_context_new(lfl); - BC_ASSERT_PTR_NOT_NULL_FATAL(c); + BC_ASSERT_PTR_NOT_NULL(c); linphone_carddav_set_user_data(c, stats); linphone_carddav_set_synchronization_done_callback(c, carddav_sync_done); @@ -577,7 +577,7 @@ static void carddav_integration(void) { BC_ASSERT_PTR_NULL(linphone_vcard_get_uid(lvc)); BC_ASSERT_EQUAL(ms_list_size(lfl->dirty_friends_to_update), 0, int, "%d"); - BC_ASSERT_EQUAL_FATAL(linphone_friend_list_add_friend(lfl, lf), LinphoneFriendListOK, int, "%d"); + BC_ASSERT_EQUAL(linphone_friend_list_add_friend(lfl, lf), LinphoneFriendListOK, int, "%d"); BC_ASSERT_EQUAL(ms_list_size(lfl->dirty_friends_to_update), 1, int, "%d"); wait_for_until(manager->lc, NULL, &stats->sync_done_count, 1, 2000); BC_ASSERT_EQUAL(stats->sync_done_count, 1, int, "%i"); @@ -592,14 +592,14 @@ static void carddav_integration(void) { lvc = linphone_vcard_new_from_vcard4_buffer("BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Ghislain Mary\r\nIMPP;TYPE=work:sip:ghislain@sip.linphone.org\r\nEND:VCARD\r\n"); lf = linphone_friend_new_from_vcard(lvc); - BC_ASSERT_EQUAL_FATAL(linphone_friend_list_add_local_friend(lfl, lf), LinphoneFriendListOK, int, "%d"); + BC_ASSERT_EQUAL(linphone_friend_list_add_local_friend(lfl, lf), LinphoneFriendListOK, int, "%d"); linphone_friend_unref(lf); lvc2 = linphone_vcard_new_from_vcard4_buffer("BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:sberfini@sip.linphone.org\r\nUID:1f08dd48-29ac-4097-8e48-8596d7776283\r\nEND:VCARD\r\n"); linphone_vcard_set_url(lvc2, "/sabredav/addressbookserver.php/addressbooks/sylvain/default/me.vcf"); lf2 = linphone_friend_new_from_vcard(lvc2); linphone_friend_set_ref_key(lf2, refkey); - BC_ASSERT_EQUAL_FATAL(linphone_friend_list_add_local_friend(lfl, lf2), LinphoneFriendListOK, int, "%d"); + BC_ASSERT_EQUAL(linphone_friend_list_add_local_friend(lfl, lf2), LinphoneFriendListOK, int, "%d"); BC_ASSERT_EQUAL(lfl->revision, 0, int, "%i"); linphone_friend_list_synchronize_friends_from_server(lfl); @@ -613,7 +613,7 @@ static void carddav_integration(void) { wait_for_until(manager->lc, NULL, &stats->sync_done_count, 3, 2000); BC_ASSERT_EQUAL(stats->sync_done_count, 3, int, "%i"); - BC_ASSERT_EQUAL_FATAL(ms_list_size(lfl->friends), 1, int, "%i"); + BC_ASSERT_EQUAL(ms_list_size(lfl->friends), 1, int, "%i"); lf = (LinphoneFriend *)lfl->friends->data; BC_ASSERT_STRING_EQUAL(lf->refkey, refkey); BC_ASSERT_EQUAL(lf->storage_id, lf2->storage_id, int, "%i");