Commit f58754fd authored by Simon Morlat's avatar Simon Morlat

fix removal of chatdb and record files after succesfull tests.

parent 6e15e3b9
......@@ -132,11 +132,13 @@ void account_create_on_server(Account *account, const LinphoneProxyConfig *refcf
char *tmp;
LinphoneAddress *server_addr;
LCSipTransports tr;
char *chatdb;
vtable.registration_state_changed=account_created_on_server_cb;
// TEMPORARY CODE: remove line below when flexisip is updated, this is not needed anymore!
vtable.auth_info_requested=account_created_auth_requested_cb;
lc=configure_lc_from(&vtable,bc_tester_get_resource_dir_prefix(),NULL,account);
chatdb = ms_strdup(linphone_core_get_chat_database_path(lc));
tr.udp_port=LC_SIP_TRANSPORT_RANDOM;
tr.tcp_port=LC_SIP_TRANSPORT_RANDOM;
tr.tls_port=LC_SIP_TRANSPORT_RANDOM;
......@@ -192,6 +194,8 @@ void account_create_on_server(Account *account, const LinphoneProxyConfig *refcf
ms_error("Account creation could not clean the registration context.");
}
linphone_core_destroy(lc);
unlink(chatdb);
ms_free(chatdb);
}
static LinphoneAddress *account_manager_check_account(AccountManager *m, LinphoneProxyConfig *cfg,const char* phone_alias){
......
......@@ -428,7 +428,7 @@ 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 && ortp_file_exist(record_file)) {
if (!liblinphone_tester_keep_record_files && record_file && ortp_file_exist(record_file)==0) {
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);
}
......@@ -438,7 +438,9 @@ void linphone_core_manager_stop(LinphoneCoreManager *mgr){
}
linphone_core_destroy(mgr->lc);
if (chatdb) {
unlink(chatdb);
if (unlink(chatdb) != 0){
ms_error("Could not delete %s: %s", chatdb, strerror(errno));
}
ms_free(chatdb);
}
mgr->lc = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment