[PATCH 04/17] Add a test for long USB port paths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For some reason, 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.
---
 .../qemuxml2argv-usb-long-port-path.args           | 27 ++++++++++++++++++
 .../qemuxml2argv-usb-long-port-path.xml            | 30 ++++++++++++++++++++
 ...qemuxml2argv-usb-too-long-port-path-invalid.xml | 33 ++++++++++++++++++++++
 tests/qemuxml2argvtest.c                           |  5 ++++
 4 files changed, 95 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-long-port-path.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-long-port-path.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-too-long-port-path-invalid.xml

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-long-port-path.args b/tests/qemuxml2argvdata/qemuxml2argv-usb-long-port-path.args
new file mode 100644
index 0000000..d9100f6
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-long-port-path.args
@@ -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
index 0000000..06967b1
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-long-port-path.xml
@@ -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
index 0000000..789628a
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-too-long-port-path-invalid.xml
@@ -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>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index d47dc58..2a8f6c4 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2014,6 +2014,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);
 
-- 
2.7.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]