mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
tester.c: fix memory leaks detector
This commit is contained in:
parent
8018d1d705
commit
a5dd3b6b10
1 changed files with 13 additions and 10 deletions
|
|
@ -551,18 +551,21 @@ int liblinphone_tester_after_each(void) {
|
|||
ms_error("%s", format);
|
||||
|
||||
all_leaks_buffer = ms_strcat_printf(all_leaks_buffer, "\n%s", format);
|
||||
}
|
||||
|
||||
{
|
||||
//prevent any future leaks
|
||||
const char **tags = bc_tester_current_test_tags();
|
||||
// if the test is NOT marked as leaking memory and it actually is, we should make it fail
|
||||
if ( tags &&
|
||||
!((tags[0] && strcmp(tags[0], "LeakingMemory")) || (tags[1] && strcmp(tags[1], "LeakingMemory")))) {
|
||||
BC_FAIL("This test is leaking memory!");
|
||||
return 1;
|
||||
}
|
||||
// prevent any future leaks
|
||||
{
|
||||
const char **tags = bc_tester_current_test_tags();
|
||||
int leaks_expected =
|
||||
(tags && ((tags[0] && !strcmp(tags[0], "LeaksMemory")) || (tags[1] && !strcmp(tags[1], "LeaksMemory"))));
|
||||
// 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!");
|
||||
// and reciprocally
|
||||
} else if (leaks_expected && leaked_objects == 0) {
|
||||
BC_FAIL("This test is not leaking anymore, please remove LeaksMemory tag!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue