For q35 guests, we normally add a USB controller by default, but there's a scenario in which we can decide to skip it. Add test coverage for it. Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> --- ...tomatic-unavailable-q35.x86_64-latest.args | 33 +++++++++++++++++++ ...utomatic-unavailable-q35.x86_64-latest.xml | 30 +++++++++++++++++ ...b-controller-automatic-unavailable-q35.xml | 20 +++++++++++ tests/qemuxmlconftest.c | 9 +++++ 4 files changed, 92 insertions(+) create mode 100644 tests/qemuxmlconfdata/usb-controller-automatic-unavailable-q35.x86_64-latest.args create mode 100644 tests/qemuxmlconfdata/usb-controller-automatic-unavailable-q35.x86_64-latest.xml create mode 100644 tests/qemuxmlconfdata/usb-controller-automatic-unavailable-q35.xml diff --git a/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-q35.x86_64-latest.args b/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-q35.x86_64-latest.args new file mode 100644 index 0000000000..e883ce10cc --- /dev/null +++ b/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-q35.x86_64-latest.args @@ -0,0 +1,33 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/var/lib/libvirt/qemu/domain--1-q35-test \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-q35-test/.local/share \ +XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-q35-test/.cache \ +XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-q35-test/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=q35-test,debug-threads=on \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-q35-test/master-key.aes"}' \ +-machine q35,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \ +-accel tcg \ +-cpu qemu64 \ +-m size=2097152k \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":2147483648}' \ +-overcommit mem-lock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 \ +-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 \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-global ICH9-LPC.noreboot=off \ +-watchdog-action reset \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-q35.x86_64-latest.xml b/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-q35.x86_64-latest.xml new file mode 100644 index 0000000000..11ca806c63 --- /dev/null +++ b/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-q35.x86_64-latest.xml @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>q35-test</name> + <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid> + <memory unit='KiB'>2097152</memory> + <currentMemory unit='KiB'>2097152</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='q35'>hvm</type> + <boot dev='hd'/> + </os> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</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-x86_64</emulator> + <controller type='pci' index='0' model='pcie-root'/> + <controller type='sata' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/> + </controller> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <audio id='1' type='none'/> + <watchdog model='itco' action='reset'/> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-q35.xml b/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-q35.xml new file mode 100644 index 0000000000..d89dc4afe8 --- /dev/null +++ b/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-q35.xml @@ -0,0 +1,20 @@ +<domain type='qemu'> + <name>q35-test</name> + <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid> + <memory unit='KiB'>2097152</memory> + <currentMemory unit='KiB'>2097152</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='q35'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pcie-root'/> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c index b6fb5e5052..301c683448 100644 --- a/tests/qemuxmlconftest.c +++ b/tests/qemuxmlconftest.c @@ -1817,12 +1817,21 @@ mymain(void) ARG_CAPS_VER, "latest", ARG_QEMU_CAPS_DEL, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_LAST, ARG_END); + /* q35 fails instead */ DO_TEST_FULL("usb-controller-default-unavailable-q35", ".x86_64-latest", ARG_CAPS_ARCH, "x86_64", ARG_CAPS_VER, "latest", ARG_FLAGS, FLAG_EXPECT_FAILURE, ARG_QEMU_CAPS_DEL, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_LAST, ARG_END); + /* However, if the USB controller is the one that gets added + * automatically for every guest instead of one that the user has + * explicitly asked for, we prefer simply skipping it */ + DO_TEST_FULL("usb-controller-automatic-unavailable-q35", ".x86_64-latest", + ARG_CAPS_ARCH, "x86_64", + ARG_CAPS_VER, "latest", + ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_LAST, + ARG_END); DO_TEST_CAPS_LATEST("usb-none"); -- 2.43.0 _______________________________________________ Devel mailing list -- devel@xxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx