virbuf: improve testsuite reporting

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.
This commit is contained in:
Eric Blake 2011-09-17 07:57:26 -06:00
parent 5c09b81be7
commit ef696300e6

View 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;