]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: Fix some usb-controller-*-unavailable cases
authorAndrea Bolognani <abologna@redhat.com>
Tue, 5 Aug 2025 16:28:44 +0000 (18:28 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Mon, 6 Oct 2025 09:15:23 +0000 (11:15 +0200)
These tests are intended to show what happens when the device
that libvirt would use by default is not available in QEMU by
dropping the corresponding capabilities, but we're not doing
that correctly at the moment and so we still get the default
USB controller instead of a failure.

Specifically, we should be dropping all capabilities related
to devices that might be used as default or automatic USB
controllers for the machine type so that libvirt will report
an error, but for these few tests we are currently only
listing a subset of the capabilities that we should be
dropping.

Note that the usb-controller-automatic-unavailable tests are
still behaving the same despite dropping all the expected
capabilities: the reason is that, for that scenario, we're
not currently checking whether the device is available before
using it. That's a separate issue that will be addressed in an
upcoming commit.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/qemuxmlconfdata/usb-controller-default-unavailable-nousb.aarch64-latest.args [deleted file]
tests/qemuxmlconfdata/usb-controller-default-unavailable-nousb.aarch64-latest.err [new file with mode: 0644]
tests/qemuxmlconfdata/usb-controller-default-unavailable-nousb.aarch64-latest.xml
tests/qemuxmlconfdata/usb-controller-default-unavailable-realview.aarch64-latest.args [deleted file]
tests/qemuxmlconfdata/usb-controller-default-unavailable-realview.aarch64-latest.err [new file with mode: 0644]
tests/qemuxmlconfdata/usb-controller-default-unavailable-realview.aarch64-latest.xml
tests/qemuxmlconftest.c

diff --git a/tests/qemuxmlconfdata/usb-controller-default-unavailable-nousb.aarch64-latest.args b/tests/qemuxmlconfdata/usb-controller-default-unavailable-nousb.aarch64-latest.args
deleted file mode 100644 (file)
index 0fb2909..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-LC_ALL=C \
-PATH=/bin \
-HOME=/var/lib/libvirt/qemu/domain--1-aarch64test \
-USER=test \
-LOGNAME=test \
-XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.local/share \
-XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.cache \
-XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.config \
-/usr/bin/qemu-system-aarch64 \
--name guest=aarch64test,debug-threads=on \
--S \
--object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-aarch64test/master-key.aes"}' \
--machine collie,usb=off,dump-guest-core=off,memory-backend=strongarm.sdram \
--accel kvm \
--cpu host \
--m size=1048576k \
--object '{"qom-type":"memory-backend-ram","id":"strongarm.sdram","size":1073741824}' \
--overcommit mem-lock=off \
--smp 1,sockets=1,cores=1,threads=1 \
--uuid 6ba410c5-1e5c-4d57-bee7-2228e7ffa32f \
--display none \
--no-user-config \
--nodefaults \
--chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
--mon chardev=charmonitor,id=monitor,mode=control \
--rtc base=utc \
--no-shutdown \
--boot strict=on \
--device '{"driver":"qemu-xhci","id":"usb"}' \
--audiodev '{"id":"audio1","driver":"none"}' \
--sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
--msg timestamp=on
diff --git a/tests/qemuxmlconfdata/usb-controller-default-unavailable-nousb.aarch64-latest.err b/tests/qemuxmlconfdata/usb-controller-default-unavailable-nousb.aarch64-latest.err
new file mode 100644 (file)
index 0000000..cac4e8e
--- /dev/null
@@ -0,0 +1 @@
+internal error: Unable to determine model for USB controller idx=0
index fa258c56714082aab1e4f0a7138d58e61cccbd03..ac5f270a3a190bf8d58defa7c8429d2c89a8fb9f 100644 (file)
@@ -15,7 +15,7 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-aarch64</emulator>
-    <controller type='usb' index='0' model='qemu-xhci'/>
+    <controller type='usb' index='0'/>
     <audio id='1' type='none'/>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxmlconfdata/usb-controller-default-unavailable-realview.aarch64-latest.args b/tests/qemuxmlconfdata/usb-controller-default-unavailable-realview.aarch64-latest.args
deleted file mode 100644 (file)
index 446ca8a..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-LC_ALL=C \
-PATH=/bin \
-HOME=/var/lib/libvirt/qemu/domain--1-aarch64test \
-USER=test \
-LOGNAME=test \
-XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.local/share \
-XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.cache \
-XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.config \
-/usr/bin/qemu-system-aarch64 \
--name guest=aarch64test,debug-threads=on \
--S \
--object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-aarch64test/master-key.aes"}' \
--machine realview-pbx-a9,usb=off,dump-guest-core=off \
--accel kvm \
--cpu host \
--m size=1048576k \
--overcommit mem-lock=off \
--smp 1,sockets=1,cores=1,threads=1 \
--uuid 6ba410c5-1e5c-4d57-bee7-2228e7ffa32f \
--display none \
--no-user-config \
--nodefaults \
--chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
--mon chardev=charmonitor,id=monitor,mode=control \
--rtc base=utc \
--no-shutdown \
--boot strict=on \
--device '{"driver":"qemu-xhci","id":"usb"}' \
--audiodev '{"id":"audio1","driver":"none"}' \
--sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
--msg timestamp=on
diff --git a/tests/qemuxmlconfdata/usb-controller-default-unavailable-realview.aarch64-latest.err b/tests/qemuxmlconfdata/usb-controller-default-unavailable-realview.aarch64-latest.err
new file mode 100644 (file)
index 0000000..cac4e8e
--- /dev/null
@@ -0,0 +1 @@
+internal error: Unable to determine model for USB controller idx=0
index f37501b76919d46fab7799a96cdda0de3c7b3dea..dfa8ef8dbeab097e882c35a429825f5318b38640 100644 (file)
@@ -15,7 +15,7 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-aarch64</emulator>
-    <controller type='usb' index='0' model='qemu-xhci'/>
+    <controller type='usb' index='0'/>
     <audio id='1' type='none'/>
     <memballoon model='none'/>
   </devices>
index f00b5c537b657b5d57344804417179a0ccd3503c..491ff4047a0055b2227d7bffc608c6784adba293 100644 (file)
@@ -2090,7 +2090,7 @@ mymain(void)
                  ARG_CAPS_ARCH, "armv7l",
                  ARG_CAPS_VER, "latest",
                  ARG_FLAGS, FLAG_EXPECT_FAILURE,
-                 ARG_QEMU_CAPS_DEL, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_LAST,
+                 ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_LAST,
                  ARG_END);
 
     DO_TEST_CAPS_ARCH_LATEST("usb-controller-automatic-realview", "aarch64");
@@ -2098,7 +2098,7 @@ mymain(void)
                  ARG_CAPS_ARCH, "aarch64",
                  ARG_CAPS_VER, "latest",
                  ARG_FLAGS, FLAG_EXPECT_FAILURE,
-                 ARG_QEMU_CAPS_DEL, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_LAST,
+                 ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_LAST,
                  ARG_END);
 
     DO_TEST_FULL("usb-controller-automatic-unavailable-pseries", ".ppc64-latest",
@@ -2209,7 +2209,7 @@ mymain(void)
                  ARG_CAPS_ARCH, "armv7l",
                  ARG_CAPS_VER, "latest",
                  ARG_FLAGS, FLAG_EXPECT_FAILURE,
-                 ARG_QEMU_CAPS_DEL, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_LAST,
+                 ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_LAST,
                  ARG_END);
 
     DO_TEST_CAPS_ARCH_LATEST("usb-controller-default-realview", "aarch64");
@@ -2221,7 +2221,8 @@ mymain(void)
     DO_TEST_FULL("usb-controller-default-unavailable-realview", ".aarch64-latest",
                  ARG_CAPS_ARCH, "aarch64",
                  ARG_CAPS_VER, "latest",
-                 ARG_QEMU_CAPS_DEL, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_LAST,
+                 ARG_FLAGS, FLAG_EXPECT_FAILURE,
+                 ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_LAST,
                  ARG_END);
 
     /* The '-nousb' test case tests machine without a built-in USB controller */
@@ -2234,7 +2235,8 @@ mymain(void)
     DO_TEST_FULL("usb-controller-default-unavailable-nousb", ".aarch64-latest",
                  ARG_CAPS_ARCH, "aarch64",
                  ARG_CAPS_VER, "latest",
-                 ARG_QEMU_CAPS_DEL, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_LAST,
+                 ARG_FLAGS, FLAG_EXPECT_FAILURE,
+                 ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_LAST,
                  ARG_END);
 
     DO_TEST_FULL("usb-controller-default-fallback-g3beige", ".ppc64-latest",