[PATCH 08/24] qemuxml2xmloutdata: Workaround wrong detection of 'disk-cdrom-empty-network-invalid' in virschematest

Peter Krempa pkrempa at redhat.com
Thu Aug 17 11:41:28 UTC 2023


The 'disk-cdrom-empty-network-invalid' is a special case were the input
XML is invalid according to the schema, but after processing a valid XML
is produced.

This corner case doesn't play well with 'virschematest' which uses the
file suffix to determine whether the file is invalid.

Upcoming patch will change the 'virschematest' condition, which would
start detecting this XML as invalid.

Use the '-active'/'-inactive' suffix for the file, which is possible
with qemuxml2xmltest so that an upcoming patch will not cause test
failure.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 ... disk-cdrom-empty-network-invalid-active.x86_64-latest.xml} | 0
 ...disk-cdrom-empty-network-invalid-inactive.x86_64-latest.xml | 1 +
 tests/qemuxml2xmltest.c                                        | 3 +++
 3 files changed, 4 insertions(+)
 rename tests/qemuxml2xmloutdata/{disk-cdrom-empty-network-invalid.x86_64-latest.xml => disk-cdrom-empty-network-invalid-active.x86_64-latest.xml} (100%)
 create mode 120000 tests/qemuxml2xmloutdata/disk-cdrom-empty-network-invalid-inactive.x86_64-latest.xml

diff --git a/tests/qemuxml2xmloutdata/disk-cdrom-empty-network-invalid.x86_64-latest.xml b/tests/qemuxml2xmloutdata/disk-cdrom-empty-network-invalid-active.x86_64-latest.xml
similarity index 100%
rename from tests/qemuxml2xmloutdata/disk-cdrom-empty-network-invalid.x86_64-latest.xml
rename to tests/qemuxml2xmloutdata/disk-cdrom-empty-network-invalid-active.x86_64-latest.xml
diff --git a/tests/qemuxml2xmloutdata/disk-cdrom-empty-network-invalid-inactive.x86_64-latest.xml b/tests/qemuxml2xmloutdata/disk-cdrom-empty-network-invalid-inactive.x86_64-latest.xml
new file mode 120000
index 0000000000..9733ff06a7
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/disk-cdrom-empty-network-invalid-inactive.x86_64-latest.xml
@@ -0,0 +1 @@
+disk-cdrom-empty-network-invalid-active.x86_64-latest.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 21eb43d00b..10ea638366 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -284,6 +284,9 @@ mymain(void)
     DO_TEST_NOCAPS("disk-aio");
     DO_TEST_CAPS_LATEST("disk-aio-io_uring");
     DO_TEST_NOCAPS("disk-cdrom");
+    /* The 'disk-cdrom-empty-network-invalid' test case uses separate
+     * '-active'/'-inactive' output files to work around 'virschematest'
+     * thinking the output file is invalid XML */
     DO_TEST_CAPS_LATEST("disk-cdrom-empty-network-invalid");
     DO_TEST_CAPS_LATEST("disk-cdrom-network");
     DO_TEST("disk-cdrom-bus-other", QEMU_CAPS_DEVICE_USB_STORAGE);
-- 
2.41.0



More information about the libvir-list mailing list