[libvirt] [PATCH 0/2] Fix genericxml2xml test and avoid further mistakes

Peter Krempa (2): tests: genericxml2xml: Fix test file name tests: utils: Fail XML file comparison if input file doesn't exist tests/genericxml2xmltest.c | 2 +- tests/testutils.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) -- 2.8.3

Commit b1fc6a7b added a test file but used a different name in the actual test. --- tests/genericxml2xmltest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c index 1a7a668..a487727 100644 --- a/tests/genericxml2xmltest.c +++ b/tests/genericxml2xmltest.c @@ -92,7 +92,7 @@ mymain(void) DO_TEST_FULL("graphics-vnc-socket-attr-listen-socket-mismatch", 0, false, TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); - DO_TEST_FULL("name-slash-parse", 0, false, + DO_TEST_FULL("name-slash-fail", 0, false, TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); DO_TEST("perf"); -- 2.8.3

In cases where we expect parse failure of the test input file the testsuite can't differentiate if the parser failed when parsing or when opening the file. Add a call to virFileExists and error out on missing input files. Missing output files are partially expected when regenerating test output. --- tests/testutils.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/testutils.c b/tests/testutils.c index 8859ed5..be61e4d 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -1102,6 +1102,11 @@ testCompareDomXML2XMLFiles(virCapsPtr caps, virDomainXMLOptionPtr xmlopt, parse_flags |= parseFlags; + if (!virFileExists(infile)) { + VIR_TEST_DEBUG("Test input file '%s' is missing", infile); + return -1; + } + if (!live) format_flags |= VIR_DOMAIN_DEF_FORMAT_INACTIVE; -- 2.8.3

On Thu, Jun 23, 2016 at 03:32:32PM +0200, Peter Krempa wrote:
Peter Krempa (2): tests: genericxml2xml: Fix test file name tests: utils: Fail XML file comparison if input file doesn't exist
tests/genericxml2xmltest.c | 2 +- tests/testutils.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-)
ACK series
-- 2.8.3
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
participants (2)
-
Martin Kletzander
-
Peter Krempa