From 2eea8271213ad5eaa46d7c8c89eb3a6a1138f342 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 29 Feb 2016 15:08:22 +0100 Subject: [PATCH] tester: add non-regression check for memory leaks --- mediastreamer2 | 2 +- tester/call_tester.c | 8 ++- tester/common/bc_tester_utils.c | 28 ++++++++++- tester/common/bc_tester_utils.h | 3 +- tester/complex_sip_call_tester.c | 8 +-- tester/eventapi_tester.c | 18 +++---- tester/flexisip_tester.c | 86 ++++++++++++++++---------------- tester/liblinphone_tester.h | 2 +- tester/log_collection_tester.c | 2 +- tester/message_tester.c | 22 ++++---- tester/multi_call_tester.c | 66 ++++++++++++------------ tester/presence_tester.c | 34 ++++++------- tester/setup_tester.c | 16 ++---- tester/tester.c | 45 +++++++++++------ tester/video_tester.c | 2 +- 15 files changed, 190 insertions(+), 152 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index fad8cfc6c..f21cca039 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit fad8cfc6cba8ffde7027811565510c33a0602c3b +Subproject commit f21cca039d1b00ca4d25c083c5bb38d798eb146f diff --git a/tester/call_tester.c b/tester/call_tester.c index 2843cbd15..5c4d6fa96 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -5821,7 +5821,11 @@ static void call_logs_sqlite_storage(void) { call_id = linphone_call_log_get_call_id(call_log); BC_ASSERT_PTR_NOT_NULL(call_id); - BC_ASSERT_PTR_NOT_NULL(linphone_core_find_call_log_from_call_id(marie->lc, call_id)); + { + LinphoneCallLog* find_call_log = linphone_core_find_call_log_from_call_id(marie->lc, call_id); + BC_ASSERT_PTR_NOT_NULL(find_call_log); + if (find_call_log) linphone_call_log_unref(find_call_log); + } BC_ASSERT_TRUE(linphone_address_equal( linphone_call_log_get_remote_address(call_log), @@ -6027,7 +6031,7 @@ test_t call_tests[] = { TEST_NO_TAG("Cancelled ringing call", cancelled_ringing_call), TEST_NO_TAG("Call busy when calling self", call_busy_when_calling_self), TEST_NO_TAG("Simple call", simple_call), - TEST_NO_TAG("Call terminated automatically by linphone_core_destroy", automatic_call_termination), + TEST_ONE_TAG("Call terminated automatically by linphone_core_destroy", automatic_call_termination, "LeaksMemory"), TEST_NO_TAG("Call with http proxy", call_with_http_proxy), TEST_NO_TAG("Call with timeouted bye", call_with_timeouted_bye), TEST_NO_TAG("Direct call over IPv6", direct_call_over_ipv6), diff --git a/tester/common/bc_tester_utils.c b/tester/common/bc_tester_utils.c index 5522caaca..500851942 100644 --- a/tester/common/bc_tester_utils.c +++ b/tester/common/bc_tester_utils.c @@ -149,6 +149,19 @@ int bc_tester_suite_index(const char *suite_name) { return -1; } + +int bc_tester_test_index(test_suite_t *suite, const char *test_name) { + int i; + + for (i = 0; i < suite->nb_tests; i++) { + if (strcmp(test_name, suite->tests[i].name) == 0) { + return i; + } + } + + return -1; +} + int bc_tester_nb_suites(void) { return nb_test_suites; } @@ -247,7 +260,11 @@ static void test_complete_message_handler(const CU_pTest pTest, const CU_pSuite free(result); if (test_suite[suite_index]->after_each) { - test_suite[suite_index]->after_each(); + int err = test_suite[suite_index]->after_each(); + //if test passed but not after_each, count it as failure + if (err && !pFailure) { + CU_get_run_summary()->nTestsFailed++; + } } //insert empty line bc_tester_printf(bc_printf_verbosity_info,""); @@ -703,3 +720,12 @@ const char * bc_tester_current_suite_name(void) { const char * bc_tester_current_test_name(void) { return bc_current_test_name; } + +const char ** bc_tester_current_test_tags(void) { + if (bc_current_suite_name && bc_current_test_name) { + int suite_index = bc_tester_suite_index(bc_current_suite_name); + int test_index = bc_tester_test_index(test_suite[suite_index], bc_current_test_name); + return test_suite[suite_index]->tests[test_index].tags; + } + return NULL; +} diff --git a/tester/common/bc_tester_utils.h b/tester/common/bc_tester_utils.h index f70c30ac7..90fa53664 100644 --- a/tester/common/bc_tester_utils.h +++ b/tester/common/bc_tester_utils.h @@ -63,7 +63,7 @@ typedef struct { before_all; /*function invoked before running the suite. If not returning 0, suite is not launched. */ pre_post_function_t after_all; /*function invoked at the end of the suite, even if some tests failed. */ test_function_t before_each; /*function invoked before each test within this suite. */ - test_function_t after_each; /*function invoked after each test within this suite, even if it failed. */ + pre_post_function_t after_each; /*function invoked after each test within this suite, even if it failed. */ int nb_tests; /* number of tests */ test_t *tests; /* tests within this suite */ } test_suite_t; @@ -103,6 +103,7 @@ int bc_tester_run_tests(const char *suite_name, const char *test_name, const cha int bc_tester_suite_index(const char *suite_name); const char * bc_tester_current_suite_name(void); const char * bc_tester_current_test_name(void); +const char ** bc_tester_current_test_tags(void); char* bc_sprintfva(const char* format, va_list args); char* bc_sprintf(const char* format, ...); diff --git a/tester/complex_sip_call_tester.c b/tester/complex_sip_call_tester.c index 09c7e8076..228f44350 100644 --- a/tester/complex_sip_call_tester.c +++ b/tester/complex_sip_call_tester.c @@ -55,9 +55,9 @@ FILE *sip_start(const char *senario, const char* dest_username, LinphoneAddress* else dest = ms_strdup_printf("%s",linphone_address_get_domain(dest_addres)); //until errors logs are handled correctly and stop breaks output, they will be DISABLED - command = ms_strdup_printf(SIPP_COMMAND" -sf %s -s %s %s -trace_err -trace_msg -rtp_echo -m 1 -d 1000",senario,dest_username,dest); + command = ms_strdup_printf(SIPP_COMMAND" -sf %s -s %s %s -trace_err -trace_msg -rtp_echo -m 1 -d 1000 2>/dev/null",senario,dest_username,dest); - ms_message("Starting sipp commad [%s]",command); + ms_message("Starting sipp command [%s]",command); file = popen(command, "r"); ms_free(command); ms_free(dest); @@ -74,9 +74,9 @@ static FILE *sip_start_recv(const char *senario) { FILE *file; //until errors logs are handled correctly and stop breaks output, they will be DISABLED - command = ms_strdup_printf(SIPP_COMMAND" -sf %s -trace_err -trace_msg -rtp_echo -m 1 -d 1000",senario); + command = ms_strdup_printf(SIPP_COMMAND" -sf %s -trace_err -trace_msg -rtp_echo -m 1 -d 1000 2>/dev/null",senario); - ms_message("Starting sipp commad [%s]",command); + ms_message("Starting sipp command [%s]",command); file = popen(command, "r"); ms_free(command); return file; diff --git a/tester/eventapi_tester.c b/tester/eventapi_tester.c index ce7c60c31..d57978926 100644 --- a/tester/eventapi_tester.c +++ b/tester/eventapi_tester.c @@ -359,15 +359,15 @@ static void publish_without_expires(void){ } test_t event_tests[] = { - TEST_NO_TAG("Subscribe declined", subscribe_test_declined), - TEST_NO_TAG("Subscribe terminated by subscriber", subscribe_test_terminated_by_subscriber), - TEST_NO_TAG("Subscribe with custom headers", subscribe_test_with_custom_header), - TEST_NO_TAG("Subscribe refreshed", subscribe_test_refreshed), - TEST_NO_TAG("Subscribe manually refreshed", subscribe_test_manually_refreshed), - TEST_NO_TAG("Subscribe terminated by notifier", subscribe_test_terminated_by_notifier), - TEST_NO_TAG("Publish", publish_test), - TEST_NO_TAG("Publish without expires", publish_without_expires), - TEST_NO_TAG("Publish without automatic refresh",publish_no_auto_test) + TEST_ONE_TAG("Subscribe declined", subscribe_test_declined, "LeaksMemory"), + TEST_ONE_TAG("Subscribe terminated by subscriber", subscribe_test_terminated_by_subscriber, "LeaksMemory"), + TEST_ONE_TAG("Subscribe with custom headers", subscribe_test_with_custom_header, "LeaksMemory"), + TEST_ONE_TAG("Subscribe refreshed", subscribe_test_refreshed, "LeaksMemory"), + TEST_ONE_TAG("Subscribe manually refreshed", subscribe_test_manually_refreshed, "LeaksMemory"), + TEST_ONE_TAG("Subscribe terminated by notifier", subscribe_test_terminated_by_notifier, "LeaksMemory"), + TEST_ONE_TAG("Publish", publish_test, "LeaksMemory"), + TEST_ONE_TAG("Publish without expires", publish_without_expires, "LeaksMemory"), + TEST_ONE_TAG("Publish without automatic refresh",publish_no_auto_test, "LeaksMemory") }; test_suite_t event_test_suite = {"Event", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, diff --git a/tester/flexisip_tester.c b/tester/flexisip_tester.c index c85c400ea..8411434fc 100644 --- a/tester/flexisip_tester.c +++ b/tester/flexisip_tester.c @@ -73,11 +73,11 @@ static void message_forking(void) { BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneMessageReceived,1,3000)); BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneMessageReceived,1,1000)); BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageDelivered,1,1000)); - + /*wait a bit that 200Ok for MESSAGE are sent to server before shuting down the cores, because otherwise Flexisip will consider the messages * as not delivered and will expedite them in the next test, after receiving the REGISTER from marie's instances*/ wait_for_list(lcs, NULL, 0, 2000); - + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d"); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(marie2); @@ -97,7 +97,7 @@ static void message_forking_with_unreachable_recipients(void) { lcs=ms_list_append(lcs,pauline->lc); lcs=ms_list_append(lcs,marie2->lc); lcs=ms_list_append(lcs,marie3->lc); - + /*the following lines are to workaround a problem with messages sent by a previous test (Message forking) that arrive together with REGISTER responses, * because the ForkMessageContext is not terminated at flexisip side if Message forking test is passing fast*/ wait_for_list(lcs,NULL,0,1000); @@ -153,7 +153,7 @@ static void message_forking_with_all_recipients_unreachable(void) { marie2->stat.number_of_LinphoneMessageReceived = 0; marie3->stat.number_of_LinphoneMessageReceived = 0; - + /*All marie's device go offline*/ linphone_core_set_network_reachable(marie->lc,FALSE); linphone_core_set_network_reachable(marie2->lc,FALSE); @@ -919,31 +919,31 @@ static void test_subscribe_notify_with_sipp_publisher(void) { LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); /*just to get an identity*/ LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); - + LpConfig *pauline_lp = linphone_core_get_config(pauline->lc); char* lf_identity=linphone_address_as_string_uri_only(marie->identity); LinphoneFriend *lf = linphone_core_create_friend_with_address(pauline->lc,lf_identity); ms_free(lf_identity); - + lp_config_set_int(pauline_lp,"sip","subscribe_expires",5); - + linphone_core_add_friend(pauline->lc,lf); - + /*wait for subscribe acknowledgment*/ wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_NotifyReceived,1,2000); BC_ASSERT_EQUAL(LinphoneStatusOffline,linphone_friend_get_status(lf), int, "%d"); - + scen = bc_tester_res("sipp/simple_publish.xml"); - + sipp_out = sip_start(scen, linphone_address_get_username(marie->identity), marie->identity); - + if (sipp_out) { /*wait for marie status*/ wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_NotifyReceived,2,3000); BC_ASSERT_EQUAL(LinphoneStatusOnline,linphone_friend_get_status(lf), int, "%d"); pclose(sipp_out); } - + linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); #endif @@ -955,23 +955,23 @@ static void test_subscribe_notify_with_sipp_publisher_double_publish(void) { LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); /*just to get an identity*/ LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); - + LpConfig *pauline_lp = linphone_core_get_config(pauline->lc); char* lf_identity=linphone_address_as_string_uri_only(marie->identity); LinphoneFriend *lf = linphone_core_create_friend_with_address(pauline->lc,lf_identity); ms_free(lf_identity); lp_config_set_int(pauline_lp,"sip","subscribe_expires",5); - + linphone_core_add_friend(pauline->lc,lf); - + /*wait for subscribe acknowledgment*/ wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_NotifyReceived,1,2000); BC_ASSERT_EQUAL(LinphoneStatusOffline,linphone_friend_get_status(lf), int, "%d"); - + scen = bc_tester_res("sipp/double_publish_with_error.xml"); - + sipp_out = sip_start(scen, linphone_address_get_username(marie->identity), marie->identity); - + if (sipp_out) { /*wait for marie status*/ wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_NotifyReceived,2,3000); @@ -979,7 +979,7 @@ static void test_subscribe_notify_with_sipp_publisher_double_publish(void) { pclose(sipp_out); BC_ASSERT_EQUAL(pauline->stat.number_of_NotifyReceived,2,int, "%d"); } - + linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); #endif @@ -988,7 +988,7 @@ static void test_subscribe_notify_with_sipp_publisher_double_publish(void) { static void test_publish_unpublish(void) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneProxyConfig* proxy; - + proxy = linphone_core_get_default_proxy_config(marie->lc); linphone_proxy_config_edit(proxy); linphone_proxy_config_enable_publish(proxy,TRUE); @@ -1005,7 +1005,7 @@ static void test_list_subscribe (void) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc"); LinphoneCoreManager* laure = linphone_core_manager_new( "laure_rc"); - + char *list = "\n" "\n" @@ -1014,8 +1014,8 @@ static void test_list_subscribe (void) { "\t\n" "\n" "\n"; - - + + LinphoneEvent *lev; MSList* lcs=ms_list_append(NULL,marie->lc); char * pauline_uri=linphone_address_as_string_uri_only(pauline->identity); @@ -1025,29 +1025,29 @@ static void test_list_subscribe (void) { LinphoneAddress *list_name = linphone_address_new("sip:mescops@sip.example.org"); LinphoneProxyConfig* proxy_config; int dummy=0; - + ms_free(pauline_uri); ms_free(laure_uri); - + lcs=ms_list_append(lcs,pauline->lc); lcs=ms_list_append(lcs,laure->lc); - + linphone_content_set_type(content,"application"); linphone_content_set_subtype(content,"resource-lists+xml"); linphone_content_set_buffer(content,subscribe_content,strlen(subscribe_content)); - + lev=linphone_core_create_subscribe(marie->lc,list_name,"presence",60); - + linphone_event_add_custom_header(lev,"Supported","eventlist"); linphone_event_add_custom_header(lev,"Accept","application/pidf+xml, application/rlmi+xml"); linphone_event_add_custom_header(lev,"Content-Disposition", "recipient-list"); linphone_event_add_custom_header(lev,"Require", "recipient-list-subscribe"); - + linphone_event_send_subscribe(lev,content); - + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000)); BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,1,5000)); - + /*make sure marie receives first notification before terminating*/ BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,1,5000)); /*dummy wait to avoid derred notify*/ @@ -1056,22 +1056,22 @@ static void test_list_subscribe (void) { linphone_proxy_config_edit(proxy_config); linphone_proxy_config_enable_publish(proxy_config,TRUE); linphone_proxy_config_done(proxy_config); - + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,2,5000)); - + proxy_config = linphone_core_get_default_proxy_config(laure->lc); linphone_proxy_config_edit(proxy_config); linphone_proxy_config_enable_publish(proxy_config,TRUE); linphone_proxy_config_done(proxy_config); /*make sure notify is not sent "imadiatly but defered*/ BC_ASSERT_FALSE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,3,1000)); - + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,3,5000)); - + linphone_event_terminate(lev); - + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionTerminated,1,5000)); - + ms_free(subscribe_content); linphone_address_destroy(list_name); linphone_content_unref(content); @@ -1082,7 +1082,7 @@ static void test_list_subscribe (void) { test_t flexisip_tests[] = { - TEST_NO_TAG("Subscribe forking", subscribe_forking), + TEST_ONE_TAG("Subscribe forking", subscribe_forking, "LeaksMemory"), TEST_NO_TAG("Message forking", message_forking), TEST_NO_TAG("Message forking with unreachable recipients", message_forking_with_unreachable_recipients), TEST_NO_TAG("Message forking with all recipients unreachable", message_forking_with_all_recipients_unreachable), @@ -1096,15 +1096,15 @@ test_t flexisip_tests[] = { TEST_NO_TAG("Call forking not responded", call_forking_not_responded), TEST_NO_TAG("Early-media call forking", early_media_call_forking), TEST_NO_TAG("Call with sips", call_with_sips), - TEST_NO_TAG("Call with sips not achievable", call_with_sips_not_achievable), + TEST_ONE_TAG("Call with sips not achievable", call_with_sips_not_achievable, "LeaksMemory"), TEST_NO_TAG("Call with ipv6", call_with_ipv6), TEST_NO_TAG("Subscribe Notify with sipp publisher", test_subscribe_notify_with_sipp_publisher), TEST_NO_TAG("Subscribe Notify with sipp double publish", test_subscribe_notify_with_sipp_publisher_double_publish), TEST_NO_TAG("Publish/unpublish", test_publish_unpublish), - TEST_NO_TAG("List subscribe", test_list_subscribe), - TEST_NO_TAG("File transfer message rcs to external body client", file_transfer_message_rcs_to_external_body_client), - TEST_NO_TAG("File transfer message external body to rcs client", file_transfer_message_external_body_to_rcs_client), - TEST_NO_TAG("File transfer message external body to external body client", file_transfer_message_external_body_to_external_body_client), + TEST_ONE_TAG("List subscribe", test_list_subscribe, "LeaksMemory"), + TEST_ONE_TAG("File transfer message rcs to external body client", file_transfer_message_rcs_to_external_body_client, "LeaksMemory"), + TEST_ONE_TAG("File transfer message external body to rcs client", file_transfer_message_external_body_to_rcs_client, "LeaksMemory"), + TEST_ONE_TAG("File transfer message external body to external body client", file_transfer_message_external_body_to_external_body_client, "LeaksMemory"), TEST_NO_TAG("DoS module trigger by sending a lot of chat messages", dos_module_trigger) }; diff --git a/tester/liblinphone_tester.h b/tester/liblinphone_tester.h index f0938839a..e4ad68522 100644 --- a/tester/liblinphone_tester.h +++ b/tester/liblinphone_tester.h @@ -356,7 +356,7 @@ int linphone_core_manager_get_mean_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); void liblinphone_tester_before_each(void); -void liblinphone_tester_after_each(void); +int liblinphone_tester_after_each(void); void liblinphone_tester_init(void(*ftester_printf)(int level, const char *fmt, va_list args)); void liblinphone_tester_uninit(void); int liblinphone_tester_set_log_file(const char *filename); diff --git a/tester/log_collection_tester.c b/tester/log_collection_tester.c index a18c90e69..11463424e 100644 --- a/tester/log_collection_tester.c +++ b/tester/log_collection_tester.c @@ -321,7 +321,7 @@ test_t log_collection_tests[] = { TEST_NO_TAG("Collect files filled when enabled", collect_files_filled), TEST_NO_TAG("Logs collected into small file", collect_files_small_size), TEST_NO_TAG("Logs collected when decreasing max size", collect_files_changing_size), - TEST_NO_TAG("Upload collected traces", upload_collected_traces) + TEST_ONE_TAG("Upload collected traces", upload_collected_traces, "MemoryLeaks") }; test_suite_t log_collection_test_suite = {"LogCollection", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, diff --git a/tester/message_tester.c b/tester/message_tester.c index 492d74f5f..c565fb38a 100644 --- a/tester/message_tester.c +++ b/tester/message_tester.c @@ -1241,7 +1241,7 @@ static void history_count(void) { messages=linphone_chat_room_get_history(chatroom,0); BC_ASSERT_EQUAL(linphone_chat_room_get_history_size(chatroom), 1270, int, "%d"); BC_ASSERT_EQUAL(ms_list_size(messages), 1270, int, "%d"); - + /*check the second most recent msg*/ BC_ASSERT_PTR_NOT_NULL(messages); if (messages){ @@ -1250,7 +1250,7 @@ static void history_count(void) { BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text((LinphoneChatMessage *)messages->next->data), "Fore and aft follow each other."); } } - + ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref); /*test offset+limit: retrieve the 42th latest msg only and check its content*/ @@ -1706,7 +1706,7 @@ void file_transfer_with_http_proxy(void) { test_t message_tests[] = { TEST_NO_TAG("Text message", text_message), - TEST_NO_TAG("Text message within call dialog", text_message_within_call_dialog), + TEST_ONE_TAG("Text message within call dialog", text_message_within_call_dialog, "MemoryLeaks"), TEST_NO_TAG("Text message with credentials from auth callback", text_message_with_credential_from_auth_callback), TEST_NO_TAG("Text message with privacy", text_message_with_privacy), TEST_NO_TAG("Text message compatibility mode", text_message_compatibility_mode), @@ -1717,9 +1717,9 @@ test_t message_tests[] = { TEST_NO_TAG("Transfer message with http proxy", file_transfer_with_http_proxy), TEST_NO_TAG("Transfer message with upload io error", transfer_message_with_upload_io_error), TEST_NO_TAG("Transfer message with download io error", transfer_message_with_download_io_error), - TEST_NO_TAG("Transfer message upload cancelled", transfer_message_upload_cancelled), + TEST_ONE_TAG("Transfer message upload cancelled", transfer_message_upload_cancelled, "MemoryLeaks"), TEST_NO_TAG("Transfer message download cancelled", transfer_message_download_cancelled), - TEST_NO_TAG("Transfer message using external body url", file_transfer_using_external_body_url), + TEST_ONE_TAG("Transfer message using external body url", file_transfer_using_external_body_url, "MemoryLeaks"), TEST_NO_TAG("Transfer 2 messages simultaneously", file_transfer_2_messages_simultaneously), TEST_NO_TAG("Text message denied", text_message_denied), TEST_NO_TAG("Info message", info_message), @@ -1738,17 +1738,17 @@ test_t message_tests[] = { TEST_NO_TAG("History count", history_count), #endif TEST_NO_TAG("Text status after destroying chat room", text_status_after_destroying_chat_room), - TEST_NO_TAG("Transfer not sent if invalid url", file_transfer_not_sent_if_invalid_url), - TEST_NO_TAG("Transfer not sent if host not found", file_transfer_not_sent_if_host_not_found), - TEST_NO_TAG("Transfer not sent if url moved permanently", file_transfer_not_sent_if_url_moved_permanently), - TEST_NO_TAG("Transfer io error after destroying chatroom", file_transfer_io_error_after_destroying_chatroom), + TEST_ONE_TAG("Transfer not sent if invalid url", file_transfer_not_sent_if_invalid_url, "MemoryLeaks"), + TEST_ONE_TAG("Transfer not sent if host not found", file_transfer_not_sent_if_host_not_found, "MemoryLeaks"), + TEST_ONE_TAG("Transfer not sent if url moved permanently", file_transfer_not_sent_if_url_moved_permanently, "MemoryLeaks"), + TEST_ONE_TAG("Transfer io error after destroying chatroom", file_transfer_io_error_after_destroying_chatroom, "MemoryLeaks"), TEST_NO_TAG("Real Time Text message", real_time_text_message), TEST_NO_TAG("Real Time Text conversation", real_time_text_conversation), TEST_NO_TAG("Real Time Text without audio", real_time_text_without_audio), TEST_NO_TAG("Real Time Text with srtp", real_time_text_srtp), TEST_NO_TAG("Real Time Text with ice", real_time_text_ice), - TEST_NO_TAG("Real Time Text message compatibility crlf", real_time_text_message_compat_crlf), - TEST_NO_TAG("Real Time Text message compatibility lf", real_time_text_message_compat_lf), + TEST_ONE_TAG("Real Time Text message compatibility crlf", real_time_text_message_compat_crlf, "MemoryLeaks"), + TEST_ONE_TAG("Real Time Text message compatibility lf", real_time_text_message_compat_lf, "MemoryLeaks"), TEST_NO_TAG("Real Time Text message with accented characters", real_time_text_message_accented_chars), TEST_NO_TAG("Real Time Text offer answer with different payload numbers (sender side)", real_time_text_message_different_text_codecs_payload_numbers_sender_side), TEST_NO_TAG("Real Time Text offer answer with different payload numbers (receiver side)", real_time_text_message_different_text_codecs_payload_numbers_receiver_side), diff --git a/tester/multi_call_tester.c b/tester/multi_call_tester.c index 0e969b169..fb72a561f 100644 --- a/tester/multi_call_tester.c +++ b/tester/multi_call_tester.c @@ -100,7 +100,7 @@ static void call_waiting_indication_with_param(bool_t enable_caller_privacy) { 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,1,10000)); BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,1,10000)); - + linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(laure); @@ -120,33 +120,33 @@ static void second_call_rejection(bool_t second_without_audio){ LinphoneCall *pauline_call; LinphoneCallParams *params; LinphoneCall *marie_call; - + /*start a call to pauline*/ linphone_core_invite_address(marie->lc, pauline->identity); BC_ASSERT_TRUE(wait_for(marie->lc ,pauline->lc ,&marie->stat.number_of_LinphoneCallOutgoingRinging ,1)); - + /*attempt to send a second call while the first one is not answered. * It must be rejected by the core, since the audio resources are already engaged for the first call*/ params = linphone_core_create_call_params(marie->lc, NULL); linphone_call_params_enable_audio(params, !second_without_audio); marie_call = linphone_core_invite_with_params(marie->lc, "sip:laure_non_exstent@test.linphone.org", params); - + linphone_call_params_destroy(params); - + if (second_without_audio){ BC_ASSERT_PTR_NOT_NULL(marie_call); BC_ASSERT_TRUE(wait_for(marie->lc ,pauline->lc ,&marie->stat.number_of_LinphoneCallError ,1)); - + }else{ BC_ASSERT_PTR_NULL(marie_call); } - + pauline_call = linphone_core_get_current_call(pauline->lc); BC_ASSERT_PTR_NOT_NULL(pauline_call); if (pauline_call){ @@ -253,7 +253,7 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag lcs=ms_list_append(lcs,pauline->lc); lcs=ms_list_append(lcs,laure->lc); if(focus) lcs=ms_list_append(lcs,focus->lc); - + is_remote_conf = (strcmp(lp_config_get_string(marie->lc->config, "misc", "conference_type", "local"), "remote") == 0); if(is_remote_conf) BC_ASSERT_PTR_NOT_NULL(focus); @@ -299,7 +299,7 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneTransferCallConnected,initial_marie_stat.number_of_LinphoneTransferCallConnected+2,5000)); BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,initial_marie_stat.number_of_LinphoneCallEnd+2,5000)); } - + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,initial_pauline_stat.number_of_LinphoneCallStreamsRunning+1,5000)); BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,initial_laure_stat.number_of_LinphoneCallStreamsRunning+1,2000)); BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,initial_marie_stat.number_of_LinphoneCallStreamsRunning+2,3000)); @@ -338,12 +338,12 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag BC_ASSERT_EQUAL(ms_list_size(participants), 2, int, "%d"); ms_list_free_with_data(participants, (void(*)(void *))linphone_address_destroy); } - + linphone_core_terminate_conference(marie->lc); BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,is_remote_conf?2:1,10000)); BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,is_remote_conf?3:1,10000)); BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,is_remote_conf?2:1,10000)); - + end: ms_list_free(lcs); } @@ -637,7 +637,7 @@ static void eject_from_3_participants_conference(LinphoneCoreManager *marie, Lin is_remote_conf = (strcmp(lp_config_get_string(marie->lc->config, "misc", "conference_type", "local"), "remote") == 0); if(is_remote_conf) BC_ASSERT_PTR_NOT_NULL(focus); - + BC_ASSERT_TRUE(call(marie,pauline)); marie_call_pauline=linphone_core_get_current_call(marie->lc); pauline_called_by_marie=linphone_core_get_current_call(pauline->lc); @@ -653,14 +653,14 @@ static void eject_from_3_participants_conference(LinphoneCoreManager *marie, Lin BC_ASSERT_PTR_NOT_NULL_FATAL(marie_call_laure); 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)); else { BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneTransferCallConnected,initial_marie_stat.number_of_LinphoneTransferCallConnected+1,5000)); BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,initial_marie_stat.number_of_LinphoneCallEnd+1,5000)); BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,initial_laure_stat.number_of_LinphoneCallEnd+1,5000)); } - + BC_ASSERT_PTR_NOT_NULL(linphone_core_get_conference(marie->lc)); linphone_core_add_to_conference(marie->lc,marie_call_pauline); @@ -699,7 +699,7 @@ static void eject_from_3_participants_conference(LinphoneCoreManager *marie, Lin } else { BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,initial_pauline_stat.number_of_LinphoneCallEnd+2,5000)); } - + if(!is_remote_conf) { end_call(laure, marie); end_call(pauline, marie); @@ -808,7 +808,7 @@ static void eject_from_4_participants_conference(void) { linphone_core_manager_destroy(laure); linphone_core_manager_destroy(michelle); } - + void simple_remote_conference(void) { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); @@ -822,10 +822,10 @@ void simple_remote_conference(void) { const char *focus_uri = linphone_proxy_config_get_identity(focus_proxy_config); int laure_n_register = laure->stat.number_of_LinphoneRegistrationOk; MSList *lcs = NULL; - + lp_config_set_string(marie_config, "misc", "conference_type", "remote"); lp_config_set_string(marie_config, "misc", "conference_focus_addr", focus_uri); - + linphone_proxy_config_edit(laure_proxy_config); linphone_proxy_config_set_route(laure_proxy_config, laure_proxy_uri); linphone_proxy_config_done(laure_proxy_config); @@ -834,7 +834,7 @@ void simple_remote_conference(void) { ms_list_free(lcs); simple_conference_base(marie, pauline, laure, (LinphoneCoreManager *)focus); - + linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(laure); @@ -853,10 +853,10 @@ void simple_remote_conference_shut_down_focus(void) { const char *focus_uri = linphone_proxy_config_get_identity(focus_proxy_config); int laure_n_register = laure->stat.number_of_LinphoneRegistrationOk; MSList *lcs = NULL; - + lp_config_set_string(marie_config, "misc", "conference_type", "remote"); lp_config_set_string(marie_config, "misc", "conference_focus_addr", focus_uri); - + linphone_proxy_config_edit(laure_proxy_config); linphone_proxy_config_set_route(laure_proxy_config, laure_proxy_uri); linphone_proxy_config_done(laure_proxy_config); @@ -865,7 +865,7 @@ void simple_remote_conference_shut_down_focus(void) { ms_list_free(lcs); simple_conference_base(marie, pauline, laure, (LinphoneCoreManager *)focus); - + linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(laure); @@ -884,10 +884,10 @@ void eject_from_3_participants_remote_conference(void) { const char *focus_uri = linphone_proxy_config_get_identity(focus_proxy_config); int laure_n_register = laure->stat.number_of_LinphoneRegistrationOk; MSList *lcs = NULL; - + lp_config_set_string(marie_config, "misc", "conference_type", "remote"); lp_config_set_string(marie_config, "misc", "conference_focus_addr", focus_uri); - + linphone_proxy_config_edit(laure_proxy_config); linphone_proxy_config_set_route(laure_proxy_config, laure_proxy_uri); linphone_proxy_config_done(laure_proxy_config); @@ -905,23 +905,23 @@ void eject_from_3_participants_remote_conference(void) { test_t multi_call_tests[] = { TEST_NO_TAG("Call waiting indication", call_waiting_indication), + TEST_NO_TAG("Call waiting indication with privacy", call_waiting_indication_with_privacy), TEST_NO_TAG("Second call rejected if first one in progress", second_call_rejected_if_first_one_in_progress), TEST_NO_TAG("Second call allowed if not using audio", second_call_allowed_if_not_using_audio), - TEST_NO_TAG("Call waiting indication with privacy", call_waiting_indication_with_privacy), - TEST_NO_TAG("Incoming call accepted when outgoing call in progress", incoming_call_accepted_when_outgoing_call_in_progress), - TEST_NO_TAG("Incoming call accepted when outgoing call in outgoing ringing", incoming_call_accepted_when_outgoing_call_in_outgoing_ringing), - TEST_NO_TAG("Incoming call accepted when outgoing call in outgoing ringing early media", incoming_call_accepted_when_outgoing_call_in_outgoing_ringing_early_media), - TEST_NO_TAG("Simple conference", simple_conference), - TEST_ONE_TAG("Simple conference with ICE", simple_conference_with_ice, "ICE"), - TEST_ONE_TAG("Simple ZRTP conference with ICE", simple_zrtp_conference_with_ice, "ICE"), + TEST_ONE_TAG("Incoming call accepted when outgoing call in progress", incoming_call_accepted_when_outgoing_call_in_progress, "LeaksMemory"), + TEST_ONE_TAG("Incoming call accepted when outgoing call in outgoing ringing", incoming_call_accepted_when_outgoing_call_in_outgoing_ringing, "LeaksMemory"), + TEST_ONE_TAG("Incoming call accepted when outgoing call in outgoing ringing early media", incoming_call_accepted_when_outgoing_call_in_outgoing_ringing_early_media, "LeaksMemory"), + TEST_ONE_TAG("Simple conference", simple_conference, "LeaksMemory"), + TEST_TWO_TAGS("Simple conference with ICE", simple_conference_with_ice, "ICE", "LeaksMemory"), + TEST_TWO_TAGS("Simple ZRTP conference with ICE", simple_zrtp_conference_with_ice, "ICE", "LeaksMemory"), TEST_NO_TAG("Eject from 3 participants conference", eject_from_3_participants_local_conference), - TEST_NO_TAG("Eject from 4 participants conference", eject_from_4_participants_conference), + TEST_ONE_TAG("Eject from 4 participants conference", eject_from_4_participants_conference, "LeaksMemory"), TEST_NO_TAG("Simple call transfer", simple_call_transfer), TEST_NO_TAG("Unattended call transfer", unattended_call_transfer), TEST_NO_TAG("Unattended call transfer with error", unattended_call_transfer_with_error), TEST_NO_TAG("Call transfer existing call outgoing call", call_transfer_existing_call_outgoing_call), TEST_NO_TAG("Simple remote conference", simple_remote_conference), - TEST_NO_TAG("Simple remote conference with shut down focus", simple_remote_conference_shut_down_focus), + TEST_ONE_TAG("Simple remote conference with shut down focus", simple_remote_conference_shut_down_focus, "LeaksMemory"), TEST_NO_TAG("Eject from 3 participants in remote conference", eject_from_3_participants_remote_conference), }; diff --git a/tester/presence_tester.c b/tester/presence_tester.c index ff9f713b5..ee17d976b 100644 --- a/tester/presence_tester.c +++ b/tester/presence_tester.c @@ -976,23 +976,23 @@ static void test_presence_list_subscribe_io_error(void) { } test_t presence_tests[] = { - TEST_NO_TAG("Simple Subscribe", simple_subscribe), - TEST_NO_TAG("Simple Publish", simple_publish), - TEST_NO_TAG("Simple Publish with expires", publish_with_expires), - /*TEST_NO_TAG("Call with presence", call_with_presence),*/ - TEST_NO_TAG("Unsubscribe while subscribing", unsubscribe_while_subscribing), - TEST_NO_TAG("Presence information", presence_information), - TEST_NO_TAG("App managed presence failure", subscribe_failure_handle_by_app), - TEST_NO_TAG("Presence SUBSCRIBE forked", subscribe_presence_forked), - TEST_NO_TAG("Presence SUBSCRIBE expired", subscribe_presence_expired), - TEST_NO_TAG("Subscriber no loguer reachable using server",subscriber_no_longuer_reachable), - TEST_NO_TAG("Subscribe with late publish", test_subscribe_notify_publish), - TEST_NO_TAG("Forked subscribe with late publish", test_forked_subscribe_notify_publish), - TEST_NO_TAG("Presence list", test_presence_list), - TEST_NO_TAG("Presence list without compression", test_presence_list_without_compression), - TEST_NO_TAG("Presence list, subscription expiration for unknown contact",test_presence_list_subscription_expire_for_unknown), - TEST_NO_TAG("Presence list, silent subscription expiration", test_presence_list_subscribe_dialog_expire), - TEST_NO_TAG("Presence list, io error",test_presence_list_subscribe_io_error) + TEST_ONE_TAG("Simple Subscribe", simple_subscribe, "LeaksMemory"), + TEST_ONE_TAG("Simple Publish", simple_publish, "LeaksMemory"), + TEST_ONE_TAG("Simple Publish with expires", publish_with_expires, "LeaksMemory"), + /*TEST_ONE_TAG("Call with presence", call_with_presence, "LeaksMemory"),*/ + TEST_ONE_TAG("Unsubscribe while subscribing", unsubscribe_while_subscribing, "LeaksMemory"), + TEST_ONE_TAG("Presence information", presence_information, "LeaksMemory"), + TEST_ONE_TAG("App managed presence failure", subscribe_failure_handle_by_app, "LeaksMemory"), + TEST_ONE_TAG("Presence SUBSCRIBE forked", subscribe_presence_forked, "LeaksMemory"), + TEST_ONE_TAG("Presence SUBSCRIBE expired", subscribe_presence_expired, "LeaksMemory"), + TEST_ONE_TAG("Subscriber no loguer reachable using server",subscriber_no_longuer_reachable, "LeaksMemory"), + TEST_ONE_TAG("Subscribe with late publish", test_subscribe_notify_publish, "LeaksMemory"), + TEST_ONE_TAG("Forked subscribe with late publish", test_forked_subscribe_notify_publish, "LeaksMemory"), + TEST_ONE_TAG("Presence list", test_presence_list, "LeaksMemory"), + TEST_ONE_TAG("Presence list without compression", test_presence_list_without_compression, "LeaksMemory"), + TEST_ONE_TAG("Presence list, subscription expiration for unknown contact",test_presence_list_subscription_expire_for_unknown, "LeaksMemory"), + TEST_ONE_TAG("Presence list, silent subscription expiration", test_presence_list_subscribe_dialog_expire, "LeaksMemory"), + TEST_ONE_TAG("Presence list, io error",test_presence_list_subscribe_io_error, "LeaksMemory") }; test_suite_t presence_test_suite = {"Presence", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, diff --git a/tester/setup_tester.c b/tester/setup_tester.c index b4c31ce73..13d828d37 100644 --- a/tester/setup_tester.c +++ b/tester/setup_tester.c @@ -42,7 +42,7 @@ static void core_init_test(void) { static void linphone_address_test(void) { linphone_address_destroy(create_linphone_address(NULL)); BC_ASSERT_PTR_NULL(linphone_address_new("sip:@sip.linphone.org")); - + } static void core_sip_transport_test(void) { @@ -84,26 +84,23 @@ static void linphone_interpret_url_test(void) memset ( &v_table,0,sizeof ( v_table ) ); lc = linphone_core_new ( &v_table,NULL,NULL,NULL ); BC_ASSERT_PTR_NOT_NULL_FATAL ( lc ); - + proxy_config =linphone_core_create_proxy_config(lc); linphone_proxy_config_set_identity(proxy_config, "sip:moi@sip.linphone.org"); linphone_proxy_config_enable_register(proxy_config, FALSE); linphone_proxy_config_set_server_addr(proxy_config,"sip:sip.linphone.org"); linphone_core_add_proxy_config(lc, proxy_config); linphone_core_set_default_proxy_config(lc,proxy_config); - + 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"); - linphone_address_destroy(address); address = linphone_core_interpret_url(lc,"23"); - BC_ASSERT_PTR_NOT_NULL(address); BC_ASSERT_STRING_EQUAL(linphone_address_get_scheme(address), "sip"); BC_ASSERT_STRING_EQUAL(linphone_address_get_username(address), "23"); @@ -111,7 +108,6 @@ static void linphone_interpret_url_test(void) linphone_address_destroy(address); address = linphone_core_interpret_url(lc,"#24"); - BC_ASSERT_PTR_NOT_NULL(address); BC_ASSERT_STRING_EQUAL(linphone_address_get_scheme(address), "sip"); BC_ASSERT_STRING_EQUAL(linphone_address_get_username(address), "#24"); @@ -124,12 +120,10 @@ static void linphone_interpret_url_test(void) BC_ASSERT_STRING_EQUAL(linphone_address_get_scheme(address), "sip"); BC_ASSERT_STRING_EQUAL(linphone_address_get_username(address), "#24"); BC_ASSERT_STRING_EQUAL(linphone_address_get_domain(address), "sip.linphone.org"); - linphone_address_destroy(address); ms_free(tmp); - - linphone_core_destroy ( lc ); + linphone_core_destroy (lc); } static void linphone_lpconfig_from_buffer(void){ @@ -342,7 +336,7 @@ test_t setup_tests[] = { TEST_NO_TAG("Linphone proxy config server address change (internal api)", linphone_proxy_config_is_server_config_changed_test), TEST_NO_TAG("Linphone core init/uninit", core_init_test), TEST_NO_TAG("Linphone random transport port",core_sip_transport_test), - TEST_NO_TAG("Linphone interpret url", linphone_interpret_url_test), + TEST_ONE_TAG("Linphone interpret url", linphone_interpret_url_test, "LeaksMemory"), TEST_NO_TAG("LPConfig from buffer", linphone_lpconfig_from_buffer), TEST_NO_TAG("LPConfig zero_len value from buffer", linphone_lpconfig_from_buffer_zerolen_value), TEST_NO_TAG("LPConfig zero_len value from file", linphone_lpconfig_from_file_zerolen_value), diff --git a/tester/tester.c b/tester/tester.c index 2d67adb41..c361ae34a 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -418,7 +418,7 @@ void linphone_core_manager_uninit(LinphoneCoreManager *mgr) { if (mgr->identity) { linphone_address_destroy(mgr->identity); } - + manager_count--; } @@ -534,7 +534,7 @@ void liblinphone_tester_before_each(void) { static char* all_leaks_buffer = NULL; -void liblinphone_tester_after_each(void) { +int liblinphone_tester_after_each(void) { if (!liblinphone_tester_leak_detector_disabled){ int leaked_objects = belle_sip_object_get_object_count() - leaked_objects_count; if (leaked_objects > 0) { @@ -547,12 +547,25 @@ void liblinphone_tester_after_each(void) { ms_error("%s", format); all_leaks_buffer = ms_strcat_printf(all_leaks_buffer, "\n%s", format); + + { + //prevent any future leaks + const char **tags = bc_tester_current_test_tags(); + // if the test is NOT marked as leaking memory and it actually is, we should make it fail + if ( tags && + !((tags[0] && strcmp(tags[0], "LeakingMemory")) || (tags[1] && strcmp(tags[1], "LeakingMemory")))) { + BC_FAIL("This test is leaking memory!"); + return 1; + } + } + } } if (manager_count != 0) { ms_fatal("%d Linphone core managers are still alive!", manager_count); } + return 0; } void liblinphone_tester_uninit(void) { @@ -582,8 +595,8 @@ static void check_ice_from_rtp(LinphoneCall *c1, LinphoneCall *c2, LinphoneStrea BC_ASSERT_FALSE(stream_type >= LinphoneStreamTypeUnknown); return; } - - + + if (linphone_call_get_audio_stats(c1)->ice_state == LinphoneIceStateHostConnection && media_stream_started(ms)) { char ip[16]; char port[8]; @@ -604,16 +617,16 @@ bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, Linph bool_t text_success=FALSE; bool_t video_enabled, realtime_text_enabled; MSTimeSpec ts; - + c1=linphone_core_get_current_call(caller->lc); c2=linphone_core_get_current_call(callee->lc); - + BC_ASSERT_PTR_NOT_NULL(c1); BC_ASSERT_PTR_NOT_NULL(c2); if (!c1 || !c2) return FALSE; linphone_call_ref(c1); linphone_call_ref(c2); - + BC_ASSERT_EQUAL(linphone_call_params_video_enabled(linphone_call_get_current_params(c1)),linphone_call_params_video_enabled(linphone_call_get_current_params(c2)), int, "%d"); BC_ASSERT_EQUAL(linphone_call_params_realtime_text_enabled(linphone_call_get_current_params(c1)),linphone_call_params_realtime_text_enabled(linphone_call_get_current_params(c2)), int, "%d"); video_enabled=linphone_call_params_video_enabled(linphone_call_get_current_params(c1)); @@ -633,7 +646,7 @@ bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, Linph } ms_usleep(20000); }while(!liblinphone_tester_clock_elapsed(&ts,10000)); - + if (video_enabled){ liblinphone_tester_clock_start(&ts); do{ @@ -651,7 +664,7 @@ bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, Linph ms_usleep(20000); }while(!liblinphone_tester_clock_elapsed(&ts,10000)); } - + if (realtime_text_enabled){ liblinphone_tester_clock_start(&ts); do{ @@ -669,7 +682,7 @@ bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, Linph ms_usleep(20000); }while(!liblinphone_tester_clock_elapsed(&ts,10000)); } - + /*make sure encryption mode are preserved*/ if (c1) { const LinphoneCallParams* call_param = linphone_call_get_current_params(c1); @@ -687,12 +700,12 @@ bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, Linph static void linphone_conference_server_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *msg) { LinphoneCoreVTable *vtable = linphone_core_get_current_vtable(lc); LinphoneConferenceServer *conf_srv = (LinphoneConferenceServer *)vtable->user_data; - + switch(cstate) { case LinphoneCallIncomingReceived: linphone_core_accept_call(lc, call); break; - + case LinphoneCallStreamsRunning: if(linphone_call_get_conference(call) == NULL) { linphone_core_add_to_conference(lc, call); @@ -700,7 +713,7 @@ static void linphone_conference_server_call_state_changed(LinphoneCore *lc, Linp if(conf_srv->first_call == NULL) conf_srv->first_call = linphone_call_ref(call); } break; - + case LinphoneCallEnd: if(call == conf_srv->first_call) { linphone_core_terminate_conference(lc); @@ -708,7 +721,7 @@ static void linphone_conference_server_call_state_changed(LinphoneCore *lc, Linp conf_srv->first_call = NULL; } break; - + default: break; } } @@ -718,7 +731,7 @@ static void linphone_conference_server_refer_received(LinphoneCore *core, const LinphoneAddress *refer_to_addr = linphone_address_new(refer_to); char *uri; LinphoneCall *call; - + if(refer_to_addr == NULL) return; strncpy(method, linphone_address_get_method_param(refer_to_addr), sizeof(method)); if(strcmp(method, "BYE") == 0) { @@ -745,7 +758,7 @@ static void linphone_conference_server_registration_state_changed(LinphoneCore * LinphoneConferenceServer* linphone_conference_server_new(const char *rc_file, bool_t do_registration) { LinphoneConferenceServer *conf_srv = (LinphoneConferenceServer *)ms_new0(LinphoneConferenceServer, 1); LinphoneCoreManager *lm = (LinphoneCoreManager *)conf_srv; - + conf_srv->vtable = linphone_core_v_table_new(); conf_srv->vtable->call_state_changed = linphone_conference_server_call_state_changed; conf_srv->vtable->refer_received = linphone_conference_server_refer_received; diff --git a/tester/video_tester.c b/tester/video_tester.c index fb732731b..0bd3239b4 100644 --- a/tester/video_tester.c +++ b/tester/video_tester.c @@ -553,7 +553,7 @@ static void enable_disable_camera_after_camera_switches(void) { test_t video_tests[] = { #if HAVE_GTK TEST_NO_TAG("Early-media video during video call", early_media_video_during_video_call_test), - TEST_NO_TAG("Two incoming early-media video calls", two_incoming_early_media_video_calls_test), + TEST_ONE_TAG("Two incoming early-media video calls", two_incoming_early_media_video_calls_test, "MemoryLeaks"), TEST_NO_TAG("Early-media video with inactive audio", early_media_video_with_inactive_audio), TEST_NO_TAG("Forked outgoing early-media video call with inactive audio", forked_outgoing_early_media_video_call_with_inactive_audio_test), #endif /*HAVE_GTK*/