]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: utils: Fail XML file comparison if input file doesn't exist
authorPeter Krempa <pkrempa@redhat.com>
Thu, 23 Jun 2016 13:22:06 +0000 (15:22 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 23 Jun 2016 19:11:32 +0000 (21:11 +0200)
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

index 8859ed50ff55919d27de5b8b674681946f55b5e3..be61e4d7ee9539fb73276ac800e01d2ef972a9d1 100644 (file)
@@ -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;