Improve testing of an explicitly requested USB controller without a
model being provided.
For this purpose the 'usb-controller' case is renamed to
'usb-controller-default-i440fx'; 'usb-controller-default-q35' is moved
up to form a group. In both cases tests are covnerted to use
DO_TEST_CAPS_LATEST.
A new 'usb-controller-default-isapc' negative test case is added for
symmetry.
The negative test case 'usb-controller-default-unavailable-q35' is
converted to use latest caps, but stripping the default controller
instead of using fake caps. Additionally for symmetry
'usb-controller-default-unavailable-i440fx' is added although that
doesn't cause failure, but rather a graceful downgrade to use '-usb'.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
...ntroller-default-i440fx.x86_64-latest.args | 33 +++++++++++++++++++
....xml => usb-controller-default-i440fx.xml} | 0
...controller-default-isapc.x86_64-latest.err | 1 +
.../usb-controller-default-isapc.xml | 16 +++++++++
...controller-default-q35.x86_64-latest.args} | 0
...ult-unavailable-i440fx.x86_64-latest.args} | 0
...-controller-default-unavailable-i440fx.xml | 1 +
...default-unavailable-q35.x86_64-latest.err} | 0
tests/qemuxml2argvtest.c | 26 +++++++++------
...ntroller-default-i440fx.x86_64-latest.xml} | 0
...fault-unavailable-i440fx.x86_64-latest.xml | 31 +++++++++++++++++
tests/qemuxml2xmltest.c | 6 ++--
12 files changed, 102 insertions(+), 12 deletions(-)
create mode 100644
tests/qemuxml2argvdata/usb-controller-default-i440fx.x86_64-latest.args
rename tests/qemuxml2argvdata/{usb-controller.xml =>
usb-controller-default-i440fx.xml} (100%)
create mode 100644 tests/qemuxml2argvdata/usb-controller-default-isapc.x86_64-latest.err
create mode 100644 tests/qemuxml2argvdata/usb-controller-default-isapc.xml
rename tests/qemuxml2argvdata/{usb-controller-default-q35.args =>
usb-controller-default-q35.x86_64-latest.args} (100%)
rename tests/qemuxml2argvdata/{usb-controller.args =>
usb-controller-default-unavailable-i440fx.x86_64-latest.args} (100%)
create mode 120000 tests/qemuxml2argvdata/usb-controller-default-unavailable-i440fx.xml
rename tests/qemuxml2argvdata/{usb-controller-default-unavailable-q35.err =>
usb-controller-default-unavailable-q35.x86_64-latest.err} (100%)
rename tests/qemuxml2xmloutdata/{usb-controller.x86_64-latest.xml =>
usb-controller-default-i440fx.x86_64-latest.xml} (100%)
create mode 100644
tests/qemuxml2xmloutdata/usb-controller-default-unavailable-i440fx.x86_64-latest.xml
diff --git a/tests/qemuxml2argvdata/usb-controller-default-i440fx.x86_64-latest.args
b/tests/qemuxml2argvdata/usb-controller-default-i440fx.x86_64-latest.args
new file mode 100644
index 0000000000..b2d71ccb60
--- /dev/null
+++ b/tests/qemuxml2argvdata/usb-controller-default-i440fx.x86_64-latest.args
@@ -0,0 +1,33 @@
+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"}' \
+-device
'{"driver":"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/usb-controller.xml
b/tests/qemuxml2argvdata/usb-controller-default-i440fx.xml
similarity index 100%
rename from tests/qemuxml2argvdata/usb-controller.xml
rename to tests/qemuxml2argvdata/usb-controller-default-i440fx.xml
diff --git a/tests/qemuxml2argvdata/usb-controller-default-isapc.x86_64-latest.err
b/tests/qemuxml2argvdata/usb-controller-default-isapc.x86_64-latest.err
new file mode 100644
index 0000000000..a0ca4fba5d
--- /dev/null
+++ b/tests/qemuxml2argvdata/usb-controller-default-isapc.x86_64-latest.err
@@ -0,0 +1 @@
+XML error: No PCI buses available
diff --git a/tests/qemuxml2argvdata/usb-controller-default-isapc.xml
b/tests/qemuxml2argvdata/usb-controller-default-isapc.xml
new file mode 100644
index 0000000000..fa87acbdff
--- /dev/null
+++ b/tests/qemuxml2argvdata/usb-controller-default-isapc.xml
@@ -0,0 +1,16 @@
+<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='isapc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type='usb' index='0'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/usb-controller-default-q35.args
b/tests/qemuxml2argvdata/usb-controller-default-q35.x86_64-latest.args
similarity index 100%
rename from tests/qemuxml2argvdata/usb-controller-default-q35.args
rename to tests/qemuxml2argvdata/usb-controller-default-q35.x86_64-latest.args
diff --git a/tests/qemuxml2argvdata/usb-controller.args
b/tests/qemuxml2argvdata/usb-controller-default-unavailable-i440fx.x86_64-latest.args
similarity index 100%
rename from tests/qemuxml2argvdata/usb-controller.args
rename to
tests/qemuxml2argvdata/usb-controller-default-unavailable-i440fx.x86_64-latest.args
diff --git a/tests/qemuxml2argvdata/usb-controller-default-unavailable-i440fx.xml
b/tests/qemuxml2argvdata/usb-controller-default-unavailable-i440fx.xml
new file mode 120000
index 0000000000..d3d865ea0c
--- /dev/null
+++ b/tests/qemuxml2argvdata/usb-controller-default-unavailable-i440fx.xml
@@ -0,0 +1 @@
+usb-controller-default-i440fx.xml
\ No newline at end of file
diff --git a/tests/qemuxml2argvdata/usb-controller-default-unavailable-q35.err
b/tests/qemuxml2argvdata/usb-controller-default-unavailable-q35.x86_64-latest.err
similarity index 100%
rename from tests/qemuxml2argvdata/usb-controller-default-unavailable-q35.err
rename to tests/qemuxml2argvdata/usb-controller-default-unavailable-q35.x86_64-latest.err
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 45df4f4bae..6d7c60ba9d 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1503,9 +1503,24 @@ mymain(void)
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_PARSE_ERROR("usb-controller-default-isapc");
+ DO_TEST_CAPS_LATEST("usb-controller-default-i440fx");
+ DO_TEST_CAPS_LATEST("usb-controller-default-q35");
+ /* i440fx downgrades to use '-usb' if the explicit controller is not present
*/
+ DO_TEST_FULL("usb-controller-default-unavailable-i440fx",
".x86_64-latest",
+ ARG_CAPS_ARCH, "x86_64",
+ ARG_CAPS_VER, "latest",
+ ARG_QEMU_CAPS_DEL, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_LAST,
+ ARG_END);
+ 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);
+
DO_TEST_NOCAPS("usb-none");
- DO_TEST_NOCAPS("usb-controller");
DO_TEST("usb-controller-piix3",
QEMU_CAPS_PIIX3_USB_UHCI);
DO_TEST("usb-controller-ich9-ehci-addr",
@@ -1522,15 +1537,6 @@ mymain(void)
QEMU_CAPS_USB_HUB,
QEMU_CAPS_ICH9_USB_EHCI1);
- DO_TEST("usb-controller-default-q35",
- QEMU_CAPS_DEVICE_IOH3420,
- QEMU_CAPS_PCI_OHCI,
- QEMU_CAPS_PIIX3_USB_UHCI,
- QEMU_CAPS_NEC_USB_XHCI);
- DO_TEST_FAILURE("usb-controller-default-unavailable-q35",
- QEMU_CAPS_DEVICE_IOH3420,
- QEMU_CAPS_PCI_OHCI,
- QEMU_CAPS_NEC_USB_XHCI);
DO_TEST("usb-controller-explicit-q35",
QEMU_CAPS_DEVICE_IOH3420,
QEMU_CAPS_PCI_OHCI,
diff --git a/tests/qemuxml2xmloutdata/usb-controller.x86_64-latest.xml
b/tests/qemuxml2xmloutdata/usb-controller-default-i440fx.x86_64-latest.xml
similarity index 100%
rename from tests/qemuxml2xmloutdata/usb-controller.x86_64-latest.xml
rename to tests/qemuxml2xmloutdata/usb-controller-default-i440fx.x86_64-latest.xml
diff --git
a/tests/qemuxml2xmloutdata/usb-controller-default-unavailable-i440fx.x86_64-latest.xml
b/tests/qemuxml2xmloutdata/usb-controller-default-unavailable-i440fx.x86_64-latest.xml
new file mode 100644
index 0000000000..183cfe3b9a
--- /dev/null
+++
b/tests/qemuxml2xmloutdata/usb-controller-default-unavailable-i440fx.x86_64-latest.xml
@@ -0,0 +1,31 @@
+<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'>
+ <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='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x02' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 3157072c5c..d65fb1f200 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -485,11 +485,13 @@ mymain(void)
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-default-i440fx");
+ DO_TEST_CAPS_LATEST("usb-controller-default-q35");
DO_TEST_CAPS_LATEST("usb-controller-piix3");
DO_TEST_CAPS_LATEST("usb-controller-ich9-ehci-addr");
- DO_TEST_CAPS_LATEST("usb-controller-default-q35");
DO_TEST_CAPS_LATEST("usb-controller-explicit-q35");
+ DO_TEST_CAPS_ARCH_LATEST_FULL("usb-controller-default-unavailable-i440fx",
"x86_64",
+ ARG_QEMU_CAPS_DEL, QEMU_CAPS_PIIX3_USB_UHCI,
QEMU_CAPS_LAST);
DO_TEST_CAPS_ARCH_LATEST("ppc64-usb-controller", "ppc64");
DO_TEST_CAPS_ARCH_LATEST("ppc64-usb-controller-legacy",
"ppc64");
DO_TEST_CAPS_LATEST("usb-port-missing");
--
2.41.0