]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virschematest: Validate schema in tests/cputestdata
authorPeter Krempa <pkrempa@redhat.com>
Wed, 7 Oct 2020 14:52:14 +0000 (16:52 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 20 Oct 2020 07:05:11 +0000 (09:05 +0200)
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>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tests/virschematest.c

index 6ce09d473733228b20b42871438e60150536d0ae..0e587c3ff06500b1433e230a152d24f260674294 100644 (file)
@@ -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;
 }