Add a test for long USB port paths

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.
This commit is contained in:
Ján Tomko 2016-04-20 15:03:57 +02:00
parent d85c3a5451
commit e9843279cc
4 changed files with 95 additions and 0 deletions

View File

@ -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

View File

@ -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>

View File

@ -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>

View 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);