[PATCH 09/24] virschematest: Improve detection of 'invalid' XMLs

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

 



The output files from 'qemuxml2argvtest' may have the real capability
suffix e.g. 'pci-rom-disabled-invalid.x86_64-latest.xml' which would not
be detected as being invalid and thus causing a test failure.

Change the logic to find '-invalid.' so that we can properly use
'virschematest' with test cases using real capabilities.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tests/virschematest.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/virschematest.c b/tests/virschematest.c
index fcf3838630..c8c1527613 100644
--- a/tests/virschematest.c
+++ b/tests/virschematest.c
@@ -48,7 +48,9 @@ static int
 testSchemaValidateXML(const void *args)
 {
     const struct testSchemaData *data = args;
-    bool shouldFail = virStringHasSuffix(data->xml_path, "-invalid.xml");
+    /* invalid XMLs have a '-invalid.' suffix, but not necessarily at the end
+     * of the file name e.g. in case of qemuxml2xmltest with real capabilities */
+    bool shouldFail = !!strstr(data->xml_path, "-invalid.");
     g_autoptr(xmlDoc) xml = NULL;

     if (!(xml = virXMLParseFileCtxt(data->xml_path, NULL)))
-- 
2.41.0




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

  Powered by Linux