Commit 68c11c48 authored by Marek Chalupa's avatar Marek Chalupa Committed by Daniel Stone
Browse files

tests: add possibility to disable leak check for single test



In tests that are using external libraries (i. e. pthread) we
can get failure because of leaks in the external library.
Until we have some better solution (if ever), let these (and only these)
tests to disable leak checks.
Signed-off-by: default avatarMarek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Daniel Stone's avatarDaniel Stone <daniels@collabora.com>
parent 5c70c031
......@@ -81,6 +81,19 @@ FAIL_TEST(sanity_malloc_direct)
free(NULL); /* NULL must not be counted */
}
TEST(disable_leak_checks)
{
volatile void *mem;
assert(leak_check_enabled);
/* normally this should be on the beginning of the test.
* Here we need to be sure, that the leak checks are
* turned on */
DISABLE_LEAK_CHECKS;
mem = malloc(16);
assert(mem);
}
FAIL_TEST(sanity_malloc_indirect)
{
struct wl_array array;
......
......@@ -175,6 +175,8 @@ check_leaks(int supposed_alloc, int supposed_fds)
num_fds - supposed_fds);
abort();
}
} else {
fprintf(stderr, "Leak checks disabled\n");
}
}
......
......@@ -62,4 +62,10 @@ test_usleep(useconds_t);
void
test_sleep(unsigned int);
#define DISABLE_LEAK_CHECKS \
do { \
extern int leak_check_enabled; \
leak_check_enabled = 0; \
} while (0);
#endif
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