[libvirt] [PATCH] tests: Introduce qemuhotplugtest

Michal Privoznik mprivozn at redhat.com
Tue Jun 25 13:45:47 UTC 2013


On 25.06.2013 12:00, Daniel P. Berrange wrote:
>> +#define DO_TEST(file, dev, fial, ...) \
>> > +    do { \
>> > +        const char *my_mon[] = { __VA_ARGS__, NULL}; \
>> > +        struct qemuHotplugTestData data =                                    \
>> > +            {.domain_filename = file, .device_filename = dev, .fail = fial,  \
>> > +             .mon = my_mon}; \
>> > +        if (virtTestRun(#file, 1, testQemuHotplug, &data) < 0)               \
>> > +            ret = -1;                                                        \
>> > +    } while (0)
> What's with the 'fail' parameter you're passing across test cases.
> AFAICT, no test needs to be aware of the fail status of any earlier
> test. You're re-creating the fake monitor for each test case so
> no state is shared between tests. Just setting the 'ret = -1' here
> is sufficient
> 

The parameter is there to tell the testQemuHotplug if error is expected
or not. For instance, changing a listen address is expected to fail.
Hence, qemuDomainChangeGraphics() called from the test function must
return -1. However, the test function knows the error is expected, so it
must return 0. This is controlled by 'fial'. I think we have similar
approach elsewhere in the test suite.

Michal




More information about the libvir-list mailing list