]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commit
tests: add helper to determine when to skip expensive tests
authorEric Blake <eblake@redhat.com>
Fri, 2 Aug 2013 21:43:07 +0000 (15:43 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 12 Aug 2013 16:06:41 +0000 (10:06 -0600)
commit38d4bf49a0d1dd6511235fc06e21a06dbb9b1ba7
tree8319317dbb18ae28d8560d57157747bf28be5de6
parent70363ea9ff953d34d240c60723554e63c5a5fb39
tests: add helper to determine when to skip expensive tests

The logic set up in previous patch for exposing VIR_TEST_EXPENSIVE
to individual tests is as follows:

make check VIR_TEST_EXPENSIVE=0   => getenv("VIR_TEST_EXPENSIVE") sees "0"
make check VIR_TEST_EXPENSIVE=1   => getenv("VIR_TEST_EXPENSIVE") sees "1"
make check                        => getenv("VIR_TEST_EXPENSIVE") sees
either "0" or "1", based on configure options
cd tests; ./FOOtest               => getenv("VIR_TEST_EXPENSIVE") sees
whatever is in your environment (usually NULL, but possibly garbage)

Merely checking if VIR_TEST_EXPENSIVE is set in the environment
does the wrong thing; likewise, it is unsafe to assume the
variable will always contain a valid number.

As such, it helps to have helper functions, instead of making each
expensive test repeat the probe of the environment.

* tests/testutils.h (virTestGetExpensive): New prototype.
* tests/testutils.c (virTestGetExpensive): Implement it.
* tests/test-lib.sh (very_expensive_): Rename...
(test_expensive): ...and tweak to use VIR_TEST_EXPENSIVE.

Signed-off-by: Eric Blake <eblake@redhat.com>
tests/test-lib.sh
tests/testutils.c
tests/testutils.h