From: Michal Privoznik Date: Fri, 21 Apr 2023 07:56:20 +0000 (+0200) Subject: qemuhotplugtest: Verify domain XML on UPDATE X-Git-Tag: v9.3.0-rc1~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0eebdce995a16cafc1d014a1907b165a5e364d65;p=thirdparty%2Flibvirt.git 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 --- 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 @@ +
- - - - - + + +
+ + + +
+ + + + + + + + + + +