summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/sanity-test.c13
-rw-r--r--tests/test-runner.c2
-rw-r--r--tests/test-runner.h6
3 files changed, 21 insertions, 0 deletions
diff --git a/tests/sanity-test.c b/tests/sanity-test.c
index a61dc99..b5a6fae 100644
--- a/tests/sanity-test.c
+++ b/tests/sanity-test.c
@@ -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;
diff --git a/tests/test-runner.c b/tests/test-runner.c
index 2e6ad33..70fa0ae 100644
--- a/tests/test-runner.c
+++ b/tests/test-runner.c
@@ -175,6 +175,8 @@ check_leaks(int supposed_alloc, int supposed_fds)
num_fds - supposed_fds);
abort();
}
+ } else {
+ fprintf(stderr, "Leak checks disabled\n");
}
}
diff --git a/tests/test-runner.h b/tests/test-runner.h
index 5963ab6..6054da5 100644
--- a/tests/test-runner.h
+++ b/tests/test-runner.h
@@ -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