On 06/05/2014 04:03 PM, Eric Blake wrote:
On 06/05/2014 05:51 AM, Hong-Hua.Yin(a)freescale.com wrote:
> The test case failed with the patch.
>
> tests]$ VIR_TEST_DEBUG=1 ./qemuargv2xmltest
> ...
> 78) QEMU ARGV-2-XML hostdev-vfio ... FAILED
> ...
> It seemed that <hostdev> section is correct as expected.
> Why does the case fail? How to check more detailed debug information?
>
make check -C tests TESTS=qemuargv2xmltest VIR_TEST_DEBUG=1 VERBOSE=1
(or bump VIR_TEST_DEBUG=2 for even more details)
None of those convince it to cough up the warning message that shows
what is wrong, but running it under gdb I found that
qemuParseommandLine() is producing this warning:
unknown QEMU argument '-nodefconfig', adding to the qemu namespace
When a warning it logged, it is noticed by testCompareXMLToArgvFiles,
and unless that function is called with expect_warning = true, this log
warning will cause the test to fail (unfortunately *without* logging the
warning that caused the failure).
It turns out that expect_warning is set in the test struct's extraFlags,
but only if the macro DO_TEST_FULL is used:
DO_TEST_FULL("hostdev-vfio", 1);
HOWEVER, even if you do that, it will *still* fail, because the XML
resulting from qemuParseCommandLine will have -nodefconfig and
-nodefaults added to the qemu commandline passthrough part:
<qemu:commandline>
<qemu:arg value='-nodefconfig'/>
<qemu:arg value='-nodefaults'/>
</qemu:commandline>
(because it doesn't recognize that option).
So it *still* fails (although at least this time you can see the reason
if you've set VIR_TEST_DEBUG=2). What is really needed is the have
qemuParseCommandLine silently discard those two args.
Interestingly, this is the very first of the qemuxml2argvdata cases
containing -nodefconfig in the commandline data that has ever been added
to qemuargv2xmltest.c (which is why we've never seen this problem before).
Once that is fixed, you'll also notice that qemuParseCommandLine adds
this to the <disk> element:
<driver name='qemu' type='raw'/>
(that's the default, but it gets spelled out in the conversion), so that
needs to be added to the .xml file before the hostdev-vfio test can be
added to argv2xmltest.
Beyond that, the original failure case (unrecognized option in parse)
needs to be enhanced so that it actually outputs the reason for the failure.
I'm finishing up patches to fix these problems, and will post them to
this thread shortly.