[libvirt] [PATCH] tests: qemuxml2argv: Add tests for USB controller on q35

Andrea Bolognani abologna at redhat.com
Fri Jan 8 17:54:32 UTC 2016


---
 .../qemuxml2argv-usb-controller-default-q35.args   | 21 +++++++++++++++++
 .../qemuxml2argv-usb-controller-default-q35.xml    | 27 ++++++++++++++++++++++
 ...argv-usb-controller-default-unavailable-q35.xml | 27 ++++++++++++++++++++++
 .../qemuxml2argv-usb-controller-explicit-q35.args  | 21 +++++++++++++++++
 .../qemuxml2argv-usb-controller-explicit-q35.xml   | 27 ++++++++++++++++++++++
 ...rgv-usb-controller-explicit-unavailable-q35.xml | 27 ++++++++++++++++++++++
 tests/qemuxml2argvtest.c                           | 17 +++++++++++++-
 7 files changed, 166 insertions(+), 1 deletion(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-q35.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-q35.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-unavailable-q35.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-q35.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-q35.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-unavailable-q35.xml

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-q35.args b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-q35.args
new file mode 100644
index 0000000..a746d37
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-q35.args
@@ -0,0 +1,21 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/libexec/qemu-kvm \
+-name q35-test \
+-S \
+-M q35 \
+-m 2048 \
+-smp 1 \
+-uuid 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 \
+-nographic \
+-nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait \
+-no-acpi \
+-boot c \
+-device pci-bridge,chassis_nr=56,id=pci.2,bus=pci.1,addr=0x1 \
+-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
+-device piix3-usb-uhci,id=usb,bus=pcie.0,addr=0x1
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-q35.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-q35.xml
new file mode 100644
index 0000000..26eecef
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-q35.xml
@@ -0,0 +1,27 @@
+<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/libexec/qemu-kvm</emulator>
+    <controller type='pci' index='0' model='pcie-root'/>
+    <controller type='pci' index='2' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='56'/>
+    </controller>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-unavailable-q35.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-unavailable-q35.xml
new file mode 100644
index 0000000..26eecef
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-unavailable-q35.xml
@@ -0,0 +1,27 @@
+<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/libexec/qemu-kvm</emulator>
+    <controller type='pci' index='0' model='pcie-root'/>
+    <controller type='pci' index='2' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='56'/>
+    </controller>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-q35.args b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-q35.args
new file mode 100644
index 0000000..6fd058c
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-q35.args
@@ -0,0 +1,21 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/libexec/qemu-kvm \
+-name q35-test \
+-S \
+-M q35 \
+-m 2048 \
+-smp 1 \
+-uuid 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 \
+-nographic \
+-nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait \
+-no-acpi \
+-boot c \
+-device pci-bridge,chassis_nr=56,id=pci.2,bus=pci.1,addr=0x1 \
+-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
+-device nec-usb-xhci,id=usb,bus=pcie.0,addr=0x1
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-q35.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-q35.xml
new file mode 100644
index 0000000..f3b34ee
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-q35.xml
@@ -0,0 +1,27 @@
+<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/libexec/qemu-kvm</emulator>
+    <controller type='pci' index='0' model='pcie-root'/>
+    <controller type='pci' index='2' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='56'/>
+    </controller>
+    <controller type='usb' index='0' model='nec-xhci'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-unavailable-q35.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-unavailable-q35.xml
new file mode 100644
index 0000000..f3b34ee
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-unavailable-q35.xml
@@ -0,0 +1,27 @@
+<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/libexec/qemu-kvm</emulator>
+    <controller type='pci' index='0' model='pcie-root'/>
+    <controller type='pci' index='2' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='56'/>
+    </controller>
+    <controller type='usb' index='0' model='nec-xhci'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 63480ce..b023522 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1181,7 +1181,22 @@ mymain(void)
             QEMU_CAPS_USB_HUB);
     DO_TEST_PARSE_ERROR("usb-none-usbtablet",
             QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
-
+    DO_TEST("usb-controller-default-q35",
+            QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE,
+            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, 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, QEMU_CAPS_DEVICE_PCI_BRIDGE,
+                    QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_PCI_OHCI,
+                    QEMU_CAPS_NEC_USB_XHCI);
+    DO_TEST("usb-controller-explicit-q35",
+            QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE,
+            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_PCI_OHCI,
+            QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_NEC_USB_XHCI);
+    DO_TEST_FAILURE("usb-controller-explicit-unavailable-q35",
+                    QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE,
+                    QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_PCI_OHCI,
+                    QEMU_CAPS_PIIX3_USB_UHCI);
 
     DO_TEST("smbios", QEMU_CAPS_SMBIOS_TYPE);
     DO_TEST_PARSE_ERROR("smbios-date", QEMU_CAPS_SMBIOS_TYPE);
-- 
2.5.0




More information about the libvir-list mailing list