diff --git a/tester/presence_tester.c b/tester/presence_tester.c index 40d9b927a..d55515b8e 100644 --- a/tester/presence_tester.c +++ b/tester/presence_tester.c @@ -193,10 +193,10 @@ static void simple_publish_with_expire(int expires) { BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphonePublishProgress,4)); BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphonePublishOk,4)); - linphone_core_manager_destroy(marie); - /*fixme we should wait untill 200okBC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishCleared,2,int,"%i");*/ + linphone_core_manager_stop(marie); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishCleared,2,int,"%i"); BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,4,int,"%i"); - + linphone_core_manager_destroy(marie); } static void simple_publish(void) { diff --git a/tester/tester.c b/tester/tester.c index 48a06936f..5a4393003 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -422,8 +422,22 @@ LinphoneCoreManager* linphone_core_manager_new( const char* rc_file) { void linphone_core_manager_stop(LinphoneCoreManager *mgr){ if (mgr->lc) { + const char *record_file = linphone_core_get_record_file(mgr->lc); + char *chatdb = ms_strdup(linphone_core_get_chat_database_path(mgr->lc)); + if (!liblinphone_tester_keep_record_files && record_file) { + if ((bc_get_number_of_failures() - mgr->number_of_bcunit_error_at_creation)>0) { + ms_error("Test has failed, keeping recorded file [%s]", record_file); + } + else { + unlink(record_file); + } + } linphone_core_destroy(mgr->lc); - mgr->lc=NULL; + if (chatdb) { + unlink(chatdb); + ms_free(chatdb); + } + mgr->lc = NULL; } } @@ -437,22 +451,6 @@ void linphone_core_manager_uninit(LinphoneCoreManager *mgr) { linphone_chat_message_unref(mgr->stat.last_received_chat_message); } if (mgr->stat.last_received_info_message) linphone_info_message_destroy(mgr->stat.last_received_info_message); - if (mgr->lc){ - const char *record_file=linphone_core_get_record_file(mgr->lc); - char *chatdb = ms_strdup(linphone_core_get_chat_database_path(mgr->lc)); - if (!liblinphone_tester_keep_record_files && record_file){ - if ((bc_get_number_of_failures()-mgr->number_of_bcunit_error_at_creation)>0) { - ms_error("Test has failed, keeping recorded file [%s]",record_file); - } else { - unlink(record_file); - } - } - linphone_core_destroy(mgr->lc); - if (chatdb) { - unlink(chatdb); - ms_free(chatdb); - } - } if (mgr->identity) { linphone_address_destroy(mgr->identity); } @@ -472,6 +470,7 @@ void linphone_core_manager_wait_for_stun_resolution(LinphoneCoreManager *mgr) { } void linphone_core_manager_destroy(LinphoneCoreManager* mgr) { + linphone_core_manager_stop(mgr); linphone_core_manager_uninit(mgr); ms_free(mgr); }