]> xenbits.xensource.com Git - libvirt.git/commitdiff
virbuf: improve testsuite reporting
authorEric Blake <eblake@redhat.com>
Sat, 17 Sep 2011 13:57:26 +0000 (07:57 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 20 Oct 2011 22:02:15 +0000 (16:02 -0600)
I had some temporary test failures while working on virbuf
improvements in later patches, with output that looked like:

Expected [<]
Actual [  <]

which is pretty hard to figure out.  Adding an Offset designation
made it much easier to find which particular '<' was at the
wrong indentation, to fix the right part of the code.

* tests/testutils.c (virtTestDifference): Make it easier to
diagnose test failures.

tests/testutils.c

index c8136373c94843f17ef48be88941ed2ca270e433..00a8d8f8d0b6ac7ea1cf512eedb8bd35dab96b48 100644 (file)
@@ -363,7 +363,7 @@ int virtTestDifference(FILE *stream,
     }
 
     /* Show the trimmed differences */
-    fprintf(stream, "\nExpect [");
+    fprintf(stream, "\nOffset %d\nExpect [", (int) (expectStart - expect));
     if ((expectEnd - expectStart + 1) &&
         fwrite(expectStart, (expectEnd-expectStart+1), 1, stream) != 1)
         return -1;