
2011/7/9 Eric Blake <eblake@redhat.com>:
On 07/08/2011 05:28 PM, Matthias Bolte wrote:
From a1508239af921289cd6e357e8521ff42faf535bd Mon Sep 17 00:00:00 2001 From: Matthias Bolte <matthias.bolte@googlemail.com> Date: Sat, 9 Jul 2011 01:24:16 +0200 Subject: [PATCH] tests: Add the logic to skip the statstest to the right place
--- tests/statstest.c | 31 ++++++++++++++++++++----------- 1 files changed, 20 insertions(+), 11 deletions(-)
-VIRT_TEST_MAIN(mymain) +/* Skipping the test in mymain is too late, it results in broken output. + * Therefore, expand VIRT_TEST_MAIN here manually to be able to skip at + * the right place. */ +int main(int argc, char **argv)
This seems fishy. Why did tests/reconnect.c not need the same treatment? Oh, because it didn't use VIRT_TEST_MAIN.
Wouldn't it be better to teach VIRT_TEST_MAIN to behave better on a skip?
diff --git i/tests/testutils.c w/tests/testutils.c index b433204..f732fdd 100644 --- i/tests/testutils.c +++ w/tests/testutils.c @@ -688,7 +688,7 @@ cleanup: if (abs_srcdir_cleanup) VIR_FREE(abs_srcdir); virResetLastError(); - if (!virTestGetVerbose()) { + if (!virTestGetVerbose() && ret != EXIT_AM_SKIP) { int i; for (i = (testCounter % 40) ; i > 0 && i < 40 ; i++) fprintf(stderr, " ");
This can still be improved in the look of the output. This results in TEST: statstest SKIP: statstest Other tests that decide to be skipped at compile time just result in SKIP: <testname> Problem with the runtime skip decision is that we need to setup stuff before and want to print the TEST: <testname> before doing that to get error messages probably assigned to this test in the output. So we cannot achieve SKIP: <testname> only here. In order to get rid of the indentation of SKIP: <testname> we need to defer the output of the indentation until we know that the test isn't skipped and is actually running test cases. Here's a v2 that does this. -- Matthias Bolte http://photron.blogspot.com