forked from mirrors/linphone-iphone
Get same instance id across all message tests to prevent receiving messages from a previous test because of forking.
This commit is contained in:
parent
44de032c86
commit
db52ddaa09
4 changed files with 32 additions and 7 deletions
|
|
@ -27,6 +27,7 @@ struct _Account{
|
|||
int done;
|
||||
int created;
|
||||
char *phone_alias;
|
||||
char *uuid;
|
||||
};
|
||||
|
||||
typedef struct _Account Account;
|
||||
|
|
@ -49,6 +50,7 @@ static Account *account_new(LinphoneAddress *identity, const char *unique_id){
|
|||
};
|
||||
|
||||
void account_destroy(Account *obj){
|
||||
if (obj->uuid) bctbx_free(obj->uuid);
|
||||
linphone_address_unref(obj->identity);
|
||||
linphone_address_unref(obj->modified_identity);
|
||||
ms_free(obj->password);
|
||||
|
|
@ -198,7 +200,7 @@ void account_create_on_server(Account *account, const LinphoneProxyConfig *refcf
|
|||
ms_free(chatdb);
|
||||
}
|
||||
|
||||
static LinphoneAddress *account_manager_check_account(AccountManager *m, LinphoneProxyConfig *cfg,const char* phone_alias){
|
||||
static LinphoneAddress *account_manager_check_account(AccountManager *m, LinphoneProxyConfig *cfg, LinphoneCoreManager *cm){
|
||||
LinphoneCore *lc=linphone_proxy_config_get_core(cfg);
|
||||
const char *identity=linphone_proxy_config_get_identity(cfg);
|
||||
LinphoneAddress *id_addr=linphone_address_new(identity);
|
||||
|
|
@ -209,6 +211,7 @@ static LinphoneAddress *account_manager_check_account(AccountManager *m, Linphon
|
|||
,NULL
|
||||
, linphone_address_get_username(id_addr)
|
||||
, linphone_address_get_domain(id_addr));
|
||||
const char *phone_alias = cm->phone_alias;
|
||||
|
||||
if (!account||(phone_alias&&(!account->phone_alias||strcmp(phone_alias,account->phone_alias)!=0))){
|
||||
if (account) {
|
||||
|
|
@ -229,6 +232,16 @@ static LinphoneAddress *account_manager_check_account(AccountManager *m, Linphon
|
|||
account_create_on_server(account,cfg,phone_alias);
|
||||
}
|
||||
|
||||
if (liblinphone_tester_keep_uuid) {
|
||||
/* create and/or set uuid */
|
||||
if (account->uuid == NULL) {
|
||||
char tmp[64];
|
||||
sal_create_uuid(cm->lc->sal, tmp, sizeof(tmp));
|
||||
account->uuid = bctbx_strdup(tmp);
|
||||
}
|
||||
sal_set_uuid(cm->lc->sal, account->uuid);
|
||||
}
|
||||
|
||||
/*remove previous auth info to avoid mismatching*/
|
||||
if (original_ai)
|
||||
linphone_core_remove_auth_info(lc,original_ai);
|
||||
|
|
@ -251,7 +264,7 @@ void linphone_core_manager_check_accounts(LinphoneCoreManager *m){
|
|||
if (!liblinphonetester_show_account_manager_logs) linphone_core_set_log_level_mask(ORTP_ERROR|ORTP_FATAL);
|
||||
for(it=linphone_core_get_proxy_config_list(m->lc);it!=NULL;it=it->next){
|
||||
LinphoneProxyConfig *cfg=(LinphoneProxyConfig *)it->data;
|
||||
account_manager_check_account(am,cfg,m->phone_alias);
|
||||
account_manager_check_account(am,cfg,m);
|
||||
}
|
||||
if (!liblinphonetester_show_account_manager_logs) linphone_core_set_log_level_mask(logmask);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@ extern const char* test_username;
|
|||
extern const char* test_password;
|
||||
extern const char* test_route;
|
||||
extern const char* userhostsfile;
|
||||
extern bool_t liblinphone_tester_keep_uuid;
|
||||
extern bool_t liblinphone_tester_tls_support_disabled;
|
||||
extern const MSAudioDiffParams audio_cmp_params;
|
||||
extern const char *liblinphone_tester_mire_id;
|
||||
|
|
|
|||
|
|
@ -2428,7 +2428,7 @@ test_t message_tests[] = {
|
|||
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_NO_TAG("Transfer message download cancelled", transfer_message_download_cancelled),
|
||||
TEST_ONE_TAG("Transfer message using external body url", file_transfer_using_external_body_url, "LeaksMemory"),
|
||||
TEST_NO_TAG("Transfer message using external body url", file_transfer_using_external_body_url),
|
||||
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),
|
||||
|
|
@ -2488,10 +2488,20 @@ test_t message_tests[] = {
|
|||
TEST_NO_TAG("IM Encryption Engine b64", im_encryption_engine_b64)
|
||||
};
|
||||
|
||||
static int message_tester_before_suite(void) {
|
||||
liblinphone_tester_keep_uuid = TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int message_tester_after_suite(void) {
|
||||
liblinphone_tester_keep_uuid = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
test_suite_t message_test_suite = {
|
||||
"Message",
|
||||
NULL,
|
||||
NULL,
|
||||
message_tester_before_suite,
|
||||
message_tester_after_suite,
|
||||
liblinphone_tester_before_each,
|
||||
liblinphone_tester_after_each,
|
||||
sizeof(message_tests) / sizeof(message_tests[0]), message_tests
|
||||
|
|
|
|||
|
|
@ -44,8 +44,9 @@
|
|||
|
||||
|
||||
static int liblinphone_tester_keep_accounts_flag = 0;
|
||||
static int liblinphone_tester_keep_record_files = FALSE;
|
||||
static int liblinphone_tester_leak_detector_disabled = FALSE;
|
||||
static bool_t liblinphone_tester_keep_record_files = FALSE;
|
||||
static bool_t liblinphone_tester_leak_detector_disabled = FALSE;
|
||||
bool_t liblinphone_tester_keep_uuid = FALSE;
|
||||
bool_t liblinphone_tester_tls_support_disabled = FALSE;
|
||||
int manager_count = 0;
|
||||
int leaked_objects_count = 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue