]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
tests: Don't add extra padding if counter mod 40 is 0
authorMatthias Bolte <matthias.bolte@googlemail.com>
Sat, 20 Mar 2010 17:08:00 +0000 (18:08 +0100)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Wed, 24 Mar 2010 00:07:57 +0000 (01:07 +0100)
This change only affects the output of tests that have an exact
multiple of 40 test cases. For example the domainschematest currently:

TEST: domainschematest
      ........................................ 40
      ........................................ 80
      ........................................ 120
      ........................................ 160
      ........................................                                         200 OK
PASS: domainschematest

It outputs additional 40 spaces on the last line.

The domainschematest output is fixed by the change in test-lib.sh. The
change in testutils.c fixes this for tests written in C. Currently no
C test has an exact multiple of 40 test cases, but I checked it and
the same problem exists there.

This patch stops that in both cases.

tests/test-lib.sh
tests/testutils.c

index 43265f3a9a18c275c1ac03ef70d7a4aa9872bae8..57fd43893dc44b79858585200ae8687dc44800dd 100644 (file)
@@ -55,10 +55,12 @@ test_final()
 
   if test "$verbose" = "0" ; then
     mod=`eval "expr \( $counter + 1 \) % 40"`
-    for i in `seq $mod 40`
-    do
-      echo -n " "
-    done
+    if test "$mod" != "0" -a "$mod" != "1" ; then
+      for i in `seq $mod 40`
+      do
+        echo -n " "
+      done
+    fi
     if test "$status" = "0" ; then
       printf " %-3d OK\n" $counter
     else
index 4f17e5176fbcbf39b2a0dd2e19e510da2409f337..2f61aadc84b65d54adaeeb8a93c2b4c5823e684b 100644 (file)
@@ -537,7 +537,7 @@ cleanup:
     virResetLastError();
     if (!virTestGetVerbose()) {
         int i;
-        for (i = (testCounter % 40) ; i < 40 ; i++)
+        for (i = (testCounter % 40) ; i > 0 && i < 40 ; i++)
             fprintf(stderr, " ");
         fprintf(stderr, " %-3d %s\n", testCounter, ret == 0 ? "OK" : "FAIL");
     }