[libvirt] 1/3 testsuite formatting bugs [was: [PATCH] Skip some xen tests if xend is not running]

Eric Blake eblake at redhat.com
Mon Jul 11 15:39:22 UTC 2011


On 07/09/2011 09:42 AM, Matthias Bolte wrote:
> True, the current expression doesn't work for counter = 40. You're
> expression fixed this, but no reason for special casing 0 here, as
> modulo on negative values is perfectly fine and yields the right
> result here
> 
>   expr 39 - \( \( 0 - 1 \) % 40 \) is 40
> 
> ACK, to you're equation (but without special casing 0) as I already
> pushed my patch.

Here's what I pushed to clean up this thread.

diff --git c/tests/test-lib.sh w/tests/test-lib.sh
index 527dfda..918bf73 100644
--- c/tests/test-lib.sh
+++ w/tests/test-lib.sh
@@ -54,7 +54,7 @@ test_final()
   status=$2

   if test "$verbose" = "0" ; then
-    len=`expr 40 - \( $counter % 40 \)`
+    len=`expr 39 - \( \( $counter - 1 \) % 40 \)`
     printf "%${len}s" ""
     if test "$status" = "0" ; then
       printf " %-3d OK\n" $counter
diff --git c/tests/testutils.c w/tests/testutils.c
index c89f70f..ac5d298 100644
--- c/tests/testutils.c
+++ w/tests/testutils.c
@@ -693,9 +693,8 @@ cleanup:
         VIR_FREE(abs_srcdir);
     virResetLastError();
     if (!virTestGetVerbose() && ret != EXIT_AM_SKIP) {
-        int i;
-        for (i = (testCounter % 40) ; i > 0 && i < 40 ; i++)
-            fprintf(stderr, " ");
+        if (testCounter == 0 || testCounter % 40)
+            fprintf(stderr, "%*s", 40 - (testCounter % 40), "");
         fprintf(stderr, " %-3d %s\n", testCounter, ret == 0 ? "OK" :
"FAIL");
     }
     return ret;

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110711/9335069b/attachment-0001.sig>


More information about the libvir-list mailing list