[libvirt] [PATCH] build: rewrite test to match change in behavior
Eric Blake
eblake at redhat.com
Fri Aug 19 15:11:11 UTC 2011
On 08/19/2011 08:58 AM, Eric Blake wrote:
> # Succeed, now: first shut down, then undefine, both via name.
> -$abs_top_builddir/tools/virsh -q -c test:///default 'shutdown test; undefine test'> out 2>&1
> -test $? = 0 || fail=1
> -cat<<\EOF> exp || fail=1
> +$abs_top_builddir/tools/virsh -q -c test:///default \
> + 'shutdown test; undefine test; dominfo test'> out 2> err
Aargh - this points out a bug in virsh - we aren't calling fflush() in
between writes to stdout and stderr. If those two FILE* are mapped to
the same underlying file description (as is the case when you do 2>&1
redirection from the shell), then it is essential to flush in between
every transition between the two FILE* if you want the output to appear
in linear order. Without patching virsh, I had to split this into
capturing output in two files, with no sense of relationship between
timings, because my test run happened to flush stderr prior to stdout
and reverse the output from the expected linear ordering of when it was
produced.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
More information about the libvir-list
mailing list