[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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 redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]