[libvirt] [PATCH 10/12] tests: qemuxml2xml: Use testQemuInfoSetArgs

Cole Robinson crobinso at redhat.com
Wed Apr 10 22:53:51 UTC 2019


On 4/10/19 12:53 PM, Andrea Bolognani wrote:
> On Mon, 2019-04-01 at 12:47 -0400, Cole Robinson wrote:
> [...]
>> @@ -170,6 +150,11 @@ mymain(void)
>>      char *fakerootdir;
>>      struct testQemuInfo info;
>>      virQEMUDriverConfigPtr cfg = NULL;
>> +    virHashTablePtr capslatest = NULL;
>> +
>> +    capslatest = testQemuGetCapsLatest();
>> +    if (!capslatest)
>> +        abort();
> 
> Woah, that's a bit harsh, isn't it? How about a nice and polite
> 
>   return EXIT_FAILURE;
> 
> instead? :)
> 

I was just following the pattern of the error conditions right after
this, but I'll use your suggestion.

> [...]
>> @@ -192,11 +177,14 @@ mymain(void)
>>  
>>  # define DO_TEST_FULL(name, when, gic, ...) \
>>      do { \
>> -        if (testInfoSetCommon(&info, gic) < 0) { \
>> +        if (testQemuInfoSetArgs(&info, capslatest, \
>> +                                ARG_GIC, gic, \
>> +                                ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST, \
>> +                                ARG_END) < 0 || \
>> +            qemuTestCapsCacheInsert(driver.qemuCapsCache, info.qemuCaps) < 0) { \
> 
> I haven't really spent any time digging, but that call to
> qemuTestCapsCacheInsert() looks odd to me. What exactly is the point
> in caching if we're going to be using a different set of capabilities
> pretty much every single time?
> 

IIRC it's not really about caching or speed or whatever, it's required
to get our manually populated qemuCaps into the standard src/qemu driver
routines, which use virQEMUCapsCacheLookup everywhere

Thanks,
Cole




More information about the libvir-list mailing list