
2011/7/9 Eric Blake <eblake@redhat.com>:
On 07/08/2011 05:28 PM, Matthias Bolte wrote:
TEST: virsh-all ........................................ 40 ........................................ 80 ........................................ 120 ....................................... 159 OK PASS: virsh-all
We're obviously getting the logic wrong when there are 0 or when tests%40 == 39.
Here are two patches for this, plus one to use EXIT_AM_SKIP more.
An even better patch for the SKIP logic. Why do a for loop of one space at a time, when printf can do it for us?
From fbaee4f7df0bd04520948228de125ce0c6112130 Mon Sep 17 00:00:00 2001 From: Eric Blake <eblake@redhat.com> Date: Fri, 8 Jul 2011 19:55:02 -0600 Subject: [PATCH] tests: handle skipped tests better
Without this, running statstest withtout xen wasn't formatted well:
TEST: statstest 0 FAIL SKIP: statstest
* tests/testutils.c (virtTestMain): Special case skipped test. --- tests/testutils.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/testutils.c b/tests/testutils.c index b433204..fe04caa 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -689,10 +689,10 @@ cleanup: VIR_FREE(abs_srcdir); virResetLastError(); if (!virTestGetVerbose()) {
When we add && ret != EXIT_AM_SKIP here ...
- int i; - for (i = (testCounter % 40) ; i > 0 && i < 40 ; i++) - fprintf(stderr, " "); - fprintf(stderr, " %-3d %s\n", testCounter, ret == 0 ? "OK" : "FAIL"); + if (testCounter == 0 || testCounter % 40) + fprintf(stderr, "%*s", 40 - (testCounter % 40), ""); + fprintf(stderr, " %-3d %s\n", testCounter, + ret == 0 ? "OK" : ret == EXIT_AM_SKIP ? "SKIP" : "FAIL");
.. then we don't need to handle EXIT_AM_SKIP here. ACK. -- Matthias Bolte http://photron.blogspot.com