From 0eebdce995a16cafc1d014a1907b165a5e364d65 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Fri, 21 Apr 2023 09:56:20 +0200 Subject: [PATCH] qemuhotplugtest: Verify domain XML on UPDATE Just like we check the resulting domain XML after ATTACH and DETACH, we should do the same after UPDATE action. This is as simple as calling testQemuHotplugCheckResult() and providing missing XMLs. For those test cases where no change is done, we can just make the expected XML a symlink to the input XML. Signed-off-by: Michal Privoznik Reviewed-by: Kristina Hanicova --- tests/qemuhotplugtest.c | 9 +- ...hotplug-disk-cdrom+disk-cdrom-nochange.xml | 1 + .../qemuhotplug-disk-cdrom.xml | 30 ++++- ...graphics-spice+graphics-spice-nochange.xml | 1 + ...graphics-spice-listen-network-password.xml | 71 +++++++++++ ...imeout+graphics-spice-timeout-nochange.xml | 1 + ...imeout+graphics-spice-timeout-password.xml | 117 ++++++++++++++++++ .../qemuhotplug-graphics-spice-timeout.xml | 50 ++++++-- .../qemuhotplug-graphics-spice.xml | 41 ++++-- 9 files changed, 295 insertions(+), 26 deletions(-) create mode 120000 tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom+disk-cdrom-nochange.xml create mode 120000 tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice+graphics-spice-nochange.xml create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-listen-network+graphics-spice-listen-network-password.xml create mode 120000 tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout+graphics-spice-timeout-nochange.xml create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout+graphics-spice-timeout-password.xml diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index d571cd38dc..5666e87f75 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -123,7 +123,7 @@ testQemuHotplugCheckResult(virDomainObj *vm, if (!actual) return -1; - if (STREQ(expected, actual)) { + if (STREQ_NULLABLE(expected, actual)) { if (fail) VIR_TEST_VERBOSE("domain XML should not match the expected result"); ret = 0; @@ -170,7 +170,9 @@ testQemuHotplug(const void *data) virTestLoadFile(device_filename, &device_xml) < 0) goto cleanup; - if (test->action == ATTACH && + if (!fail && + (test->action == ATTACH || + test->action == UPDATE) && virTestLoadFile(result_filename, &result_xml) < 0) goto cleanup; @@ -243,6 +245,9 @@ testQemuHotplug(const void *data) case UPDATE: ret = qemuDomainUpdateDeviceLive(vm, dev, &driver, false); + if (ret == 0 || fail) + ret = testQemuHotplugCheckResult(vm, result_xml, + result_filename, fail); } virObjectLock(priv->mon); diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom+disk-cdrom-nochange.xml b/tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom+disk-cdrom-nochange.xml new file mode 120000 index 0000000000..e07b01b301 --- /dev/null +++ b/tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom+disk-cdrom-nochange.xml @@ -0,0 +1 @@ +qemuhotplug-disk-cdrom.xml \ No newline at end of file diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom.xml b/tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom.xml index 3acf55ab17..bcf4cf9bf8 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom.xml @@ -1,4 +1,4 @@ - + QEMUGuest1 c7a5fdbd-edaf-9455-926a-d65c16db1809 219100 @@ -8,6 +8,9 @@ hvm + + qemu64 + destroy restart @@ -18,6 +21,7 @@ +
@@ -25,13 +29,27 @@ +
- - - - - + + +
+ + + +
+ + + + + + + + + + +