There are per-machine type variations on which usb controller will be
picked on an x86_64 machine. Add test cases where a USB controller is
completely missing to cover all 3 cases ('isapc', 'pc', 'q35')
when an
USB controller is not explicitly requested by the user.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
...troller-implicit-i440fx.x86_64-latest.args | 32 ++++++++++++++
.../usb-controller-implicit-i440fx.xml | 15 +++++++
...ntroller-implicit-isapc.x86_64-latest.args | 32 ++++++++++++++
.../usb-controller-implicit-isapc.xml | 15 +++++++
...controller-implicit-q35.x86_64-latest.args | 36 ++++++++++++++++
.../usb-controller-implicit-q35.xml | 15 +++++++
tests/qemuxml2argvtest.c | 3 ++
...ntroller-implicit-i440fx.x86_64-latest.xml | 29 +++++++++++++
...ontroller-implicit-isapc.x86_64-latest.xml | 25 +++++++++++
...-controller-implicit-q35.x86_64-latest.xml | 43 +++++++++++++++++++
tests/qemuxml2xmltest.c | 3 ++
11 files changed, 248 insertions(+)
create mode 100644
tests/qemuxml2argvdata/usb-controller-implicit-i440fx.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/usb-controller-implicit-i440fx.xml
create mode 100644
tests/qemuxml2argvdata/usb-controller-implicit-isapc.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/usb-controller-implicit-isapc.xml
create mode 100644 tests/qemuxml2argvdata/usb-controller-implicit-q35.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/usb-controller-implicit-q35.xml
create mode 100644
tests/qemuxml2xmloutdata/usb-controller-implicit-i440fx.x86_64-latest.xml
create mode 100644
tests/qemuxml2xmloutdata/usb-controller-implicit-isapc.x86_64-latest.xml
create mode 100644
tests/qemuxml2xmloutdata/usb-controller-implicit-q35.x86_64-latest.xml
diff --git a/tests/qemuxml2argvdata/usb-controller-implicit-i440fx.x86_64-latest.args
b/tests/qemuxml2argvdata/usb-controller-implicit-i440fx.x86_64-latest.args
new file mode 100644
index 0000000000..e4be4266bb
--- /dev/null
+++ b/tests/qemuxml2argvdata/usb-controller-implicit-i440fx.x86_64-latest.args
@@ -0,0 +1,32 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object
'{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}'
\
+-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \
+-accel tcg \
+-cpu qemu64 \
+-m size=219136k \
+-object
'{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}'
\
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-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":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}'
\
+-audiodev
'{"id":"audio1","driver":"none"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/usb-controller-implicit-i440fx.xml
b/tests/qemuxml2argvdata/usb-controller-implicit-i440fx.xml
new file mode 100644
index 0000000000..fc48ea3cde
--- /dev/null
+++ b/tests/qemuxml2argvdata/usb-controller-implicit-i440fx.xml
@@ -0,0 +1,15 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</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='x86_64' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/usb-controller-implicit-isapc.x86_64-latest.args
b/tests/qemuxml2argvdata/usb-controller-implicit-isapc.x86_64-latest.args
new file mode 100644
index 0000000000..62dc26ee8b
--- /dev/null
+++ b/tests/qemuxml2argvdata/usb-controller-implicit-isapc.x86_64-latest.args
@@ -0,0 +1,32 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object
'{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}'
\
+-machine isapc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \
+-accel tcg \
+-cpu 486 \
+-m size=219136k \
+-object
'{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}'
\
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-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 \
+-usb \
+-audiodev
'{"id":"audio1","driver":"none"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/usb-controller-implicit-isapc.xml
b/tests/qemuxml2argvdata/usb-controller-implicit-isapc.xml
new file mode 100644
index 0000000000..21be5b8cdf
--- /dev/null
+++ b/tests/qemuxml2argvdata/usb-controller-implicit-isapc.xml
@@ -0,0 +1,15 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</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='x86_64' machine='isapc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/usb-controller-implicit-q35.x86_64-latest.args
b/tests/qemuxml2argvdata/usb-controller-implicit-q35.x86_64-latest.args
new file mode 100644
index 0000000000..9a660060a9
--- /dev/null
+++ b/tests/qemuxml2argvdata/usb-controller-implicit-q35.x86_64-latest.args
@@ -0,0 +1,36 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object
'{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}'
\
+-machine q35,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \
+-accel tcg \
+-cpu qemu64 \
+-m size=219136k \
+-object
'{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}'
\
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-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":"pcie-root-port","port":8,"chassis":1,"id":"pci.1","bus":"pcie.0","multifunction":true,"addr":"0x1"}'
\
+-device
'{"driver":"pcie-root-port","port":9,"chassis":2,"id":"pci.2","bus":"pcie.0","addr":"0x1.0x1"}'
\
+-device
'{"driver":"qemu-xhci","id":"usb","bus":"pci.1","addr":"0x0"}'
\
+-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/qemuxml2argvdata/usb-controller-implicit-q35.xml
b/tests/qemuxml2argvdata/usb-controller-implicit-q35.xml
new file mode 100644
index 0000000000..ddeeadca97
--- /dev/null
+++ b/tests/qemuxml2argvdata/usb-controller-implicit-q35.xml
@@ -0,0 +1,15 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</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='x86_64' machine='q35'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 6c10af0ec2..45df4f4bae 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1500,6 +1500,9 @@ mymain(void)
DO_TEST_PARSE_ERROR("chardev-reconnect-generated-path",
QEMU_CAPS_CHARDEV_RECONNECT);
+ DO_TEST_CAPS_LATEST("usb-controller-implicit-isapc");
+ DO_TEST_CAPS_LATEST("usb-controller-implicit-i440fx");
+ DO_TEST_CAPS_LATEST("usb-controller-implicit-q35");
DO_TEST_NOCAPS("usb-none");
DO_TEST_NOCAPS("usb-controller");
diff --git a/tests/qemuxml2xmloutdata/usb-controller-implicit-i440fx.x86_64-latest.xml
b/tests/qemuxml2xmloutdata/usb-controller-implicit-i440fx.x86_64-latest.xml
new file mode 100644
index 0000000000..89631180ac
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/usb-controller-implicit-i440fx.x86_64-latest.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</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='x86_64' machine='pc'>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='usb' index='0' model='piix3-uhci'>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <audio id='1' type='none'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/usb-controller-implicit-isapc.x86_64-latest.xml
b/tests/qemuxml2xmloutdata/usb-controller-implicit-isapc.x86_64-latest.xml
new file mode 100644
index 0000000000..6331aade72
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/usb-controller-implicit-isapc.x86_64-latest.xml
@@ -0,0 +1,25 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</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='x86_64' machine='isapc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <cpu mode='custom' match='exact' check='none'>
+ <model fallback='forbid'>486</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>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <audio id='1' type='none'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/usb-controller-implicit-q35.x86_64-latest.xml
b/tests/qemuxml2xmloutdata/usb-controller-implicit-q35.x86_64-latest.xml
new file mode 100644
index 0000000000..8368fe57ba
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/usb-controller-implicit-q35.x86_64-latest.xml
@@ -0,0 +1,43 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</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='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='usb' index='0' model='qemu-xhci'>
+ <address type='pci' domain='0x0000' bus='0x01'
slot='0x00' function='0x0'/>
+ </controller>
+ <controller type='sata' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x1f' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pcie-root'/>
+ <controller type='pci' index='1'
model='pcie-root-port'>
+ <model name='pcie-root-port'/>
+ <target chassis='1' port='0x8'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x0' multifunction='on'/>
+ </controller>
+ <controller type='pci' index='2'
model='pcie-root-port'>
+ <model name='pcie-root-port'/>
+ <target chassis='2' port='0x9'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x1'/>
+ </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/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index a958daf56d..3157072c5c 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -482,6 +482,9 @@ mymain(void)
DO_TEST_CAPS_LATEST("virtio-lun");
DO_TEST_CAPS_LATEST("usb-none");
+ DO_TEST_CAPS_LATEST("usb-controller-implicit-isapc");
+ DO_TEST_CAPS_LATEST("usb-controller-implicit-i440fx");
+ DO_TEST_CAPS_LATEST("usb-controller-implicit-q35");
DO_TEST_CAPS_LATEST("usb-controller");
DO_TEST_CAPS_LATEST("usb-controller-piix3");
DO_TEST_CAPS_LATEST("usb-controller-ich9-ehci-addr");
--
2.41.0