[PATCH] tests: Allow disabling leak checking assertions by env

Eoff, Ullysses A ullysses.a.eoff at intel.com
Thu Aug 9 08:46:03 PDT 2012


If I define NO_ASSERT_LEAK_CHECK in the environment, then the leak checks are skipped as expected.  However, this causes several sanity check tests to fail because some of them rely on the leak checks to fail.  Those specific tests need to be skipped, conditional on NO_ASSERT_LEAK_CHECK.

sanity_malloc_indirect, sanity_fd_leak, sanity_malloc_direct all fail for me with this patch.

U. Artie Eoff


>-----Original Message-----
>From: wayland-devel-
>bounces+ullysses.a.eoff=intel.com at lists.freedesktop.org [mailto:wayland-
>devel-bounces+ullysses.a.eoff=intel.com at lists.freedesktop.org] On Behalf
>Of Rob Bradford
>Sent: Thursday, August 09, 2012 2:33 AM
>To: wayland-devel at lists.freedesktop.org
>Cc: Rob Bradford
>Subject: [PATCH] tests: Allow disabling leak checking assertions by env
>
>From: Rob Bradford <rob at linux.intel.com>
>
>Some code coverage tools trigger these assertions when run against the test
>suite since they don't free all their memory.
>---
> tests/test-runner.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
>diff --git a/tests/test-runner.c b/tests/test-runner.c
>index 63ce384..6c30649 100644
>--- a/tests/test-runner.c
>+++ b/tests/test-runner.c
>@@ -95,8 +95,10 @@ run_test(const struct test *t)
>
> 	cur_fds = count_open_fds();
> 	t->run();
>-	assert(cur_alloc == num_alloc && "memory leak detected in test.");
>-	assert(cur_fds == count_open_fds() && "fd leak detected");
>+	if (!getenv("NO_ASSERT_LEAK_CHECK")) {
>+		assert(cur_alloc == num_alloc && "memory leak detected in
>test.");
>+		assert(cur_fds == count_open_fds() && "fd leak detected");
>+	}
> 	exit(EXIT_SUCCESS);
> }
>
>--
>1.7.11.2
>
>_______________________________________________
>wayland-devel mailing list
>wayland-devel at lists.freedesktop.org
>http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list