tests: rename NO_ASSERT_LEAK_CHECK

Submitted by Marek Chalupa on Nov. 19, 2014, 11 a.m.

Details

Message ID 1416394810-13096-1-git-send-email-mchqwerty@gmail.com
State Superseded
Headers show

Not browsing as part of any series.

Commit Message

Marek Chalupa Nov. 19, 2014, 11 a.m.
This env variable is used for turning off the leak checks in tests.
Rename it to WAYLAND_TESTS_NO_LEAK_CHECK, so that it is consistent
with WAYLAND_TESTS_NO_TIMEOUTS.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
---
 tests/test-runner.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/tests/test-runner.c b/tests/test-runner.c
index 09c50e2..a6c75a9 100644
--- a/tests/test-runner.c
+++ b/tests/test-runner.c
@@ -42,6 +42,9 @@  static void (*sys_free)(void*);
 static void* (*sys_realloc)(void*, size_t);
 static void* (*sys_calloc)(size_t, size_t);
 
+/* when set to 1, check if tests are not leaking memory and opened files.
+ * It is turned on by default. It can be turned off by
+ * WAYLAND_TESTS_NO_LEAK_CHECK environment variable. */
 int leak_check_enabled;
 
 /* when this var is set to 0, every call to test_set_timeout() is
@@ -234,7 +237,7 @@  int main(int argc, char *argv[])
 	sys_malloc = dlsym(RTLD_NEXT, "malloc");
 	sys_free = dlsym(RTLD_NEXT, "free");
 
-	leak_check_enabled = !getenv("NO_ASSERT_LEAK_CHECK");
+	leak_check_enabled = !getenv("WAYLAND_TESTS_NO_LEAK_CHECK");
 	timeouts_enabled = !getenv("WAYLAND_TESTS_NO_TIMEOUTS");
 
 	if (argc == 2 && strcmp(argv[1], "--help") == 0)

Comments

On Wed, Nov 19, 2014 at 12:00:10PM +0100, Marek Chalupa wrote:
> This env variable is used for turning off the leak checks in tests.
> Rename it to WAYLAND_TESTS_NO_LEAK_CHECK, so that it is consistent
> with WAYLAND_TESTS_NO_TIMEOUTS.

Should these both be 'WAYLAND_TEST_'?  In weston there is already a
WESTON_TEST_CLIENT_PATH.

If WAYLAND_TESTS_* is better, then maybe WESTON_TEST_CLIENT_PATH should
be changed for consistency.

Apart from that, LGTM.

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>

> Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
> ---
>  tests/test-runner.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/test-runner.c b/tests/test-runner.c
> index 09c50e2..a6c75a9 100644
> --- a/tests/test-runner.c
> +++ b/tests/test-runner.c
> @@ -42,6 +42,9 @@ static void (*sys_free)(void*);
>  static void* (*sys_realloc)(void*, size_t);
>  static void* (*sys_calloc)(size_t, size_t);
>  
> +/* when set to 1, check if tests are not leaking memory and opened files.
> + * It is turned on by default. It can be turned off by
> + * WAYLAND_TESTS_NO_LEAK_CHECK environment variable. */
>  int leak_check_enabled;
>  
>  /* when this var is set to 0, every call to test_set_timeout() is
> @@ -234,7 +237,7 @@ int main(int argc, char *argv[])
>  	sys_malloc = dlsym(RTLD_NEXT, "malloc");
>  	sys_free = dlsym(RTLD_NEXT, "free");
>  
> -	leak_check_enabled = !getenv("NO_ASSERT_LEAK_CHECK");
> +	leak_check_enabled = !getenv("WAYLAND_TESTS_NO_LEAK_CHECK");
>  	timeouts_enabled = !getenv("WAYLAND_TESTS_NO_TIMEOUTS");
>  
>  	if (argc == 2 && strcmp(argv[1], "--help") == 0)
> -- 
> 2.1.0
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
On 20 November 2014 at 23:59, Bryce Harrington <bryce@osg.samsung.com>
wrote:

> On Wed, Nov 19, 2014 at 12:00:10PM +0100, Marek Chalupa wrote:
> > This env variable is used for turning off the leak checks in tests.
> > Rename it to WAYLAND_TESTS_NO_LEAK_CHECK, so that it is consistent
> > with WAYLAND_TESTS_NO_TIMEOUTS.
>
> Should these both be 'WAYLAND_TEST_'?  In weston there is already a
> WESTON_TEST_CLIENT_PATH.
>
> If WAYLAND_TESTS_* is better, then maybe WESTON_TEST_CLIENT_PATH should
> be changed for consistency.
>
>
Yep, let's see what others think :) I'll either modify this patch or
follow-up with Weston patch then.


> Apart from that, LGTM.
>
> Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
>
> > Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
> > ---
> >  tests/test-runner.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/tests/test-runner.c b/tests/test-runner.c
> > index 09c50e2..a6c75a9 100644
> > --- a/tests/test-runner.c
> > +++ b/tests/test-runner.c
> > @@ -42,6 +42,9 @@ static void (*sys_free)(void*);
> >  static void* (*sys_realloc)(void*, size_t);
> >  static void* (*sys_calloc)(size_t, size_t);
> >
> > +/* when set to 1, check if tests are not leaking memory and opened
> files.
> > + * It is turned on by default. It can be turned off by
> > + * WAYLAND_TESTS_NO_LEAK_CHECK environment variable. */
> >  int leak_check_enabled;
> >
> >  /* when this var is set to 0, every call to test_set_timeout() is
> > @@ -234,7 +237,7 @@ int main(int argc, char *argv[])
> >       sys_malloc = dlsym(RTLD_NEXT, "malloc");
> >       sys_free = dlsym(RTLD_NEXT, "free");
> >
> > -     leak_check_enabled = !getenv("NO_ASSERT_LEAK_CHECK");
> > +     leak_check_enabled = !getenv("WAYLAND_TESTS_NO_LEAK_CHECK");
> >       timeouts_enabled = !getenv("WAYLAND_TESTS_NO_TIMEOUTS");
> >
> >       if (argc == 2 && strcmp(argv[1], "--help") == 0)
> > --
> > 2.1.0
> >
> > _______________________________________________
> > wayland-devel mailing list
> > wayland-devel@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>

Thanks,
Marek
On 11/26/2014 06:25 AM, Marek Chalupa wrote:
>
>
> On 20 November 2014 at 23:59, Bryce Harrington <bryce@osg.samsung.com
> <mailto:bryce@osg.samsung.com>> wrote:
>
>     On Wed, Nov 19, 2014 at 12:00:10PM +0100, Marek Chalupa wrote:
>     > This env variable is used for turning off the leak checks in tests.
>     > Rename it to WAYLAND_TESTS_NO_LEAK_CHECK, so that it is consistent
>     > with WAYLAND_TESTS_NO_TIMEOUTS.
>
>     Should these both be 'WAYLAND_TEST_'?  In weston there is already a
>     WESTON_TEST_CLIENT_PATH.
>
>     If WAYLAND_TESTS_* is better, then maybe WESTON_TEST_CLIENT_PATH should
>     be changed for consistency.

The plural seems wrong to me. Calling them WAYLAND_TEST_* I think is 
much more what I would expect. The reason is that this is not 
controlling "tests" (a plural), but instead controlling "testing" (a 
singular).