tester: add before_each / after_each methods to check memory leaks and fix various ones

parent ffd02956
......@@ -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"
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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;
......
......@@ -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");
......
......@@ -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){
......
mediastreamer2 @ e4bbeb21
Subproject commit 843ae9c9e37959222dc647f998a5e92bf6f80eaf
Subproject commit e4bbeb2123bd501b90ccfee958a4e20d3eebbf24
This diff is collapsed.
......@@ -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) {
......
......@@ -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
};
......@@ -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};
......@@ -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};
......@@ -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};
......@@ -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");
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.liblinphone_tester</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
......@@ -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);
......
......@@ -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};
......@@ -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->