]> xenbits.xensource.com Git - libvirt.git/commitdiff
Add a test for long USB port paths
authorJán Tomko <jtomko@redhat.com>
Wed, 20 Apr 2016 13:03:57 +0000 (15:03 +0200)
committerJán Tomko <jtomko@redhat.com>
Wed, 22 Jun 2016 19:33:57 +0000 (21:33 +0200)
We support up to four levels of nested USB devices in the guest.

Add a test for a domain using all four and a negative test for a domain
using five.

tests/qemuxml2argvdata/qemuxml2argv-usb-long-port-path.args [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-usb-long-port-path.xml [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-usb-too-long-port-path-invalid.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-long-port-path.args b/tests/qemuxml2argvdata/qemuxml2argv-usb-long-port-path.args
new file mode 100644 (file)
index 0000000..d9100f6
--- /dev/null
@@ -0,0 +1,27 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefconfig \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline \
+-no-acpi \
+-boot c \
+-usb \
+-device usb-hub,id=hub0,bus=usb.0,port=1 \
+-device usb-hub,id=hub1,bus=usb.0,port=1.1 \
+-device usb-hub,id=hub2,bus=usb.0,port=1.1.1 \
+-device usb-hub,id=hub3,bus=usb.0,port=1.1.1.1 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-long-port-path.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-long-port-path.xml
new file mode 100644 (file)
index 0000000..06967b1
--- /dev/null
@@ -0,0 +1,30 @@
+<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='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
+    <hub type='usb'>
+      <address type='usb' bus='0' port='1'/>
+    </hub>
+    <hub type='usb'>
+      <address type='usb' bus='0' port='1.1'/>
+    </hub>
+    <hub type='usb'>
+      <address type='usb' bus='0' port='1.1.1'/>
+    </hub>
+    <hub type='usb'>
+      <address type='usb' bus='0' port='1.1.1.1'/>
+    </hub>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-too-long-port-path-invalid.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-too-long-port-path-invalid.xml
new file mode 100644 (file)
index 0000000..789628a
--- /dev/null
@@ -0,0 +1,33 @@
+<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='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
+    <hub type='usb'>
+      <address type='usb' bus='0' port='1'/>
+    </hub>
+    <hub type='usb'>
+      <address type='usb' bus='0' port='1.1'/>
+    </hub>
+    <hub type='usb'>
+      <address type='usb' bus='0' port='1.1.1'/>
+    </hub>
+    <hub type='usb'>
+      <address type='usb' bus='0' port='1.1.1.1'/>
+    </hub>
+    <hub type='usb'>
+      <address type='usb' bus='0' port='1.1.1.1.1'/>
+    </hub>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
index d882f118ac3a6288147d2f4ead0c52061d3b1ab1..804b577757f9c5e38034a9481a8c2edf63daa933 100644 (file)
@@ -2015,6 +2015,11 @@ mymain(void)
     DO_TEST("debug-threads", QEMU_CAPS_NAME_DEBUG_THREADS);
 
     DO_TEST("master-key", QEMU_CAPS_OBJECT_SECRET);
+    DO_TEST("usb-long-port-path", QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_USB_HUB);
+    DO_TEST_PARSE_FLAGS_ERROR("usb-too-long-port-path-invalid",
+                              QEMU_CAPS_CHARDEV,
+                              QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_USB_HUB);
 
     DO_TEST("acpi-table", NONE);