[libvirt] [PATCH] tests: Centralize VIR_TEST_DEBUG lookup, and document it

Matthias Bolte matthias.bolte at googlemail.com
Sat Oct 17 12:03:34 UTC 2009


2009/10/16 Cole Robinson <crobinso at redhat.com>:
> Provide a simple interface for other tests to lookup the testDebug variable.
> Also remove a redundant error message in interface tests.
>
> If anyone feels inclined to change this env variable to match the existing
> LIBVIRT_* format, it should now be easier to do so.
>
> Signed-off-by: Cole Robinson <crobinso at redhat.com>
> ---
>  HACKING                      |   10 ++++++++++
>  tests/interfacexml2xmltest.c |    2 --
>  tests/statstest.c            |    4 ++--
>  tests/testutils.c            |   38 ++++++++++++++++++++++++++------------
>  tests/testutils.h            |    4 ++--
>  tests/testutilsqemu.c        |    2 +-
>  6 files changed, 41 insertions(+), 19 deletions(-)
>
> diff --git a/HACKING b/HACKING
> index bcff8c6..fba7778 100644
> --- a/HACKING
> +++ b/HACKING
> @@ -37,6 +37,16 @@ and run the tests:
>
>  The latter test checks for memory leaks.
>
> +If you encounter any failing tests, the VIR_TEST_DEBUG environment variable
> +may help:
> +
> +  VIR_TEST_DEBUG=1 make check    (or)
> +  VIR_TEST_DEBUG=2 make check

Maybe explain what VIR_TEST_DEBUG actually does and what's the
difference between 1 and 2.

> +
> +Also, individual tests can be run from inside the 'tests/' directory, like:
> +
> +  ./qemuxml2xmltest
> +
>  (6) Update tests and/or documentation, particularly if you are adding
>  a new feature or changing the output of a program.

> --- a/tests/testutils.c
> +++ b/tests/testutils.c
> @@ -45,7 +45,7 @@
>     ((((int) ((T)->tv_sec - (U)->tv_sec)) * 1000000.0 +        \
>       ((int) ((T)->tv_usec - (U)->tv_usec))) / 1000.0)
>
> -unsigned int testDebug = 0;
> +unsigned int testDebug = -1;

testDebug isn't referenced via extern anymore, declare it static like
testOOM and testCounter.

>  static unsigned int testOOM = 0;
>  static unsigned int testCounter = 0;

ACK.

Matthias




More information about the libvir-list mailing list