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.
Cheers.
--
Andrea Bolognani
Software Engineer - Virtualization Team