Re: [PATCH 1/2] tests: Enable failure testing with CompareDomXML2XML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/14/2016 10:00 AM, Andrea Bolognani wrote:
> On Fri, 2016-04-08 at 13:48 -0400, Cole Robinson wrote:
>> This allows tests to check for specific failure scenarios
>> ---
>>  tests/bhyvexml2xmltest.c   |  4 ++--
>>  tests/genericxml2xmltest.c |  4 ++--
>>  tests/lxcxml2xmltest.c     |  3 ++-
>>  tests/qemuxml2xmltest.c    |  6 ++++--
>>  tests/testutils.c          | 47 ++++++++++++++++++++++++++++++++++------------
>>  tests/testutils.h          | 12 +++++++++++-
>>  6 files changed, 56 insertions(+), 20 deletions(-)
> 
> [...]
>  
>> -    if (virtTestCompareToFile(actual, outfile) < 0)
>> -        goto fail;
>> +    if (virtTestCompareToFile(actual, outfile) < 0) {
>> +        result = TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_COMPARE;
>> +        goto out;
>> +    }
>> +
>> +    result = TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS;
> 
> Would look nicer with an empty line before the label.
> 
>> + out:
>> +    if (result == expectResult) {
>> +        ret = 0;
>> +        if (expectResult != TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS) {
>> +            VIR_TEST_DEBUG("Got expected failure code=%d msg=%s",
>> +                           result, virGetLastErrorMessage());
>> +        }
>> +    } else {
>> +        ret = -1;
>> +        VIR_TEST_DEBUG("Expected failure code=%d but received code=%d",
>> +                       expectResult, result);
> 
> s/failure/result/ in the second message above... If
> expectResult == TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS
> we don't want to call "success" a "failure code" :)
> 
> ACK with the above taken care of.
> 

Thanks, made those changes and pushed

- Cole

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]