fix absence of assert report in xml output of tests when a test is leaking memory.

This commit is contained in:
Simon Morlat 2016-09-26 16:02:16 +02:00
parent af47cd4e8c
commit fd78a2f7b9
6 changed files with 15 additions and 12 deletions

View file

@ -90,11 +90,11 @@ int sal_call_refer_with_replaces(SalOp *op, SalOp *other_call_op){
belle_sip_parameters_clean(BELLE_SIP_PARAMETERS(refer_to));
if (belle_sip_dialog_is_server(other_call_op->dialog)) {
to_tag=belle_sip_dialog_get_local_tag(other_call_op->dialog);
from_tag=belle_sip_dialog_get_remote_tag(other_call_op->dialog);;
from_tag=belle_sip_dialog_get_remote_tag(other_call_op->dialog);
} else {
from_tag=belle_sip_dialog_get_local_tag(other_call_op->dialog);
to_tag=belle_sip_dialog_get_remote_tag(other_call_op->dialog);;
to_tag=belle_sip_dialog_get_remote_tag(other_call_op->dialog);
}
replaces=belle_sip_header_replaces_create(belle_sip_header_call_id_get_call_id(belle_sip_dialog_get_call_id(other_call_op->dialog))
,from_tag,to_tag);

View file

@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
static LinphoneNatPolicy * _linphone_nat_policy_new_with_ref(LinphoneCore *lc, const char *ref) {
LinphoneNatPolicy *policy = belle_sip_object_new(LinphoneNatPolicy);
belle_sip_object_ref(policy);
policy->lc = lc;
policy->ref = belle_sip_strdup(ref);
return policy;
@ -57,7 +56,7 @@ BELLE_SIP_INSTANCIATE_VPTR(LinphoneNatPolicy, belle_sip_object_t,
(belle_sip_object_destroy_t)linphone_nat_policy_destroy,
NULL, // clone
NULL, // marshal
TRUE
FALSE
);

View file

@ -1421,5 +1421,5 @@ LinphoneNatPolicy * linphone_proxy_config_get_nat_policy(const LinphoneProxyConf
void linphone_proxy_config_set_nat_policy(LinphoneProxyConfig *cfg, LinphoneNatPolicy *policy) {
if (policy != NULL) policy = linphone_nat_policy_ref(policy); /* Prevent object destruction if the same policy is used */
if (cfg->nat_policy != NULL) linphone_nat_policy_unref(cfg->nat_policy);
if (policy != NULL) cfg->nat_policy = policy;
cfg->nat_policy = policy;
}

View file

@ -382,7 +382,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);
int liblinphone_tester_after_each(void);
void liblinphone_tester_after_each(void);
void liblinphone_tester_init(void(*ftester_printf)(int level, const char *fmt, va_list args));
void liblinphone_tester_uninit(void);
int liblinphone_tester_set_log_file(const char *filename);

View file

@ -25,6 +25,7 @@
static void linphone_version_test(void){
const char *version=linphone_core_get_version();
/*make sure the git version is always included in the version number*/
BC_ASSERT_PTR_NOT_NULL(version);
BC_ASSERT_PTR_NULL(strstr(version,"unknown"));
}
@ -186,6 +187,12 @@ static void linphone_lpconfig_from_xml_zerolen_value(void){
LinphoneCoreManager* mgr = linphone_core_manager_new2("empty_rc",FALSE);
/* BUG
* This test makes a provisionning by xml outside of the Configuring state of the LinphoneCore.
* It is leaking memory because the config is litterally erased and rewritten by the invocation
* of the private function linphone_remote_provisioning_load_file .
*/
BC_ASSERT_EQUAL(linphone_remote_provisioning_load_file(mgr->lc, xml_path), 0, int, "%d");
conf = mgr->lc->config;
@ -387,7 +394,7 @@ test_t setup_tests[] = {
TEST_NO_TAG("LPConfig from buffer", linphone_lpconfig_from_buffer),
TEST_NO_TAG("LPConfig zero_len value from buffer", linphone_lpconfig_from_buffer_zerolen_value),
TEST_NO_TAG("LPConfig zero_len value from file", linphone_lpconfig_from_file_zerolen_value),
TEST_NO_TAG("LPConfig zero_len value from XML", linphone_lpconfig_from_xml_zerolen_value),
TEST_ONE_TAG("LPConfig zero_len value from XML", linphone_lpconfig_from_xml_zerolen_value, "LeaksMemory"),
TEST_NO_TAG("Chat room", chat_room_test),
TEST_NO_TAG("Devices reload", devices_reload_test),
TEST_NO_TAG("Codec usability", codec_usability_test),

View file

@ -609,8 +609,8 @@ void liblinphone_tester_before_each(void) {
static char* all_leaks_buffer = NULL;
int liblinphone_tester_after_each(void) {
int err = 0;
void liblinphone_tester_after_each(void) {
if (!liblinphone_tester_leak_detector_disabled){
int leaked_objects = belle_sip_object_get_object_count() - leaked_objects_count;
if (leaked_objects > 0) {
@ -634,11 +634,9 @@ int liblinphone_tester_after_each(void) {
// if the test is NOT marked as leaking memory and it actually is, we should make it fail
if (!leaks_expected && leaked_objects > 0) {
BC_FAIL("This test is leaking memory!");
err = 1;
// and reciprocally
} else if (leaks_expected && leaked_objects == 0) {
BC_FAIL("This test is not leaking anymore, please remove LeaksMemory tag!");
// err = 1; // do not force fail actually, because it can be some false positive warning
}
}
}
@ -646,7 +644,6 @@ int liblinphone_tester_after_each(void) {
if (manager_count != 0) {
ms_fatal("%d Linphone core managers are still alive!", manager_count);
}
return err;
}
void liblinphone_tester_uninit(void) {