[PATCH] virschematest: Validate schema in tests/cputestdata

Peter Krempa posted 1 patch 3 years, 5 months ago
Failed in applying to current master (apply log)
tests/virschematest.c | 9 +++++++++
1 file changed, 9 insertions(+)
[PATCH] virschematest: Validate schema in tests/cputestdata
Posted by Peter Krempa 3 years, 5 months ago
We now have a schema file for the 'cpu' elements. Use it to validate
files in 'tests/cputestdata'

Unfortunately the files in the directory are too disorganised and not
easy to split up to do something more straightforward.

The -baseline- input files are tested by the test internally and the
rest of the files are internal data feeding the tests so they don't
need validation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---

This applies on top of my previous series refactoring the virschematest.

 tests/virschematest.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tests/virschematest.c b/tests/virschematest.c
index 6ce09d4737..0e587c3ff0 100644
--- a/tests/virschematest.c
+++ b/tests/virschematest.c
@@ -323,6 +323,14 @@ static const struct testSchemaEntry schemaStorageVol[] = {
     { .file = "examples/xml/test/testvol.xml" },
 };

+static const struct testSchemaEntry schemaCpu[] = {
+    { . dir = "tests/cputestdata",
+      . dirRegex = "^[^-]+-cpuid-.*(-host|-guest|-json)\\.xml$" },
+    { . dir = "tests/cputestdata",
+      . dirRegex = "^[^-]+-baseline-.*-result\\.xml$" },
+    { . dir = "tests/cputestdata",
+      . dirRegex = "^[^-]+-(?!cpuid|baseline).*$" },
+};

 static int
 mymain(void)
@@ -349,6 +357,7 @@ mymain(void)
     DO_TEST("docs/schemas/storagepoolcaps.rng", schemaStoragepoolcaps);
     DO_TEST("docs/schemas/storagepool.rng", schemaStoragePool);
     DO_TEST("docs/schemas/storagevol.rng", schemaStorageVol);
+    DO_TEST("docs/schemas/cpu.rng", schemaCpu);

     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
-- 
2.26.2