This demonstrates how, when a machine type for which a default
USB controller is usually not added automatically is used,
including USB devices in the configuration results in an error.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
...th-devices-virt-aarch64.aarch64-latest.err | 1 +
...th-devices-virt-aarch64.aarch64-latest.xml | 28 +++++++++++++++++++
...er-automatic-with-devices-virt-aarch64.xml | 14 ++++++++++
tests/qemuxmlconftest.c | 2 ++
4 files changed, 45 insertions(+)
create mode 100644 tests/qemuxmlconfdata/usb-controller-automatic-with-devices-virt-aarch64.aarch64-latest.err
create mode 100644 tests/qemuxmlconfdata/usb-controller-automatic-with-devices-virt-aarch64.aarch64-latest.xml
create mode 100644 tests/qemuxmlconfdata/usb-controller-automatic-with-devices-virt-aarch64.xml
diff --git a/tests/qemuxmlconfdata/usb-controller-automatic-with-devices-virt-aarch64.aarch64-latest.err b/tests/qemuxmlconfdata/usb-controller-automatic-with-devices-virt-aarch64.aarch64-latest.err
new file mode 100644
index 0000000000..90050be94b
--- /dev/null
+++ b/tests/qemuxmlconfdata/usb-controller-automatic-with-devices-virt-aarch64.aarch64-latest.err
@@ -0,0 +1 @@
+unsupported configuration: USB is disabled for this domain, but USB devices are present in the domain XML
diff --git a/tests/qemuxmlconfdata/usb-controller-automatic-with-devices-virt-aarch64.aarch64-latest.xml b/tests/qemuxmlconfdata/usb-controller-automatic-with-devices-virt-aarch64.aarch64-latest.xml
new file mode 100644
index 0000000000..431ff6703b
--- /dev/null
+++ b/tests/qemuxmlconfdata/usb-controller-automatic-with-devices-virt-aarch64.aarch64-latest.xml
@@ -0,0 +1,28 @@
+<domain type='qemu'>
+ <name>test</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='aarch64' machine='virt'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <gic version='2'/>
+ </features>
+ <cpu mode='custom' match='exact' check='none'>
+ <model fallback='forbid'>cortex-a15</model>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-aarch64</emulator>
+ <controller type='pci' index='0' model='pcie-root'/>
+ <input type='tablet' bus='usb'/>
+ <input type='keyboard' bus='usb'/>
+ <audio id='1' type='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxmlconfdata/usb-controller-automatic-with-devices-virt-aarch64.xml b/tests/qemuxmlconfdata/usb-controller-automatic-with-devices-virt-aarch64.xml
new file mode 100644
index 0000000000..1d0e1bb3c5
--- /dev/null
+++ b/tests/qemuxmlconfdata/usb-controller-automatic-with-devices-virt-aarch64.xml
@@ -0,0 +1,14 @@
+<domain type='qemu'>
+ <name>test</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='aarch64' machine='virt'>hvm</type>
+ </os>
+ <devices>
+ <emulator>/usr/bin/qemu-system-aarch64</emulator>
+ <input type='tablet' bus='usb'/>
+ <input type='keyboard' bus='usb'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index 89b8ad1a35..835a388263 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -2141,6 +2141,8 @@ mymain(void)
ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_LAST,
ARG_END);
+ DO_TEST_CAPS_ARCH_LATEST_FAILURE("usb-controller-automatic-with-devices-virt-aarch64", "aarch64");
+
DO_TEST_CAPS_LATEST_PARSE_ERROR("usb-controller-default-isapc");
DO_TEST_CAPS_LATEST_PARSE_ERROR("usb-controller-default-microvm");
DO_TEST_CAPS_LATEST("usb-controller-default-i440fx");
--
2.52.0
© 2016 - 2026 Red Hat, Inc.