[libvirt] [PATCHv2 02/13] virbuf: improve testsuite reporting
Hai Dong Li
haidongl at linux.vnet.ibm.com
Tue Oct 18 02:49:56 UTC 2011
On 09/30/2011 12:22 AM, Eric Blake wrote:
> 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.
I'd like to say I like this tip.
> ---
> 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;
More information about the libvir-list
mailing list