From 8daa94cd8ef7871da40d13cdaca4385c483b4f83 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 20 Oct 2022 13:32:34 +0200 Subject: [PATCH] virschematest: Add infrastructure for testing single devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce an internal schema for a single device and use it to test the various files in tests/qemuhotplugtestdevices and tests/qemublocktestdata directories. This also requires us to implement schema for (some) privateData bits for the disk source. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- tests/schemas/device.rng.in | 51 ++++++++++++++++++++++++ tests/schemas/meson.build | 2 + tests/schemas/privatedata.rng.in | 68 ++++++++++++++++++++++++++++++++ tests/virschematest.c | 7 ++++ 4 files changed, 128 insertions(+) create mode 100644 tests/schemas/device.rng.in create mode 100644 tests/schemas/privatedata.rng.in diff --git a/tests/schemas/device.rng.in b/tests/schemas/device.rng.in new file mode 100644 index 0000000000..b322b5275e --- /dev/null +++ b/tests/schemas/device.rng.in @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/schemas/meson.build b/tests/schemas/meson.build index 33c16bb2fb..851355d4e9 100644 --- a/tests/schemas/meson.build +++ b/tests/schemas/meson.build @@ -5,6 +5,8 @@ virschematest_test_schemas_conf = configuration_data({ virschematest_schemas = [ 'cpu-baseline.rng.in', + 'device.rng.in', + 'privatedata.rng.in', ] foreach file : virschematest_schemas diff --git a/tests/schemas/privatedata.rng.in b/tests/schemas/privatedata.rng.in new file mode 100644 index 0000000000..945f7a06b3 --- /dev/null +++ b/tests/schemas/privatedata.rng.in @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + storage + format + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/virschematest.c b/tests/virschematest.c index 29a1d59134..fcf3838630 100644 --- a/tests/virschematest.c +++ b/tests/virschematest.c @@ -322,6 +322,12 @@ static const struct testSchemaEntry testsCpuBaseline[] = { { . dir = "tests/cputestdata" }, }; +static const struct testSchemaEntry testDevice[] = { + { .dir = "tests/qemuhotplugtestdevices" }, + { .dir = "tests/qemublocktestdata/imagecreate" }, + { .dir = "tests/qemublocktestdata/xml2json" }, +}; + static int mymain(void) { @@ -352,6 +358,7 @@ mymain(void) DO_TEST(SCHEMAS_PATH "storagevol.rng", schemaStorageVol); DO_TEST(INTERNAL_SCHEMAS_PATH "cpu-baseline.rng", testsCpuBaseline); + DO_TEST(INTERNAL_SCHEMAS_PATH "device.rng", testDevice); return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; }