[libvirt] [PATCHv2 02/13] virbuf: improve testsuite reporting

Eric Blake eblake at redhat.com
Thu Sep 29 16:22:22 UTC 2011


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 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tests/testutils.c b/tests/testutils.c
index 08db732..7eb40f0 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -359,7 +359,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;
-- 
1.7.4.4




More information about the libvir-list mailing list