[PATCH 2/2] tests: utils: Fail XML file comparison if input file doesn't exist

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

 



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

--
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]