[PATCH v2 4/7] qemuxml2argvtest: Use real-caps testing for 'acpi-hotplug-bridge-disable'

Peter Krempa pkrempa at redhat.com
Mon Oct 11 13:02:09 UTC 2021


We can use real example configs to prove the support without the
need for using fake capabilities. Fix the recently added test cases.

The negative case for 'pc-i440fx-acpi-hotplug-bridge-disable' is removed
completely as there is no real qemu libvirt supports which wouldn't
have the capability.

Fixes: bef0f0d8be6
Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 ...pi-hotplug-bridge-disable.aarch64-latest.err |  1 +
 .../aarch64-acpi-hotplug-bridge-disable.err     |  1 -
 ...i-hotplug-bridge-disable.x86_64-latest.args} | 15 +++++++++------
 .../q35-acpi-hotplug-bridge-disable.err         |  1 -
 ...cpi-hotplug-bridge-disable.x86_64-6.0.0.err} |  0
 ...i-hotplug-bridge-disable.x86_64-latest.args} | 14 +++++++++-----
 tests/qemuxml2argvtest.c                        | 17 ++++-------------
 7 files changed, 23 insertions(+), 26 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/aarch64-acpi-hotplug-bridge-disable.aarch64-latest.err
 delete mode 100644 tests/qemuxml2argvdata/aarch64-acpi-hotplug-bridge-disable.err
 rename tests/qemuxml2argvdata/{pc-i440fx-acpi-hotplug-bridge-disable.args => pc-i440fx-acpi-hotplug-bridge-disable.x86_64-latest.args} (55%)
 delete mode 100644 tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.err
 rename tests/qemuxml2argvdata/{pc-i440fx-acpi-hotplug-bridge-disable.err => q35-acpi-hotplug-bridge-disable.x86_64-6.0.0.err} (100%)
 rename tests/qemuxml2argvdata/{q35-acpi-hotplug-bridge-disable.args => q35-acpi-hotplug-bridge-disable.x86_64-latest.args} (61%)

diff --git a/tests/qemuxml2argvdata/aarch64-acpi-hotplug-bridge-disable.aarch64-latest.err b/tests/qemuxml2argvdata/aarch64-acpi-hotplug-bridge-disable.aarch64-latest.err
new file mode 100644
index 0000000000..139591fce3
--- /dev/null
+++ b/tests/qemuxml2argvdata/aarch64-acpi-hotplug-bridge-disable.aarch64-latest.err
@@ -0,0 +1 @@
+XML error: The PCI controller with index='0' must be model='pcie-root' for this machine type, but model='pci-root' was found instead
diff --git a/tests/qemuxml2argvdata/aarch64-acpi-hotplug-bridge-disable.err b/tests/qemuxml2argvdata/aarch64-acpi-hotplug-bridge-disable.err
deleted file mode 100644
index 9f0a88b826..0000000000
--- a/tests/qemuxml2argvdata/aarch64-acpi-hotplug-bridge-disable.err
+++ /dev/null
@@ -1 +0,0 @@
-unsupported configuration: acpi-bridge-hotplug is not available for architecture 'aarch64'
diff --git a/tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-disable.args b/tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-disable.x86_64-latest.args
similarity index 55%
rename from tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-disable.args
rename to tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-disable.x86_64-latest.args
index a1e5dc85c7..26de6c81ec 100644
--- a/tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-disable.args
+++ b/tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-disable.x86_64-latest.args
@@ -6,26 +6,29 @@ LOGNAME=test \
 XDG_DATA_HOME=/tmp/lib/domain--1-i440fx/.local/share \
 XDG_CACHE_HOME=/tmp/lib/domain--1-i440fx/.cache \
 XDG_CONFIG_HOME=/tmp/lib/domain--1-i440fx/.config \
-QEMU_AUDIO_DRV=none \
 /usr/bin/qemu-system-x86_64 \
 -name guest=i440fx,debug-threads=on \
 -S \
--object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-i440fx/master-key.aes \
--machine pc-i440fx-2.5,accel=tcg,usb=off,dump-guest-core=off \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-i440fx/master-key.aes"}' \
+-machine pc-i440fx-2.5,accel=tcg,usb=off,dump-guest-core=off,memory-backend=pc.ram \
+-cpu qemu64 \
 -m 1024 \
--realtime mlock=off \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}' \
+-overcommit mem-lock=off \
 -smp 1,sockets=1,cores=1,threads=1 \
 -uuid 56f5055c-1b8d-490c-844a-ad646a1caaaa \
 -display none \
 -no-user-config \
 -nodefaults \
--chardev socket,id=charmonitor,path=/tmp/lib/domain--1-i440fx/monitor.sock,server=on,wait=off \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
 -mon chardev=charmonitor,id=monitor,mode=control \
 -rtc base=utc \
 -no-shutdown \
 -no-acpi \
 -global PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off \
 -boot strict=on \
--usb \
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
+-audiodev id=audio1,driver=none \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.err b/tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.err
deleted file mode 100644
index 8c09a3cd76..0000000000
--- a/tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.err
+++ /dev/null
@@ -1 +0,0 @@
-unsupported configuration: acpi-bridge-hotplug is not available with this QEMU binary
diff --git a/tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-disable.err b/tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.x86_64-6.0.0.err
similarity index 100%
rename from tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-disable.err
rename to tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.x86_64-6.0.0.err
diff --git a/tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.args b/tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.x86_64-latest.args
similarity index 61%
rename from tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.args
rename to tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.x86_64-latest.args
index 007c22c646..0c29f36738 100644
--- a/tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.args
+++ b/tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.x86_64-latest.args
@@ -6,20 +6,21 @@ LOGNAME=test \
 XDG_DATA_HOME=/tmp/lib/domain--1-q35/.local/share \
 XDG_CACHE_HOME=/tmp/lib/domain--1-q35/.cache \
 XDG_CONFIG_HOME=/tmp/lib/domain--1-q35/.config \
-QEMU_AUDIO_DRV=none \
 /usr/bin/qemu-system-x86_64 \
 -name guest=q35,debug-threads=on \
 -S \
--object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-q35/master-key.aes \
--machine pc-q35-2.5,accel=tcg,usb=off,dump-guest-core=off \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-q35/master-key.aes"}' \
+-machine pc-q35-2.5,accel=tcg,usb=off,dump-guest-core=off,memory-backend=pc.ram \
+-cpu qemu64 \
 -m 1024 \
--realtime mlock=off \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}' \
+-overcommit mem-lock=off \
 -smp 1,sockets=1,cores=1,threads=1 \
 -uuid 56f5055c-1b8d-490c-844a-ad646a1caaaa \
 -display none \
 -no-user-config \
 -nodefaults \
--chardev socket,id=charmonitor,path=/tmp/lib/domain--1-q35/monitor.sock,server=on,wait=off \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
 -mon chardev=charmonitor,id=monitor,mode=control \
 -rtc base=utc \
 -no-shutdown \
@@ -29,5 +30,8 @@ QEMU_AUDIO_DRV=none \
 -device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
 -device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \
 -device ioh3420,port=0x8,chassis=3,id=pci.3,bus=pcie.0,addr=0x1 \
+-device qemu-xhci,id=usb,bus=pci.3,addr=0x0 \
+-audiodev id=audio1,driver=none \
 -device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x1 \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 0224bd1854..0fad076877 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2561,22 +2561,13 @@ mymain(void)
             QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4);
     DO_TEST_CAPS_LATEST("pc-i440fx-acpi-root-hotplug-disable");
     DO_TEST_CAPS_VER_PARSE_ERROR("pc-i440fx-acpi-root-hotplug-disable", "5.1.0");
-    DO_TEST("q35-acpi-hotplug-bridge-disable",
-            QEMU_CAPS_DEVICE_PCI_BRIDGE,
-            QEMU_CAPS_DEVICE_IOH3420,
-            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_ICH9_AHCI,
-            QEMU_CAPS_ICH9_ACPI_HOTPLUG_BRIDGE);
-    DO_TEST("pc-i440fx-acpi-hotplug-bridge-disable",
-            QEMU_CAPS_DEVICE_PCI_BRIDGE,
-            QEMU_CAPS_DEVICE_IOH3420,
-            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
-            QEMU_CAPS_PIIX4_ACPI_HOTPLUG_BRIDGE);
-    DO_TEST_PARSE_ERROR_NOCAPS("q35-acpi-hotplug-bridge-disable");
-    DO_TEST_PARSE_ERROR_NOCAPS("pc-i440fx-acpi-hotplug-bridge-disable");
+    DO_TEST_CAPS_LATEST("q35-acpi-hotplug-bridge-disable");
+    DO_TEST_CAPS_LATEST("pc-i440fx-acpi-hotplug-bridge-disable");
+    DO_TEST_CAPS_VER_PARSE_ERROR("q35-acpi-hotplug-bridge-disable", "6.0.0");
     /* verify that we fail when acpi-bridge-hotplug option is specified for
      * archs other than x86
      */
-    DO_TEST_PARSE_ERROR_NOCAPS("aarch64-acpi-hotplug-bridge-disable");
+    DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("aarch64-acpi-hotplug-bridge-disable", "aarch64");
     DO_TEST("q35-usb2",
             QEMU_CAPS_DEVICE_PCI_BRIDGE,
             QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
-- 
2.31.1




More information about the libvir-list mailing list