diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 6a7026a3b..24c657177 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1502,9 +1502,9 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const LinphoneReason reason = linphone_call_get_reason(call); char *msg; if (reason != LinphoneReasonNone) { - msg = ms_strdup(_("Call parameters were successfully modified.")); - } else { msg = ms_strdup_printf(_("Call parameters could not be modified: %s."), linphone_reason_to_string(reason)); + } else { + msg = ms_strdup(_("Call parameters were successfully modified.")); } linphone_core_notify_display_status(lc, msg); ms_free(msg); @@ -3906,7 +3906,7 @@ static void report_bandwidth(LinphoneCall *call, MediaStream *as, MediaStream *v call->stats[LINPHONE_CALL_STATS_AUDIO].rtcp_upload_bandwidth=(as_active) ? (media_stream_get_rtcp_up_bw(as)*1e-3) : 0; call->stats[LINPHONE_CALL_STATS_VIDEO].rtcp_download_bandwidth=(vs_active) ? (media_stream_get_rtcp_down_bw(vs)*1e-3) : 0; call->stats[LINPHONE_CALL_STATS_VIDEO].rtcp_upload_bandwidth=(vs_active) ? (media_stream_get_rtcp_up_bw(vs)*1e-3) : 0; - + call->stats[LINPHONE_CALL_STATS_AUDIO].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); call->stats[LINPHONE_CALL_STATS_AUDIO].updated=0; @@ -3916,7 +3916,7 @@ static void report_bandwidth(LinphoneCall *call, MediaStream *as, MediaStream *v linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]); call->stats[LINPHONE_CALL_STATS_VIDEO].updated=0; update_local_stats(&call->stats[LINPHONE_CALL_STATS_VIDEO], vs); - + ms_message( "Bandwidth usage for call [%p]:\n" "\tRTP audio=[d=%5.1f,u=%5.1f], video=[d=%5.1f,u=%5.1f] kbits/sec\n" diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 7ed84a41c..4cdf3eb54 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1315,7 +1315,7 @@ static void ui_config_read(LinphoneCore *lc) linphone_core_add_friend(lc,lf); linphone_friend_unref(lf); } - + call_logs_read_from_config_file(lc); } @@ -2476,7 +2476,7 @@ void linphone_core_iterate(LinphoneCore *lc){ time_t current_real_time = ms_time(NULL); bool_t one_second_elapsed=FALSE; const char *remote_provisioning_uri = NULL; - + if (lc->network_reachable_to_be_notified) { lc->network_reachable_to_be_notified=FALSE; linphone_core_notify_network_reachable(lc,lc->network_reachable); @@ -3787,6 +3787,7 @@ int linphone_core_terminate_call(LinphoneCore *lc, LinphoneCall *the_call) { call = the_call; } + ms_message("Terminate call [%p] which is currently in state %s", call, linphone_call_state_to_string(call->state)); switch (call->state) { case LinphoneCallReleased: case LinphoneCallEnd: @@ -5023,7 +5024,7 @@ void linphone_core_set_call_logs_database_path(LinphoneCore *lc, const char *pat if (path) { lc->logs_db_file = ms_strdup(path); linphone_core_call_log_storage_init(lc); - + linphone_core_migrate_logs_from_rc_to_db(lc); } } @@ -5081,7 +5082,7 @@ void linphone_core_migrate_logs_from_rc_to_db(LinphoneCore *lc) { LpConfig *lpc = NULL; int original_logs_count, migrated_logs_count; int i; - + #ifndef CALL_LOGS_STORAGE_ENABLED ms_warning("linphone has been compiled without sqlite, can't migrate call logs"); return; @@ -5089,7 +5090,7 @@ void linphone_core_migrate_logs_from_rc_to_db(LinphoneCore *lc) { if (!lc) { return; } - + lpc = linphone_core_get_config(lc); if (!lpc) { ms_warning("this core has been started without a rc file, nothing to migrate"); @@ -5099,16 +5100,16 @@ void linphone_core_migrate_logs_from_rc_to_db(LinphoneCore *lc) { ms_warning("the call logs migration has already been done, skipping..."); return; } - - // This is because there must have been a call previously to linphone_core_call_log_storage_init + + // This is because there must have been a call previously to linphone_core_call_log_storage_init lc->call_logs = ms_list_free_with_data(lc->call_logs, (void (*)(void*))linphone_call_log_unref); - + call_logs_read_from_config_file(lc); if (!lc->call_logs) { ms_warning("nothing to migrate, skipping..."); return; } - + logs_to_migrate = lc->call_logs; lc->call_logs = NULL; // We can't use ms_list_for_each because logs_to_migrate are listed in the wrong order (latest first), and we want to store the logs latest last @@ -5123,7 +5124,7 @@ void linphone_core_migrate_logs_from_rc_to_db(LinphoneCore *lc) { int i = 0; ms_debug("call logs migration successful: %i logs migrated", ms_list_size(lc->call_logs)); lp_config_set_int(lpc, "misc", "call_logs_migration_done", 1); - + for (; i < original_logs_count; i++) { char logsection[32]; snprintf(logsection, sizeof(logsection), "call_log_%i", i); @@ -5132,7 +5133,7 @@ void linphone_core_migrate_logs_from_rc_to_db(LinphoneCore *lc) { } else { ms_error("not as many logs saved in db has logs read from rc (%i in rc against %i in db)!", original_logs_count, migrated_logs_count); } - + ms_list_free_with_data(logs_to_migrate, (void (*)(void*))linphone_call_log_unref); } diff --git a/coreapi/lpconfig.c b/coreapi/lpconfig.c index ba15adbe0..7300d63e2 100644 --- a/coreapi/lpconfig.c +++ b/coreapi/lpconfig.c @@ -416,7 +416,7 @@ LpConfig *lp_config_new_with_factory(const char *config_filename, const char *fa lp_config_read_file(lpconfig, factory_config_filename); } return lpconfig; - + fail: ms_free(lpconfig); return NULL; @@ -429,6 +429,7 @@ int lp_config_read_file(LpConfig *lpconfig, const char *filename){ ms_message("Reading config information from %s", path); lp_config_parse(lpconfig,f); fclose(f); + ms_free(path); return 0; } ms_warning("Fail to open file %s",path); @@ -764,12 +765,12 @@ bool_t lp_config_relative_file_exists(const LpConfig *lpconfig, const char *file char *filepath = ms_strdup_printf("%s/%s", dir, filename); char *realfilepath = lp_realpath(filepath, NULL); FILE *file; - + ms_free(filename); ms_free(filepath); - + if(realfilepath == NULL) return FALSE; - + file = fopen(realfilepath, "r"); ms_free(realfilepath); if (file) { @@ -785,14 +786,14 @@ void lp_config_write_relative_file(const LpConfig *lpconfig, const char *filenam char *filepath = NULL; char *realfilepath = NULL; FILE *file; - + if (lpconfig->filename == NULL) return; - + if(strlen(data) == 0) { ms_warning("%s has not been created because there is no data to write", filename); return; } - + dup_config_file = ms_strdup(lpconfig->filename); dir = _lp_config_dirname(dup_config_file); filepath = ms_strdup_printf("%s/%s", dir, filename); @@ -801,16 +802,16 @@ void lp_config_write_relative_file(const LpConfig *lpconfig, const char *filenam ms_error("Could not resolv %s: %s", filepath, strerror(errno)); goto end; } - + file = fopen(realfilepath, "w"); if(file == NULL) { ms_error("Could not open %s for write", realfilepath); goto end; } - + fprintf(file, "%s", data); fclose(file); - + end: ms_free(dup_config_file); ms_free(filepath); @@ -823,9 +824,9 @@ int lp_config_read_relative_file(const LpConfig *lpconfig, const char *filename, char *filepath = NULL; FILE *file = NULL; char* realfilepath = NULL; - + if (lpconfig->filename == NULL) return -1; - + dup_config_file = ms_strdup(lpconfig->filename); dir = _lp_config_dirname(dup_config_file); filepath = ms_strdup_printf("%s/%s", dir, filename); @@ -834,19 +835,19 @@ int lp_config_read_relative_file(const LpConfig *lpconfig, const char *filename, ms_error("Could not resolv %s: %s", filepath, strerror(errno)); goto err; } - + file = fopen(realfilepath, "r"); if(file == NULL) { ms_error("Could not open %s for read. %s", realfilepath, strerror(errno)); goto err; } - + if(fread(data, 1, max_length, file)<=0) { ms_error("%s could not be loaded. %s", realfilepath, strerror(errno)); goto err; } fclose(file); - + ms_free(dup_config_file); ms_free(filepath); ms_free(realfilepath); diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 4c67905e1..cf597e5ee 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -904,7 +904,7 @@ char* linphone_proxy_config_normalize_phone_number(LinphoneProxyConfig *proxy, c ms_free(flatten); } } - if (proxy==NULL) ms_free(tmpproxy); + if (proxy==NULL) linphone_proxy_config_destroy(tmpproxy); return result; } @@ -1494,9 +1494,11 @@ const char* linphone_proxy_config_get_transport(const LinphoneProxyConfig *cfg) return NULL; } - if ((route_addr || (route_addr=sal_address_new(addr))) && sal_address_get_transport(route_addr)) { + if (route_addr || (route_addr=sal_address_new(addr))) { ret=sal_transport_to_string(sal_address_get_transport(route_addr)); - if (!linphone_proxy_config_get_service_route(cfg)) sal_address_destroy(route_addr); /*destroy except for service route*/ + if (!linphone_proxy_config_get_service_route(cfg)) { + sal_address_destroy(route_addr); + } } return ret; diff --git a/coreapi/quality_reporting.c b/coreapi/quality_reporting.c index 58e47310b..f9d815849 100644 --- a/coreapi/quality_reporting.c +++ b/coreapi/quality_reporting.c @@ -260,7 +260,7 @@ static void append_metrics_to_buffer(char ** buffer, size_t * size, size_t * off } static int send_report(LinphoneCall* call, reporting_session_report_t * report, const char * report_event) { - LinphoneContent *content = linphone_content_new(); + LinphoneContent *content; int expires = -1; size_t offset = 0; size_t size = 2048; @@ -293,6 +293,7 @@ static int send_report(LinphoneCall* call, reporting_session_report_t * report, } buffer = (char *) belle_sip_malloc(size); + content = linphone_content_new(); linphone_content_set_type(content, "application"); linphone_content_set_subtype(content, "vq-rtcpxr"); diff --git a/coreapi/sipsetup.c b/coreapi/sipsetup.c index 7c9f074d9..29ffd46fc 100644 --- a/coreapi/sipsetup.c +++ b/coreapi/sipsetup.c @@ -76,6 +76,7 @@ void sip_setup_unregister_all(void){ ss->initialized=FALSE; } } + registered_sip_setups = ms_list_free(registered_sip_setups); } void buddy_lookup_request_set_key(BuddyLookupRequest *req, const char *key){ diff --git a/mediastreamer2 b/mediastreamer2 index 843ae9c9e..e4bbeb212 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 843ae9c9e37959222dc647f998a5e92bf6f80eaf +Subproject commit e4bbeb2123bd501b90ccfee958a4e20d3eebbf24 diff --git a/tester/call_tester.c b/tester/call_tester.c index f30bf1b31..def43133f 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -347,25 +347,22 @@ bool_t call(LinphoneCoreManager* caller_mgr,LinphoneCoreManager* callee_mgr){ } void end_call(LinphoneCoreManager *m1, LinphoneCoreManager *m2){ + int previous_count_1 = m1->stat.number_of_LinphoneCallEnd; + int previous_count_2 = m2->stat.number_of_LinphoneCallEnd; linphone_core_terminate_all_calls(m1->lc); - BC_ASSERT_TRUE(wait_for(m1->lc,m2->lc,&m1->stat.number_of_LinphoneCallEnd,1)); - BC_ASSERT_TRUE(wait_for(m1->lc,m2->lc,&m2->stat.number_of_LinphoneCallEnd,1)); - BC_ASSERT_TRUE(wait_for(m1->lc,m2->lc,&m1->stat.number_of_LinphoneCallReleased,1)); - BC_ASSERT_TRUE(wait_for(m1->lc,m2->lc,&m2->stat.number_of_LinphoneCallReleased,1)); + BC_ASSERT_TRUE(wait_for(m1->lc,m2->lc,&m1->stat.number_of_LinphoneCallEnd,previous_count_1+1)); + BC_ASSERT_TRUE(wait_for(m1->lc,m2->lc,&m2->stat.number_of_LinphoneCallEnd,previous_count_2+1)); + BC_ASSERT_TRUE(wait_for(m1->lc,m2->lc,&m1->stat.number_of_LinphoneCallReleased,previous_count_1+1)); + BC_ASSERT_TRUE(wait_for(m1->lc,m2->lc,&m2->stat.number_of_LinphoneCallReleased,previous_count_2+1)); } void simple_call_base(bool_t enable_multicast_recv_side) { - int begin; - int leaked_objects; LinphoneCoreManager* marie; LinphoneCoreManager* pauline; const LinphoneAddress *from; LinphoneCall *pauline_call; LinphoneProxyConfig* marie_cfg; - belle_sip_object_enable_leak_detector(TRUE); - begin=belle_sip_object_get_object_count(); - marie = linphone_core_manager_new( "marie_rc"); pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); @@ -408,12 +405,6 @@ void simple_call_base(bool_t enable_multicast_recv_side) { end_call(marie,pauline); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(marie); - - leaked_objects=belle_sip_object_get_object_count()-begin; - BC_ASSERT_EQUAL(leaked_objects, 0, int, "%d"); - if (leaked_objects>0){ - belle_sip_object_dump_active_objects(); - } } static void simple_call() { @@ -421,13 +412,9 @@ static void simple_call() { } static void call_with_timeouted_bye(void) { - int begin; - int leaked_objects; LinphoneCoreManager* marie; LinphoneCoreManager* pauline; belle_sip_timer_config_t timer_config; - belle_sip_object_enable_leak_detector(TRUE); - begin=belle_sip_object_get_object_count(); marie = linphone_core_manager_new( "marie_rc"); pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); @@ -454,12 +441,6 @@ static void call_with_timeouted_bye(void) { linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); - - leaked_objects=belle_sip_object_get_object_count()-begin; - BC_ASSERT_EQUAL(leaked_objects, 0, int, "%d"); - if (leaked_objects>0){ - belle_sip_object_dump_active_objects(); - } } static void direct_call_over_ipv6(){ @@ -534,6 +515,7 @@ static void call_outbound_with_multiple_proxy() { // calling marie should go through the second proxy config BC_ASSERT_TRUE(call(marie, pauline)); + end_call(marie, pauline); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } @@ -624,6 +606,8 @@ static void multiple_answers_call_with_media_relay(void) { BC_ASSERT_TRUE( wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallStreamsRunning, 1, 2000) ); BC_ASSERT_TRUE( wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallEnd, 1, 2000) ); + end_call(marie1, pauline); + end_call(marie2, pauline); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(marie1); @@ -1109,6 +1093,7 @@ static void call_with_ice_no_sdp(void){ liblinphone_tester_check_rtcp(marie,pauline); + end_call(pauline, marie); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } @@ -1998,6 +1983,8 @@ static void _call_with_ice_video(LinphoneVideoPolicy caller_policy, LinphoneVide BC_ASSERT_TRUE(check_ice(pauline, marie, LinphoneIceStateHostConnection)); } + end_call(pauline, marie); + end: linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -3403,14 +3390,9 @@ static void accept_call_in_send_only_base(LinphoneCoreManager* pauline, Linphone } static void accept_call_in_send_base(bool_t caller_has_ice) { - int begin; - int leaked_objects; LinphoneCoreManager *pauline, *marie; MSList *lcs=NULL;; - belle_sip_object_enable_leak_detector(TRUE); - begin=belle_sip_object_get_object_count(); - marie = linphone_core_manager_new("marie_rc"); pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); if (caller_has_ice) { @@ -3427,13 +3409,6 @@ static void accept_call_in_send_base(bool_t caller_has_ice) { ms_free(lcs); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); - - leaked_objects=belle_sip_object_get_object_count()-begin; - - BC_ASSERT_EQUAL(leaked_objects, 0, int, "%d"); - if (leaked_objects>0){ - belle_sip_object_dump_active_objects(); - } } static void accept_call_in_send_only(void) { @@ -3445,14 +3420,9 @@ static void accept_call_in_send_only_with_ice(void) { } void two_accepted_call_in_send_only() { - int begin; - int leaked_objects; LinphoneCoreManager *pauline, *marie, *laure; MSList *lcs=NULL; - belle_sip_object_enable_leak_detector(TRUE); - begin=belle_sip_object_get_object_count(); - marie = linphone_core_manager_new("marie_rc"); pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); laure = linphone_core_manager_new("laure_rc"); @@ -3473,14 +3443,6 @@ void two_accepted_call_in_send_only() { linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(laure); - - leaked_objects=belle_sip_object_get_object_count()-begin; - - BC_ASSERT_EQUAL(leaked_objects, 0, int, "%d"); - if (leaked_objects>0){ - belle_sip_object_dump_active_objects(); - } - } #endif @@ -3583,6 +3545,7 @@ static void video_call_snapshot(void) { wait_for_until(marie->lc, pauline->lc, &dummy, 1, 5000); BC_ASSERT_EQUAL(access(filename, F_OK), 0, int, "%d"); remove(filename); + end_call(marie, pauline); } ms_free(filename); linphone_core_manager_destroy(marie); @@ -3592,16 +3555,11 @@ static void video_call_snapshot(void) { #endif static void call_with_in_dialog_update(void) { - int begin; - int leaked_objects; LinphoneCoreManager* marie; LinphoneCoreManager* pauline; LinphoneCallParams *params; bool_t call_ok; - belle_sip_object_enable_leak_detector(TRUE); - begin=belle_sip_object_get_object_count(); - marie = linphone_core_manager_new( "marie_rc"); pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); BC_ASSERT_TRUE(call_ok=call(pauline,marie)); @@ -3621,25 +3579,14 @@ static void call_with_in_dialog_update(void) { end: linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); - - leaked_objects=belle_sip_object_get_object_count()-begin; - BC_ASSERT_EQUAL(leaked_objects, 0, int, "%d"); - if (leaked_objects>0){ - belle_sip_object_dump_active_objects(); - } } static void call_with_in_dialog_codec_change_base(bool_t no_sdp) { - int begin; - int leaked_objects; int dummy=0; LinphoneCoreManager* marie; LinphoneCoreManager* pauline; LinphoneCallParams *params; bool_t call_ok; - belle_sip_object_enable_leak_detector(TRUE); - begin=belle_sip_object_get_object_count(); - marie = linphone_core_manager_new( "marie_rc"); pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); BC_ASSERT_TRUE(call_ok=call(pauline,marie)); @@ -3670,12 +3617,6 @@ static void call_with_in_dialog_codec_change_base(bool_t no_sdp) { end: linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); - - leaked_objects=belle_sip_object_get_object_count()-begin; - BC_ASSERT_EQUAL(leaked_objects, 0, int, "%d"); - if (leaked_objects>0){ - belle_sip_object_dump_active_objects(); - } } static void call_with_in_dialog_codec_change(void) { call_with_in_dialog_codec_change_base(FALSE); @@ -3684,17 +3625,12 @@ static void call_with_in_dialog_codec_change_no_sdp(void) { call_with_in_dialog_codec_change_base(TRUE); } static void call_with_custom_supported_tags(void) { - int begin; - int leaked_objects; LinphoneCoreManager* marie; LinphoneCoreManager* pauline; const LinphoneCallParams *remote_params; const char *recv_supported; bool_t call_ok; - belle_sip_object_enable_leak_detector(TRUE); - begin=belle_sip_object_get_object_count(); - marie = linphone_core_manager_new( "marie_rc"); pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); @@ -3712,12 +3648,6 @@ static void call_with_custom_supported_tags(void) { end: linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); - - leaked_objects=belle_sip_object_get_object_count()-begin; - BC_ASSERT_EQUAL(leaked_objects, 0, int, "%d"); - if (leaked_objects>0){ - belle_sip_object_dump_active_objects(); - } } static void call_log_from_taken_from_p_asserted_id(void) { @@ -3882,16 +3812,11 @@ static void outgoing_reinvite_with_invalid_ack_sdp() { static void call_with_paused_no_sdp_on_resume() { - int begin; - int leaked_objects; int dummy=0; LinphoneCoreManager* marie; LinphoneCoreManager* pauline; LinphoneCall* call_marie = NULL; - belle_sip_object_enable_leak_detector(TRUE); - begin=belle_sip_object_get_object_count(); - marie = linphone_core_manager_new( "marie_rc"); pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); BC_ASSERT_TRUE(call(pauline,marie)); @@ -3931,12 +3856,6 @@ end: end_call(marie,pauline); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); - - leaked_objects=belle_sip_object_get_object_count()-begin; - BC_ASSERT_EQUAL(leaked_objects, 0, int, "%d"); - if (leaked_objects>0){ - belle_sip_object_dump_active_objects(); - } } static void early_media_without_sdp_in_200_base( bool_t use_video, bool_t use_ice ){ @@ -4027,17 +3946,12 @@ static void call_with_early_media_ice_and_no_sdp_in_200(){ } static void call_with_generic_cn(void) { - int begin; - int leaked_objects; LinphoneCoreManager* marie; LinphoneCoreManager* pauline; LinphoneCall *pauline_call; char *audio_file_with_silence=bc_tester_res("sounds/ahbahouaismaisbon.wav"); char *recorded_file=bc_tester_file("result.wav"); - belle_sip_object_enable_leak_detector(TRUE); - begin=belle_sip_object_get_object_count(); - marie = linphone_core_manager_new( "marie_rc"); pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); @@ -4076,11 +3990,6 @@ static void call_with_generic_cn(void) { linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); - leaked_objects=belle_sip_object_get_object_count()-begin; - BC_ASSERT_EQUAL(leaked_objects, 0, int, "%d"); - if (leaked_objects>0){ - belle_sip_object_dump_active_objects(); - } ms_free(audio_file_with_silence); ms_free(recorded_file); } @@ -4109,14 +4018,10 @@ void static call_state_changed_3(LinphoneCore *lc, LinphoneCall *call, LinphoneC static void call_with_transport_change_base(bool_t succesfull_call) { - int begin; - int leaked_objects; LCSipTransports sip_tr; LinphoneCoreManager* marie; LinphoneCoreManager* pauline; LinphoneCoreVTable * v_table; - belle_sip_object_enable_leak_detector(TRUE); - begin=belle_sip_object_get_object_count(); v_table = linphone_core_v_table_new(); v_table->call_state_changed=call_state_changed_2; marie = linphone_core_manager_new("marie_rc"); @@ -4146,13 +4051,6 @@ static void call_with_transport_change_base(bool_t succesfull_call) { } linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); - - leaked_objects=belle_sip_object_get_object_count()-begin; - BC_ASSERT_EQUAL(leaked_objects,0,int,"%d"); - if (leaked_objects>0){ - belle_sip_object_dump_active_objects(); - } - } static void call_with_transport_change_after_released(void) { call_with_transport_change_base(TRUE); @@ -4163,17 +4061,12 @@ static void unsucessfull_call_with_transport_change_after_released(void) { #ifdef VIDEO_ENABLED static void video_call_with_re_invite_inactive_followed_by_re_invite_base(LinphoneMediaEncryption mode, bool_t no_sdp) { - int begin; - int leaked_objects; LinphoneCoreManager* marie; LinphoneCoreManager* pauline; LinphoneCallParams *params; const LinphoneCallParams *current_params; MSList *lcs=NULL; - belle_sip_object_enable_leak_detector(TRUE); - begin=belle_sip_object_get_object_count(); - marie = linphone_core_manager_new( "marie_rc"); pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); linphone_core_set_avpf_mode(pauline->lc,TRUE); @@ -4226,12 +4119,6 @@ static void video_call_with_re_invite_inactive_followed_by_re_invite_base(Linpho end_call(marie,pauline); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); - - leaked_objects=belle_sip_object_get_object_count()-begin; - BC_ASSERT_EQUAL(leaked_objects, 0, int, "%d"); - if (leaked_objects>0){ - belle_sip_object_dump_active_objects(); - } } static void video_call_with_re_invite_inactive_followed_by_re_invite() { @@ -4271,8 +4158,6 @@ static void completion_cb(void *user_data, int percentage){ } static void simple_stereo_call(const char *codec_name, int clock_rate, int bitrate_override, bool_t stereo) { - int begin; - int leaked_objects; LinphoneCoreManager* marie; LinphoneCoreManager* pauline; PayloadType *pt; @@ -4280,9 +4165,6 @@ static void simple_stereo_call(const char *codec_name, int clock_rate, int bitra char *recordpath = bc_tester_file("stereo-record.wav"); bool_t audio_cmp_failed = FALSE; - belle_sip_object_enable_leak_detector(TRUE); - begin=belle_sip_object_get_object_count(); - marie = linphone_core_manager_new( "marie_rc"); pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); @@ -4341,12 +4223,6 @@ end: linphone_core_manager_destroy(pauline); ms_free(stereo_file); ms_free(recordpath); - - leaked_objects=belle_sip_object_get_object_count()-begin; - BC_ASSERT_EQUAL(leaked_objects, 0, int, "%d"); - if (leaked_objects>0){ - belle_sip_object_dump_active_objects(); - } } static void simple_stereo_call_l16(void){ @@ -4956,11 +4832,11 @@ static void call_logs_if_no_db_set() { LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* laure = linphone_core_manager_new("laure_call_logs_rc"); BC_ASSERT_TRUE(ms_list_size(laure->lc->call_logs) == 10); - + BC_ASSERT_TRUE(call(marie, laure)); wait_for_until(marie->lc, laure->lc, NULL, 5, 1000); end_call(marie, laure); - + BC_ASSERT_TRUE(ms_list_size(laure->lc->call_logs) == 11); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(laure); @@ -5023,7 +4899,7 @@ static void call_logs_sqlite_storage() { char *logs_db = create_filepath(bc_tester_get_writable_dir_prefix(), "call_logs", "db"); MSList *logs = NULL; LinphoneAddress *laure = NULL; - + unlink(logs_db); linphone_core_set_call_logs_database_path(marie->lc, logs_db); @@ -5041,7 +4917,7 @@ static void call_logs_sqlite_storage() { laure = linphone_address_new("\"Laure\" "); logs = linphone_core_get_call_history_for_address(marie->lc, laure); BC_ASSERT_TRUE(ms_list_size(logs) == 0); - ms_free(laure); + linphone_address_destroy(laure); logs = linphone_core_get_call_history_for_address(marie->lc, linphone_proxy_config_get_identity_address(linphone_core_get_default_proxy_config(pauline->lc))); BC_ASSERT_TRUE(ms_list_size(logs) == 1); @@ -5049,9 +4925,14 @@ static void call_logs_sqlite_storage() { ms_list_free_with_data(logs, (void (*)(void*))linphone_call_log_unref); BC_ASSERT_TRUE(linphone_core_get_call_history_size(marie->lc) == 0); + reset_counters(&marie->stat); + reset_counters(&pauline->stat); BC_ASSERT_TRUE(call(marie, pauline)); wait_for_until(marie->lc, pauline->lc, NULL, 5, 1000); end_call(marie, pauline); + + reset_counters(&marie->stat); + reset_counters(&pauline->stat); BC_ASSERT_TRUE(call(marie, pauline)); wait_for_until(marie->lc, pauline->lc, NULL, 5, 1000); end_call(marie, pauline); @@ -5213,5 +5094,5 @@ test_t call_tests[] = { #endif }; -test_suite_t call_test_suite = {"Single Call", NULL, NULL, liblinphone_tester_before_each, NULL, +test_suite_t call_test_suite = {"Single Call", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, sizeof(call_tests) / sizeof(call_tests[0]), call_tests}; diff --git a/tester/common/bc_tester_utils.c b/tester/common/bc_tester_utils.c index 7ad75eea0..92920f0b9 100644 --- a/tester/common/bc_tester_utils.c +++ b/tester/common/bc_tester_utils.c @@ -171,11 +171,11 @@ static void suite_complete_message_handler(const CU_pSuite pSuite, const CU_pFai static time_t test_start_time = 0; static void test_start_message_handler(const CU_pTest pTest, const CU_pSuite pSuite) { int suite_index = bc_tester_suite_index(pSuite->pName); - bc_tester_printf(bc_printf_verbosity_info,"Suite [%s] Test [%s] started", pSuite->pName,pTest->pName); - test_start_time = time(NULL); if (test_suite[suite_index]->before_each) { test_suite[suite_index]->before_each(); } + bc_tester_printf(bc_printf_verbosity_info,"Suite [%s] Test [%s] started", pSuite->pName,pTest->pName); + test_start_time = time(NULL); } /*derivated from cunit*/ @@ -187,10 +187,6 @@ static void test_complete_message_handler(const CU_pTest pTest, const CU_pSuite char buffer[2048]={0}; CU_pFailureRecord pFailure = pFailureList; - if (test_suite[suite_index]->after_each) { - test_suite[suite_index]->after_each(); - } - snprintf(result, sizeof(result), "Suite [%s] Test [%s] %s in %lu secs", pSuite->pName, pTest->pName, pFailure ? "failed" : "passed", (unsigned long)(time(NULL) - test_start_time)); if (pFailure) { @@ -202,7 +198,13 @@ static void test_complete_message_handler(const CU_pTest pTest, const CU_pSuite strncat(result, buffer, strlen(buffer)); } } - bc_tester_printf(bc_printf_verbosity_info,"%s\n", result); + bc_tester_printf(bc_printf_verbosity_info,"%s", result); + if (test_suite[suite_index]->after_each) { + test_suite[suite_index]->after_each(); + } + //insert empty line + bc_tester_printf(bc_printf_verbosity_info,""); + #ifdef __linux /* use mallinfo() to monitor allocated space. It is linux specific but other methods don't work: * setrlimit() RLIMIT_DATA doesn't count memory allocated via mmap() (which is used internally by malloc) @@ -326,19 +328,20 @@ void bc_tester_helper(const char *name, const char* additionnal_helper) { } static int file_exists(const char* root_path) { - FILE* file; - char * sounds_path = malloc(sizeof(char)*strlen(root_path)+strlen("sounds")); int found; - - sprintf(sounds_path, "%ssounds", root_path); - file = fopen(sounds_path, "r"); + FILE* file; + + char * res_path = malloc(sizeof(char)*(strlen(root_path)+strlen("/common/bc_completion")+1)); + sprintf(res_path, "%s/common/bc_completion", root_path); + file = fopen(res_path, "r"); found = (file != NULL); if (file) fclose(file); + free(res_path); return found; } static void detect_res_prefix(const char* prog) { - char* progpath = NULL; + char* progpath = strdup(prog); char* prefix = NULL; #if defined(BC_TESTER_WINDOWS_PHONE) || defined(BC_TESTER_WINDOWS_UNIVERSAL) @@ -353,25 +356,23 @@ static void detect_res_prefix(const char* prog) { bc_tester_set_writable_dir_prefix("./tmp"); #endif - if (strchr(prog, '/') != NULL) { + if (prog != NULL) { progpath = strdup(prog); - progpath[strrchr(prog, '/') - prog + 1] = '\0'; - } else if (strchr(prog, '\\') != NULL) { - progpath = strdup(prog); - progpath[strrchr(prog, '\\') - prog + 1] = '\0'; + if (strchr(prog, '/') != NULL) { + progpath[strrchr(prog, '/') - prog + 1] = '\0'; + } else if (strchr(prog, '\\') != NULL) { + progpath[strrchr(prog, '\\') - prog + 1] = '\0'; + } } if (file_exists(".")) { prefix = strdup("."); } else if (file_exists("..")) { prefix = strdup(".."); - } else if (file_exists(progpath)) { + } else if (progpath && file_exists(progpath)) { prefix = strdup(progpath); } - if (progpath != NULL) { - free(progpath); - } if (prefix != NULL) { if (bc_tester_resource_dir_prefix == NULL) { printf("Resource directory set to %s\n", prefix); @@ -383,9 +384,14 @@ static void detect_res_prefix(const char* prog) { } free(prefix); } else if (bc_tester_resource_dir_prefix == NULL || bc_tester_writable_dir_prefix == NULL) { + printf("Failed to detect resources for %s.\n", prog); printf("Could not find resource directory in %s! Please try again using option --resource-dir and/or --writable-dir.\n", progpath); abort(); } + + if (progpath != NULL) { + free(progpath); + } } void bc_tester_init(void (*ftester_printf)(int level, const char *fmt, va_list args), int iverbosity_info, int iverbosity_error) { diff --git a/tester/complex_sip_call_tester.c b/tester/complex_sip_call_tester.c index 66d311ef8..e610314d4 100644 --- a/tester/complex_sip_call_tester.c +++ b/tester/complex_sip_call_tester.c @@ -29,22 +29,22 @@ void check_rtcp(LinphoneCall *call) { MSTimeSpec ts; - + linphone_call_ref(call); liblinphone_tester_clock_start(&ts); - + do { if (linphone_call_get_audio_stats(call)->round_trip_delay > 0.0 && (!linphone_call_log_video_enabled(linphone_call_get_call_log(call)) || linphone_call_get_video_stats(call)->round_trip_delay > 0.0)) { break; } wait_for_until(call->core, NULL, NULL, 0, 20); /*just to sleep while iterating*/ } while (!liblinphone_tester_clock_elapsed(&ts, 15000)); - + BC_ASSERT_GREATER(linphone_call_get_audio_stats(call)->round_trip_delay, 0.0, float, "%f"); if (linphone_call_log_video_enabled(linphone_call_get_call_log(call))) { BC_ASSERT_GREATER(linphone_call_get_video_stats(call)->round_trip_delay, 0.0, float, "%f"); } - + linphone_call_unref(call); } @@ -57,9 +57,9 @@ static FILE *sip_start(const char *senario, const char* dest_username, LinphoneA dest = ms_strdup_printf("%s:%i",linphone_address_get_domain(dest_addres),linphone_address_get_port(dest_addres)); else dest = ms_strdup_printf("%s",linphone_address_get_domain(dest_addres)); - + command = ms_strdup_printf("sipp -sf %s -s %s %s -trace_err -trace_msg -rtp_echo -m 1 -d 1000",senario,dest_username,dest); - + ms_message("Starting sipp commad [%s]",command); file = popen(command, "r"); ms_free(command); @@ -124,18 +124,18 @@ static void call_with_audio_mline_before_video_in_sdp() { char *scen; FILE * sipp_out; LinphoneCall *call = NULL; - + /*currently we use direct connection because sipp do not properly set ACK request uri*/ mgr= linphone_core_manager_new2( "empty_rc", FALSE); mgr->identity = linphone_core_get_primary_contact_parsed(mgr->lc); linphone_address_set_username(mgr->identity,"marie"); identity_char = linphone_address_as_string(mgr->identity); linphone_core_set_primary_contact(mgr->lc,identity_char); - + linphone_core_iterate(mgr->lc); - + scen = bc_tester_res("sipp/call_with_audio_mline_before_video_in_sdp.xml"); - + sipp_out = sip_start(scen, linphone_address_get_username(mgr->identity), mgr->identity); if (sipp_out) { @@ -147,9 +147,9 @@ static void call_with_audio_mline_before_video_in_sdp() { BC_ASSERT_EQUAL(call->main_video_stream_index, 1, int, "%d"); BC_ASSERT_TRUE(call->main_text_stream_index > 1); BC_ASSERT_TRUE(linphone_call_log_video_enabled(linphone_call_get_call_log(call))); - + check_rtcp(call); - + BC_ASSERT_TRUE(wait_for(mgr->lc, mgr->lc, &mgr->stat.number_of_LinphoneCallEnd, 1)); pclose(sipp_out); } @@ -162,18 +162,18 @@ static void call_with_video_mline_before_audio_in_sdp() { char *scen; FILE * sipp_out; LinphoneCall *call = NULL; - + /*currently we use direct connection because sipp do not properly set ACK request uri*/ mgr= linphone_core_manager_new2( "empty_rc", FALSE); mgr->identity = linphone_core_get_primary_contact_parsed(mgr->lc); linphone_address_set_username(mgr->identity,"marie"); identity_char = linphone_address_as_string(mgr->identity); linphone_core_set_primary_contact(mgr->lc,identity_char); - + linphone_core_iterate(mgr->lc); - + scen = bc_tester_res("sipp/call_with_video_mline_before_audio_in_sdp.xml"); - + sipp_out = sip_start(scen, linphone_address_get_username(mgr->identity), mgr->identity); if (sipp_out) { @@ -185,9 +185,9 @@ static void call_with_video_mline_before_audio_in_sdp() { BC_ASSERT_EQUAL(call->main_video_stream_index, 0, int, "%d"); BC_ASSERT_TRUE(call->main_text_stream_index > 1); BC_ASSERT_TRUE(linphone_call_log_video_enabled(linphone_call_get_call_log(call))); - + check_rtcp(call); - + BC_ASSERT_TRUE(wait_for(mgr->lc, mgr->lc, &mgr->stat.number_of_LinphoneCallEnd, 1)); pclose(sipp_out); } @@ -200,18 +200,18 @@ static void call_with_multiple_audio_mline_in_sdp() { char *scen; FILE * sipp_out; LinphoneCall *call = NULL; - + /*currently we use direct connection because sipp do not properly set ACK request uri*/ mgr= linphone_core_manager_new2( "empty_rc", FALSE); mgr->identity = linphone_core_get_primary_contact_parsed(mgr->lc); linphone_address_set_username(mgr->identity,"marie"); identity_char = linphone_address_as_string(mgr->identity); linphone_core_set_primary_contact(mgr->lc,identity_char); - + linphone_core_iterate(mgr->lc); - + scen = bc_tester_res("sipp/call_with_multiple_audio_mline_in_sdp.xml"); - + sipp_out = sip_start(scen, linphone_address_get_username(mgr->identity), mgr->identity); if (sipp_out) { @@ -223,9 +223,9 @@ static void call_with_multiple_audio_mline_in_sdp() { BC_ASSERT_EQUAL(call->main_video_stream_index, 2, int, "%d"); BC_ASSERT_TRUE(call->main_text_stream_index > 2); BC_ASSERT_TRUE(linphone_call_log_video_enabled(linphone_call_get_call_log(call))); - + check_rtcp(call); - + BC_ASSERT_TRUE(wait_for(mgr->lc, mgr->lc, &mgr->stat.number_of_LinphoneCallEnd, 1)); pclose(sipp_out); } @@ -238,18 +238,18 @@ static void call_with_multiple_video_mline_in_sdp() { char *scen; FILE * sipp_out; LinphoneCall *call = NULL; - + /*currently we use direct connection because sipp do not properly set ACK request uri*/ mgr= linphone_core_manager_new2( "empty_rc", FALSE); mgr->identity = linphone_core_get_primary_contact_parsed(mgr->lc); linphone_address_set_username(mgr->identity,"marie"); identity_char = linphone_address_as_string(mgr->identity); linphone_core_set_primary_contact(mgr->lc,identity_char); - + linphone_core_iterate(mgr->lc); - + scen = bc_tester_res("sipp/call_with_multiple_video_mline_in_sdp.xml"); - + sipp_out = sip_start(scen, linphone_address_get_username(mgr->identity), mgr->identity); if (sipp_out) { @@ -261,9 +261,9 @@ static void call_with_multiple_video_mline_in_sdp() { BC_ASSERT_EQUAL(call->main_video_stream_index, 1, int, "%d"); BC_ASSERT_TRUE(call->main_text_stream_index > 3); BC_ASSERT_TRUE(linphone_call_log_video_enabled(linphone_call_get_call_log(call))); - + check_rtcp(call); - + BC_ASSERT_TRUE(wait_for(mgr->lc, mgr->lc, &mgr->stat.number_of_LinphoneCallEnd, 1)); pclose(sipp_out); } @@ -283,7 +283,7 @@ test_suite_t complex_sip_call_test_suite = { NULL, NULL, liblinphone_tester_before_each, - NULL, + liblinphone_tester_after_each, sizeof(tests) / sizeof(tests[0]), tests }; diff --git a/tester/dtmf_tester.c b/tester/dtmf_tester.c index d427d63a0..b8ce6a512 100644 --- a/tester/dtmf_tester.c +++ b/tester/dtmf_tester.c @@ -152,6 +152,7 @@ static void send_dtmfs_sequence_call_state_changed() { BC_ASSERT_PTR_NULL(pauline->stat.dtmf_list_received); } + end_call(marie, pauline); send_dtmf_cleanup(marie, pauline); } @@ -171,5 +172,5 @@ test_t dtmf_tests[] = { { "Send DTMF using RFC2833 using Opus",send_dtmf_rfc2833_opus}, }; -test_suite_t dtmf_test_suite = {"DTMF", NULL, NULL, liblinphone_tester_before_each, NULL, +test_suite_t dtmf_test_suite = {"DTMF", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, sizeof(dtmf_tests) / sizeof(dtmf_tests[0]), dtmf_tests}; diff --git a/tester/eventapi_tester.c b/tester/eventapi_tester.c index df88b245c..6fe95f730 100644 --- a/tester/eventapi_tester.c +++ b/tester/eventapi_tester.c @@ -367,5 +367,5 @@ test_t event_tests[] = { { "Publish without automatic refresh",publish_no_auto_test } }; -test_suite_t event_test_suite = {"Event", NULL, NULL, liblinphone_tester_before_each, NULL, +test_suite_t event_test_suite = {"Event", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, sizeof(event_tests) / sizeof(event_tests[0]), event_tests}; diff --git a/tester/flexisip_tester.c b/tester/flexisip_tester.c index 59b6bfe0c..50b90abff 100644 --- a/tester/flexisip_tester.c +++ b/tester/flexisip_tester.c @@ -654,8 +654,6 @@ static void call_with_sips_not_achievable(void){ } static void call_with_ipv6(void) { - int begin; - int leaked_objects; LinphoneCoreManager* marie; LinphoneCoreManager* pauline; LinphoneCall *pauline_call; @@ -668,9 +666,6 @@ static void call_with_ipv6(void) { return; } - belle_sip_object_enable_leak_detector(TRUE); - begin=belle_sip_object_get_object_count(); - liblinphone_tester_enable_ipv6(TRUE); marie = linphone_core_manager_new( "marie_rc"); pauline = linphone_core_manager_new( transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); @@ -703,11 +698,6 @@ static void call_with_ipv6(void) { linphone_core_manager_destroy(pauline); liblinphone_tester_enable_ipv6(FALSE); - leaked_objects=belle_sip_object_get_object_count()-begin; - BC_ASSERT_EQUAL(leaked_objects, 0, int, "%d"); - if (leaked_objects>0){ - belle_sip_object_dump_active_objects(); - } ortp_exit(); } @@ -763,7 +753,7 @@ static void file_transfer_message_rcs_to_external_body_client(void) { linphone_chat_message_cbs_set_file_transfer_send(cbs, tester_file_transfer_send); linphone_chat_room_send_chat_message(chat_room,message); BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageExtBodyReceived,1)); - + if (marie->stat.last_received_chat_message ) { cbs = linphone_chat_message_get_callbacks(marie->stat.last_received_chat_message); linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed); @@ -917,5 +907,5 @@ test_t flexisip_tests[] = { { "DoS module trigger by sending a lot of chat messages", dos_module_trigger } }; -test_suite_t flexisip_test_suite = {"Flexisip", NULL, NULL, liblinphone_tester_before_each, NULL, +test_suite_t flexisip_test_suite = {"Flexisip", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, sizeof(flexisip_tests) / sizeof(flexisip_tests[0]), flexisip_tests}; diff --git a/tester/liblinphone_tester.c b/tester/liblinphone_tester.c index 3a0628711..edf00e0b7 100644 --- a/tester/liblinphone_tester.c +++ b/tester/liblinphone_tester.c @@ -198,9 +198,9 @@ int main (int argc, char *argv[]) for(i = 1; i < argc; ++i) { if (strcmp(argv[i], "--verbose") == 0) { - linphone_core_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL); + linphone_core_set_log_level(ORTP_MESSAGE); } else if (strcmp(argv[i], "--silent") == 0) { - linphone_core_set_log_level_mask(ORTP_FATAL); + linphone_core_set_log_level(ORTP_FATAL); } else if (strcmp(argv[i],"--log-file")==0){ CHECK_ARG("--log-file", ++i, argc); log_file=fopen(argv[i],"w"); diff --git a/tester/liblinphone_tester.dSYM/Contents/Info.plist b/tester/liblinphone_tester.dSYM/Contents/Info.plist new file mode 100644 index 000000000..9d8e2a2f8 --- /dev/null +++ b/tester/liblinphone_tester.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.liblinphone_tester + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/tester/liblinphone_tester.dSYM/Contents/Resources/DWARF/liblinphone_tester b/tester/liblinphone_tester.dSYM/Contents/Resources/DWARF/liblinphone_tester new file mode 100644 index 000000000..00727e3d0 Binary files /dev/null and b/tester/liblinphone_tester.dSYM/Contents/Resources/DWARF/liblinphone_tester differ diff --git a/tester/liblinphone_tester.h b/tester/liblinphone_tester.h index 0d3dd5efb..7a6c9fb29 100644 --- a/tester/liblinphone_tester.h +++ b/tester/liblinphone_tester.h @@ -336,6 +336,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 liblinphone_tester_after_each(); void liblinphone_tester_init(void(*ftester_printf)(int level, const char *fmt, va_list args)); void liblinphone_tester_uninit(void); diff --git a/tester/log_collection_tester.c b/tester/log_collection_tester.c index d5b44d696..9b6c9b9b1 100644 --- a/tester/log_collection_tester.c +++ b/tester/log_collection_tester.c @@ -324,6 +324,6 @@ test_t log_collection_tests[] = { { "Upload collected traces", upload_collected_traces} }; -test_suite_t log_collection_test_suite = {"LogCollection", NULL, NULL, liblinphone_tester_before_each, NULL, +test_suite_t log_collection_test_suite = {"LogCollection", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, sizeof(log_collection_tests) / sizeof(log_collection_tests[0]), log_collection_tests}; diff --git a/tester/message_tester.c b/tester/message_tester.c index e91a268a7..3ad03538a 100644 --- a/tester/message_tester.c +++ b/tester/message_tester.c @@ -400,38 +400,22 @@ static void text_message_compatibility_mode(void) { } static void text_message_with_ack(void) { - int leaked_objects; - int begin; - LinphoneCoreManager* marie; - LinphoneCoreManager* pauline; - - belle_sip_object_enable_leak_detector(TRUE); - begin=belle_sip_object_get_object_count(); - - marie = linphone_core_manager_new( "marie_rc"); - pauline = linphone_core_manager_new( "pauline_tcp_rc"); - - { - LinphoneChatRoom* chat_room = linphone_core_get_chat_room(pauline->lc, marie->identity); - LinphoneChatMessage* msg = linphone_chat_room_create_message(chat_room,"Bli bli bli \n blu"); - LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(msg); - int dummy=0; - wait_for_until(marie->lc,pauline->lc,&dummy,1,100); /*just to have time to purge msg stored in the server*/ - reset_counters(&marie->stat); - reset_counters(&pauline->stat); - linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed); - linphone_chat_room_send_chat_message(chat_room,msg); - BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1)); - BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageDelivered,1)); - BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d"); - linphone_core_manager_destroy(marie); - linphone_core_manager_destroy(pauline); - } - leaked_objects=belle_sip_object_get_object_count()-begin; - BC_ASSERT_EQUAL(leaked_objects, 0, int, "%d"); - if (leaked_objects>0){ - belle_sip_object_dump_active_objects(); - } + LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); + LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc"); + LinphoneChatRoom* chat_room = linphone_core_get_chat_room(pauline->lc, marie->identity); + LinphoneChatMessage* msg = linphone_chat_room_create_message(chat_room,"Bli bli bli \n blu"); + LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(msg); + int dummy=0; + wait_for_until(marie->lc,pauline->lc,&dummy,1,100); /*just to have time to purge msg stored in the server*/ + reset_counters(&marie->stat); + reset_counters(&pauline->stat); + linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed); + linphone_chat_room_send_chat_message(chat_room,msg); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageDelivered,1)); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d"); + linphone_core_manager_destroy(marie); + linphone_core_manager_destroy(pauline); } static void text_message_with_external_body(void) { @@ -1027,7 +1011,6 @@ static void transfer_message_io_error_upload(void) { } static void transfer_message_io_error_download(void) { -#if 0 if (transport_supported(LinphoneTransportTls)) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneChatRoom* chat_room; @@ -1065,7 +1048,6 @@ static void transfer_message_io_error_download(void) { linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(marie); } -#endif } static void transfer_message_upload_cancelled(void) { @@ -1285,7 +1267,6 @@ static void file_transfer_2_messages_simultaneously() { } static void text_message_with_send_error(void) { -#if 0 LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc"); @@ -1326,7 +1307,6 @@ static void text_message_with_send_error(void) { linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); -#endif } static void text_message_denied(void) { @@ -1418,6 +1398,7 @@ static void info_message_with_args(bool_t with_content) { BC_ASSERT_EQUAL(linphone_content_get_size(content),strlen(info_content), int, "%d"); } } + end_call(marie, pauline); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } @@ -1689,56 +1670,54 @@ static void file_transfer_not_sent_if_url_moved_permanently() { } static void file_transfer_io_error_after_destroying_chatroom() { - ms_error("to be fixed"); - // file_transfer_io_error("https://www.linphone.org:444/lft.php", TRUE); + file_transfer_io_error("https://www.linphone.org:444/lft.php", TRUE); } test_t message_tests[] = { - {"Text message", text_message} - ,{"Text message within call's dialog", text_message_within_dialog} - ,{"Text message with credentials from auth info cb", text_message_with_credential_from_auth_cb} - ,{"Text message with privacy", text_message_with_privacy} - ,{"Text message compatibility mode", text_message_compatibility_mode} - ,{"Text message with ack", text_message_with_ack} - ,{"Text message with send error", text_message_with_send_error} - ,{"Text message with external body", text_message_with_external_body} - ,{"Transfer message", transfer_message} - ,{"Small transfer message", small_transfer_message} - ,{"Transfer message with io error at upload", transfer_message_io_error_upload} - ,{"Transfer message with io error at download", transfer_message_io_error_download} - ,{"Transfer message upload cancelled", transfer_message_upload_cancelled} - ,{"Transfer message download cancelled", transfer_message_download_cancelled} - ,{"Transfer message using external body url", file_transfer_using_external_body_url} - ,{"Transfer 2 messages simultaneously", file_transfer_2_messages_simultaneously} - ,{"Text message denied", text_message_denied} - ,{"Info message", info_message} - ,{"Info message with body", info_message_with_body} - ,{"IsComposing notification", is_composing_notification} + {"Text message", text_message}, + {"Text message within call's dialog", text_message_within_dialog}, + {"Text message with credentials from auth info cb", text_message_with_credential_from_auth_cb}, + {"Text message with privacy", text_message_with_privacy}, + {"Text message compatibility mode", text_message_compatibility_mode}, + {"Text message with ack", text_message_with_ack}, + {"Text message with send error", text_message_with_send_error}, + {"Text message with external body", text_message_with_external_body}, + {"Transfer message", transfer_message}, + {"Small transfer message", small_transfer_message}, + {"Transfer message with io error at upload", transfer_message_io_error_upload}, + {"Transfer message with io error at download", transfer_message_io_error_download}, + {"Transfer message upload cancelled", transfer_message_upload_cancelled}, + {"Transfer message download cancelled", transfer_message_download_cancelled}, + {"Transfer message using external body url", file_transfer_using_external_body_url}, + {"Transfer 2 messages simultaneously", file_transfer_2_messages_simultaneously}, + {"Text message denied", text_message_denied}, + {"Info message", info_message}, + {"Info message with body", info_message_with_body}, + {"IsComposing notification", is_composing_notification}, #ifdef HAVE_LIME - ,{"Lime text message", lime_text_message} - ,{"Lime transfer message", lime_transfer_message} - ,{"Lime transfer message encryption only", lime_transfer_message_without_encryption} - ,{"Lime unitary", lime_unit} + {"Lime text message", lime_text_message}, + {"Lime transfer message", lime_transfer_message}, + {"Lime transfer message encryption only", lime_transfer_message_without_encryption}, + {"Lime unitary", lime_unit}, #endif /* HAVE_LIME */ #ifdef MSG_STORAGE_ENABLED - ,{"Database migration", message_storage_migration} - ,{"History count", history_messages_count} - ,{"History range", history_range_full_test} + {"Database migration", message_storage_migration}, + {"History count", history_messages_count}, + {"History range", history_range_full_test}, #endif - ,{"Text status after destroying chat room", text_status_after_destroying_chat_room} - ,{"Transfer not sent if invalid url", file_transfer_not_sent_if_invalid_url} - ,{"Transfer not sent if host not found", file_transfer_not_sent_if_host_not_found} - ,{"Transfer not sent if url moved permanently", file_transfer_not_sent_if_url_moved_permanently} - ,{"Transfer io error after destroying chatroom", file_transfer_io_error_after_destroying_chatroom} - ,{ "Real Time Text base", rtt_text_message} - ,{ "Text status after destroying chat room", text_status_after_destroying_chat_room } + {"Text status after destroying chat room", text_status_after_destroying_chat_room}, + {"Transfer not sent if invalid url", file_transfer_not_sent_if_invalid_url}, + {"Transfer not sent if host not found", file_transfer_not_sent_if_host_not_found}, + {"Transfer not sent if url moved permanently", file_transfer_not_sent_if_url_moved_permanently}, + {"Transfer io error after destroying chatroom", file_transfer_io_error_after_destroying_chatroom}, + { "Real Time Text base", rtt_text_message}, }; test_suite_t message_test_suite = { - "Message", - NULL, - NULL, - liblinphone_tester_before_each, + "Message", NULL, + NULL, + liblinphone_tester_before_each, + liblinphone_tester_after_each, sizeof(message_tests) / sizeof(message_tests[0]), message_tests }; diff --git a/tester/multi_call_tester.c b/tester/multi_call_tester.c index a752ea6ef..e30220511 100644 --- a/tester/multi_call_tester.c +++ b/tester/multi_call_tester.c @@ -367,8 +367,11 @@ static void simple_call_transfer(void) { BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneTransferCallConnected,1,2000)); /*terminate marie to pauline call*/ - BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,2000)); - BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallReleased,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallReleased,1,2000)); + + end_call(marie, laure); + BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallReleased,1,2000)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -416,6 +419,7 @@ static void unattended_call_transfer(void) { BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,2000)); + end_call(laure, pauline); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(laure); @@ -454,6 +458,8 @@ static void unattended_call_transfer_with_error(void) { /*and call should be resumed*/ BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,2000)); + + end_call(marie, pauline); } linphone_core_manager_destroy(marie); @@ -474,7 +480,6 @@ static void call_transfer_existing_call_outgoing_call(void) { bool_t call_ok=TRUE; const MSList* calls; MSList* lcs=ms_list_append(NULL,marie->lc); - lcs=ms_list_append(lcs,pauline->lc); lcs=ms_list_append(lcs,laure->lc); @@ -530,17 +535,21 @@ static void call_transfer_existing_call_outgoing_call(void) { BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,2000)); BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,2,2000)); BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,1,2000)); - } + end_call(pauline, laure); + } linphone_core_manager_destroy(marie); - linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(laure); + linphone_core_manager_destroy(pauline); ms_list_free(lcs); } test_t multi_call_tests[] = { { "Call waiting indication", call_waiting_indication }, { "Call waiting indication with privacy", call_waiting_indication_with_privacy }, + { "Incoming call accepted when outgoing call in progress",incoming_call_accepted_when_outgoing_call_in_progress}, + { "Incoming call accepted when outgoing call in outgoing ringing",incoming_call_accepted_when_outgoing_call_in_outgoing_ringing}, + { "Incoming call accepted when outgoing call in outgoing ringing early media",incoming_call_accepted_when_outgoing_call_in_outgoing_ringing_early_media}, { "Simple conference", simple_conference }, { "Simple conference with ICE",simple_conference_with_ice}, { "Simple ZRTP conference with ICE",simple_zrtp_conference_with_ice}, @@ -548,10 +557,7 @@ test_t multi_call_tests[] = { { "Unattended call transfer", unattended_call_transfer }, { "Unattended call transfer with error", unattended_call_transfer_with_error }, { "Call transfer existing call outgoing call", call_transfer_existing_call_outgoing_call }, - { "Incoming call accepted when outgoing call in progress",incoming_call_accepted_when_outgoing_call_in_progress}, - { "Incoming call accepted when outgoing call in outgoing ringing",incoming_call_accepted_when_outgoing_call_in_outgoing_ringing}, - { "Incoming call accepted when outgoing call in outgoing ringing early media",incoming_call_accepted_when_outgoing_call_in_outgoing_ringing_early_media}, }; -test_suite_t multi_call_test_suite = {"Multi call", NULL, NULL, liblinphone_tester_before_each, NULL, +test_suite_t multi_call_test_suite = {"Multi call", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, sizeof(multi_call_tests) / sizeof(multi_call_tests[0]), multi_call_tests}; diff --git a/tester/multicast_call_tester.c b/tester/multicast_call_tester.c index 549c6b2ed..5552269a4 100644 --- a/tester/multicast_call_tester.c +++ b/tester/multicast_call_tester.c @@ -24,12 +24,8 @@ static void call_multicast_base(bool_t video) { LinphoneCoreManager *marie, *pauline; - int begin; - int leaked_objects; LinphoneVideoPolicy marie_policy, pauline_policy; - belle_sip_object_enable_leak_detector(TRUE); - begin=belle_sip_object_get_object_count(); marie = linphone_core_manager_new( "marie_rc"); pauline = linphone_core_manager_new( "pauline_tcp_rc"); @@ -67,14 +63,6 @@ static void call_multicast_base(bool_t video) { } linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); - - leaked_objects=belle_sip_object_get_object_count()-begin; - BC_ASSERT_EQUAL(leaked_objects, 0, int, "%d"); - if (leaked_objects>0){ - belle_sip_object_dump_active_objects(); - } - belle_sip_object_enable_leak_detector(FALSE); - } static void call_multicast(void) { @@ -92,14 +80,10 @@ static void early_media_with_multicast_base(bool_t video) { LinphoneCoreManager *marie, *pauline, *pauline2; MSList* lcs = NULL; int dummy=0; - int leaked_objects; - int begin; LinphoneVideoPolicy marie_policy, pauline_policy; LpConfig *marie_lp; LinphoneCallParams *params; - belle_sip_object_enable_leak_detector(TRUE); - begin=belle_sip_object_get_object_count(); marie = linphone_core_manager_new("marie_rc"); pauline = linphone_core_manager_new("pauline_tcp_rc"); pauline2 = linphone_core_manager_new("pauline_tcp_rc"); @@ -237,13 +221,6 @@ static void early_media_with_multicast_base(bool_t video) { linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(pauline2); - - leaked_objects=belle_sip_object_get_object_count()-begin; - BC_ASSERT_EQUAL(leaked_objects,0, int, "%d"); - if (leaked_objects>0){ - belle_sip_object_dump_active_objects(); - } - belle_sip_object_enable_leak_detector(FALSE); } static void early_media_with_multicast_audio() { @@ -269,6 +246,6 @@ test_t multicast_call_tests[] = { #endif }; -test_suite_t multicast_call_test_suite = {"Multicast Call", NULL, NULL, liblinphone_tester_before_each, NULL, +test_suite_t multicast_call_test_suite = {"Multicast Call", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, sizeof(multicast_call_tests) / sizeof(multicast_call_tests[0]), multicast_call_tests}; diff --git a/tester/offeranswer_tester.c b/tester/offeranswer_tester.c index cdffe306d..53267d68e 100644 --- a/tester/offeranswer_tester.c +++ b/tester/offeranswer_tester.c @@ -70,15 +70,10 @@ static void check_payload_type_numbers(LinphoneCall *call1, LinphoneCall *call2, } static void simple_call_with_different_codec_mappings(void) { - int begin; - int leaked_objects; LinphoneCoreManager* marie; LinphoneCoreManager* pauline; LinphoneCall *pauline_call; - belle_sip_object_enable_leak_detector(TRUE); - begin=belle_sip_object_get_object_count(); - marie = linphone_core_manager_new( "marie_rc"); pauline = linphone_core_manager_new( "pauline_tcp_rc"); @@ -111,46 +106,28 @@ static void simple_call_with_different_codec_mappings(void) { end_call(marie,pauline); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); - - leaked_objects=belle_sip_object_get_object_count()-begin; - BC_ASSERT_EQUAL(leaked_objects, 0, int, "%d"); - if (leaked_objects>0){ - belle_sip_object_dump_active_objects(); - } } static void call_failed_because_of_codecs(void) { - int begin,leaked_objects; + LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); + LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc"); + LinphoneCall* out_call; - belle_sip_object_enable_leak_detector(TRUE); - begin=belle_sip_object_get_object_count(); + disable_all_audio_codecs_except_one(marie->lc,"pcmu",-1); + disable_all_audio_codecs_except_one(pauline->lc,"pcma",-1); + out_call = linphone_core_invite_address(pauline->lc,marie->identity); + linphone_call_ref(out_call); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallOutgoingInit,1)); - { - LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); - LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc"); - LinphoneCall* out_call; + /*flexisip will retain the 488 until the "urgent reply" timeout (I.E 5s) arrives.*/ + BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallError,1,7000)); + BC_ASSERT_EQUAL(linphone_call_get_reason(out_call),LinphoneReasonNotAcceptable, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallIncomingReceived,0, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallReleased,0, int, "%d"); - disable_all_audio_codecs_except_one(marie->lc,"pcmu",-1); - disable_all_audio_codecs_except_one(pauline->lc,"pcma",-1); - out_call = linphone_core_invite_address(pauline->lc,marie->identity); - linphone_call_ref(out_call); - BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallOutgoingInit,1)); - - /*flexisip will retain the 488 until the "urgent reply" timeout (I.E 5s) arrives.*/ - BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallError,1,7000)); - BC_ASSERT_EQUAL(linphone_call_get_reason(out_call),LinphoneReasonNotAcceptable, int, "%d"); - BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallIncomingReceived,0, int, "%d"); - BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallReleased,0, int, "%d"); - - linphone_call_unref(out_call); - linphone_core_manager_destroy(marie); - linphone_core_manager_destroy(pauline); - } - leaked_objects=belle_sip_object_get_object_count()-begin; - BC_ASSERT_EQUAL(leaked_objects, 0, int, "%d"); - if (leaked_objects>0){ - belle_sip_object_dump_active_objects(); - } + linphone_call_unref(out_call); + linphone_core_manager_destroy(marie); + linphone_core_manager_destroy(pauline); } @@ -417,5 +394,5 @@ static test_t offeranswer_tests[] = { #endif }; -test_suite_t offeranswer_test_suite = {"Offer-answer", NULL, NULL, liblinphone_tester_before_each, NULL, +test_suite_t offeranswer_test_suite = {"Offer-answer", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, sizeof(offeranswer_tests) / sizeof(offeranswer_tests[0]), offeranswer_tests}; diff --git a/tester/player_tester.c b/tester/player_tester.c index e8458e9d7..4edc2290b 100644 --- a/tester/player_tester.c +++ b/tester/player_tester.c @@ -82,5 +82,5 @@ test_t player_tests[] = { { "Local MKV file" , playing_test } }; -test_suite_t player_test_suite = {"Player", NULL, NULL, liblinphone_tester_before_each, NULL, +test_suite_t player_test_suite = {"Player", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, sizeof(player_tests) / sizeof(test_t), player_tests}; diff --git a/tester/presence_tester.c b/tester/presence_tester.c index f72acb736..557cc3619 100644 --- a/tester/presence_tester.c +++ b/tester/presence_tester.c @@ -482,5 +482,5 @@ test_t presence_tests[] = { #endif }; -test_suite_t presence_test_suite = {"Presence", NULL, NULL, liblinphone_tester_before_each, NULL, +test_suite_t presence_test_suite = {"Presence", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, sizeof(presence_tests) / sizeof(presence_tests[0]), presence_tests}; diff --git a/tester/proxy_config_tester.c b/tester/proxy_config_tester.c index baf874be1..46b374ee4 100644 --- a/tester/proxy_config_tester.c +++ b/tester/proxy_config_tester.c @@ -108,5 +108,5 @@ test_t proxy_config_tests[] = { { "SIP URI normalization", sip_uri_normalization }, }; -test_suite_t proxy_config_test_suite = {"Proxy config", NULL, NULL, liblinphone_tester_before_each, NULL, +test_suite_t proxy_config_test_suite = {"Proxy config", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, sizeof(proxy_config_tests) / sizeof(proxy_config_tests[0]), proxy_config_tests}; diff --git a/tester/quality_reporting_tester.c b/tester/quality_reporting_tester.c index 57b63a3f9..f7d9c08e6 100644 --- a/tester/quality_reporting_tester.c +++ b/tester/quality_reporting_tester.c @@ -158,6 +158,7 @@ static void quality_reporting_not_used_without_config() { // but not this one since it is updated at the end of call BC_ASSERT_PTR_NULL(call_marie->log->reporting.reports[0]->dialog_id); } + end_call(marie, pauline); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } @@ -190,7 +191,6 @@ static void quality_reporting_not_sent_if_call_not_started() { // since the callee was busy, there should be no publish to do BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishProgress,0, int, "%d"); BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0, int, "%d"); - end: linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -211,6 +211,7 @@ static void quality_reporting_not_sent_if_low_bandwidth() { BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0, int, "%d"); } linphone_call_params_destroy(marie_params); + end_call(marie, pauline); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } @@ -287,6 +288,7 @@ static void quality_reporting_interval_report() { BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishProgress,1,60000)); BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishOk,1,60000)); } + end_call(marie, pauline); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } @@ -334,6 +336,7 @@ static void quality_reporting_session_report_if_video_stopped() { linphone_call_params_destroy(marie_params); linphone_call_params_destroy(pauline_params); + end_call(marie, pauline); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } @@ -383,6 +386,6 @@ test_t quality_reporting_tests[] = { { "Sent using custom route", quality_reporting_sent_using_custom_route}, }; -test_suite_t quality_reporting_test_suite = {"QualityReporting", NULL, NULL, liblinphone_tester_before_each, NULL, +test_suite_t quality_reporting_test_suite = {"QualityReporting", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, sizeof(quality_reporting_tests) / sizeof(quality_reporting_tests[0]), quality_reporting_tests}; diff --git a/tester/register_tester.c b/tester/register_tester.c index 890c4088a..f4f4b31d4 100644 --- a/tester/register_tester.c +++ b/tester/register_tester.c @@ -136,7 +136,7 @@ static void register_with_refresh_base_3(LinphoneCore* lc } else /*checking to be done outside this functions*/ BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0, int, "%d"); - + linphone_proxy_config_destroy(proxy_cfg); } static void register_with_refresh_base_2(LinphoneCore* lc @@ -396,18 +396,19 @@ static void authenticated_register_with_provided_credentials(){ linphone_proxy_config_set_route(cfg, test_route); linphone_proxy_config_set_server_addr(cfg,test_route); linphone_address_destroy(from); - + ai = linphone_auth_info_new(test_username, NULL, test_password, NULL, NULL, NULL); linphone_core_add_auth_info(lcm->lc, ai); linphone_core_add_proxy_config(lcm->lc, cfg); - + BC_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,1)); BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,0, int, "%d"); - + BC_ASSERT_PTR_NULL(lp_config_get_string(lcm->lc->config, "auth_info_0", "passwd", NULL)); BC_ASSERT_PTR_NOT_NULL(lp_config_get_string(lcm->lc->config, "auth_info_0", "ha1", NULL)); - + + linphone_proxy_config_destroy(cfg); linphone_core_manager_destroy(lcm); } @@ -540,8 +541,8 @@ static void network_state_change(){ static int get_number_of_udp_proxy(const LinphoneCore* lc) { int number_of_udp_proxy=0; LinphoneProxyConfig* proxy_cfg; - MSList* proxys; - for (proxys=(MSList*)linphone_core_get_proxy_config_list(lc);proxys!=NULL;proxys=proxys->next) { + const MSList* proxys; + for (proxys=linphone_core_get_proxy_config_list(lc);proxys!=NULL;proxys=proxys->next) { proxy_cfg=(LinphoneProxyConfig*)proxys->data; if (strcmp("udp",linphone_proxy_config_get_transport(proxy_cfg))==0) number_of_udp_proxy++; @@ -935,5 +936,5 @@ test_t register_tests[] = { { "Simple redirect", redirect} }; -test_suite_t register_test_suite = {"Register", NULL, NULL, liblinphone_tester_before_each, NULL, +test_suite_t register_test_suite = {"Register", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, sizeof(register_tests) / sizeof(register_tests[0]), register_tests}; diff --git a/tester/remote_provisioning_tester.c b/tester/remote_provisioning_tester.c index 02e4e8452..51203ae5f 100644 --- a/tester/remote_provisioning_tester.c +++ b/tester/remote_provisioning_tester.c @@ -134,6 +134,6 @@ test_t remote_provisioning_tests[] = { { "Remote provisioning invalid URI", remote_provisioning_invalid_uri } }; -test_suite_t remote_provisioning_test_suite = {"RemoteProvisioning", NULL, NULL, liblinphone_tester_before_each, NULL, +test_suite_t remote_provisioning_test_suite = {"RemoteProvisioning", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, sizeof(remote_provisioning_tests) / sizeof(remote_provisioning_tests[0]), remote_provisioning_tests}; diff --git a/tester/setup_tester.c b/tester/setup_tester.c index ffb8b550f..06b82593e 100644 --- a/tester/setup_tester.c +++ b/tester/setup_tester.c @@ -189,6 +189,8 @@ void linphone_proxy_config_address_equal_test() { linphone_address_destroy(b); linphone_address_destroy(c); linphone_address_destroy(d); + linphone_address_destroy(e); + linphone_address_destroy(f); } void linphone_proxy_config_is_server_config_changed_test() { @@ -306,5 +308,5 @@ test_t setup_tests[] = { { "Codec usability", codec_usability_test } }; -test_suite_t setup_test_suite = {"Setup", NULL, NULL, liblinphone_tester_before_each, NULL, +test_suite_t setup_test_suite = {"Setup", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, sizeof(setup_tests) / sizeof(setup_tests[0]), setup_tests}; diff --git a/tester/stun_tester.c b/tester/stun_tester.c index cf8eee8f3..d0753bf23 100644 --- a/tester/stun_tester.c +++ b/tester/stun_tester.c @@ -119,5 +119,5 @@ test_t stun_tests[] = { { "STUN encode buffer protection", linphone_stun_test_encode }, }; -test_suite_t stun_test_suite = {"Stun", NULL, NULL, liblinphone_tester_before_each, NULL, +test_suite_t stun_test_suite = {"Stun", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, sizeof(stun_tests) / sizeof(stun_tests[0]), stun_tests}; diff --git a/tester/tester.c b/tester/tester.c index 85ce01d20..2d0431abb 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -36,7 +36,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; int manager_count = 0; - +int leaked_objects_count = 0; const MSAudioDiffParams audio_cmp_params = {10,2000}; const char* test_domain="sipopen.example.org"; @@ -376,6 +376,10 @@ void linphone_core_manager_destroy(LinphoneCoreManager* mgr) { unlink(record_file); } } + + if (ms_list_size(mgr->lc->calls) != 0) { + ms_fatal("%s(): There are still %d calls pending, please terminates them before invoking me", __FUNCTION__, ms_list_size(mgr->lc->calls) ); + } linphone_core_destroy(mgr->lc); } if (mgr->identity) linphone_address_destroy(mgr->identity); @@ -480,9 +484,21 @@ int linphone_core_manager_get_mean_audio_up_bw(const LinphoneCoreManager *mgr) { } void liblinphone_tester_before_each() { + belle_sip_object_enable_leak_detector(TRUE); + leaked_objects_count = belle_sip_object_get_object_count(); +} + +void liblinphone_tester_after_each() { + int leaked_objects = belle_sip_object_get_object_count() - leaked_objects_count; + // this will NOT be counted in tests fail but at least it will be shown + BC_ASSERT_EQUAL(leaked_objects, 0, int, "%d"); + if (leaked_objects > 0) { + belle_sip_object_dump_active_objects(); + ms_error("%d objects were leaked in latest test, please fix that!", leaked_objects); + } + if (manager_count != 0) { - // crash in some linphone core have not been destroyed because if we continue - // it will crash in CUnit AND we should NEVER keep a manager alive ms_fatal("%d linphone core managers are still alive!", manager_count); } } + diff --git a/tester/tunnel_tester.c b/tester/tunnel_tester.c index 7dd32631c..f3d383cf2 100644 --- a/tester/tunnel_tester.c +++ b/tester/tunnel_tester.c @@ -262,5 +262,5 @@ test_t tunnel_tests[] = { #endif }; -test_suite_t tunnel_test_suite = {"Tunnel", NULL, NULL, liblinphone_tester_before_each, NULL, +test_suite_t tunnel_test_suite = {"Tunnel", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, sizeof(tunnel_tests) / sizeof(tunnel_tests[0]), tunnel_tests}; diff --git a/tester/upnp_tester.c b/tester/upnp_tester.c index e17e1e287..1b99f4ba1 100644 --- a/tester/upnp_tester.c +++ b/tester/upnp_tester.c @@ -59,5 +59,5 @@ test_t upnp_tests[] = { { "Check ip address", upnp_check_ipaddress }, }; -test_suite_t upnp_test_suite = {"Upnp", NULL, NULL, liblinphone_tester_before_each, NULL, +test_suite_t upnp_test_suite = {"Upnp", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, sizeof(upnp_tests) / sizeof(upnp_tests[0]), upnp_tests}; diff --git a/tester/video_tester.c b/tester/video_tester.c index 918529fdc..82232cec1 100644 --- a/tester/video_tester.c +++ b/tester/video_tester.c @@ -552,7 +552,7 @@ test_t video_tests[] = { }; -test_suite_t video_test_suite = {"Video", NULL, NULL, liblinphone_tester_before_each, NULL, +test_suite_t video_test_suite = {"Video", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, sizeof(video_tests) / sizeof(video_tests[0]), video_tests}; #endif /* VIDEO_ENABLED */