render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
6ae9ed
From c468652ff43b6aa83d8549a9b581da9ecee7563c Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <c468652ff43b6aa83d8549a9b581da9ecee7563c@dist-git>
6ae9ed
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
6ae9ed
Date: Thu, 21 Jul 2016 15:57:54 +0200
6ae9ed
Subject: [PATCH] Add tests for USB address assignment
6ae9ed
MIME-Version: 1.0
6ae9ed
Content-Type: text/plain; charset=UTF-8
6ae9ed
Content-Transfer-Encoding: 8bit
6ae9ed
6ae9ed
Introduce tests with the ich9, xhci and the default (piix3) usb
6ae9ed
controller to demonstrate the effect of the next patch.
6ae9ed
6ae9ed
(cherry picked from commit 69f5ce45abd587509d4b5df2428ead79737b6b77)
6ae9ed
Signed-off-by: Ján Tomko <jtomko@redhat.com>
6ae9ed
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1215968
6ae9ed
6ae9ed
Conflicts:
6ae9ed
  downstream does not assume QEMU_CAPS_SMP_TOPOLOGY in tests
6ae9ed
---
6ae9ed
 .../qemuxml2argv-usb-ich9-autoassign.args          | 32 ++++++++++++++++++
6ae9ed
 .../qemuxml2argv-usb-ich9-autoassign.xml           | 39 ++++++++++++++++++++++
6ae9ed
 .../qemuxml2argv-usb-port-autoassign.args          | 28 ++++++++++++++++
6ae9ed
 .../qemuxml2argv-usb-port-autoassign.xml           | 27 +++++++++++++++
6ae9ed
 .../qemuxml2argv-usb-xhci-autoassign.args          | 27 +++++++++++++++
6ae9ed
 .../qemuxml2argv-usb-xhci-autoassign.xml           | 25 ++++++++++++++
6ae9ed
 tests/qemuxml2argvtest.c                           | 11 ++++++
6ae9ed
 7 files changed, 189 insertions(+)
6ae9ed
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-autoassign.args
6ae9ed
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-autoassign.xml
6ae9ed
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-port-autoassign.args
6ae9ed
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-port-autoassign.xml
6ae9ed
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-xhci-autoassign.args
6ae9ed
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-xhci-autoassign.xml
6ae9ed
6ae9ed
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-autoassign.args b/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-autoassign.args
6ae9ed
new file mode 100644
6ae9ed
index 0000000..faaff95
6ae9ed
--- /dev/null
6ae9ed
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-autoassign.args
6ae9ed
@@ -0,0 +1,32 @@
6ae9ed
+LC_ALL=C \
6ae9ed
+PATH=/bin \
6ae9ed
+HOME=/home/test \
6ae9ed
+USER=test \
6ae9ed
+LOGNAME=test \
6ae9ed
+QEMU_AUDIO_DRV=none \
6ae9ed
+/usr/bin/qemu \
6ae9ed
+-name QEMUGuest1 \
6ae9ed
+-S \
6ae9ed
+-M pc \
6ae9ed
+-m 214 \
6ae9ed
+-smp 1 \
6ae9ed
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
6ae9ed
+-nographic \
6ae9ed
+-nodefconfig \
6ae9ed
+-nodefaults \
6ae9ed
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
6ae9ed
+server,nowait \
6ae9ed
+-mon chardev=charmonitor,id=monitor,mode=readline \
6ae9ed
+-no-acpi \
6ae9ed
+-boot c \
6ae9ed
+-device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x4.0x7 \
6ae9ed
+-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,\
6ae9ed
+addr=0x4 \
6ae9ed
+-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1 \
6ae9ed
+-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2 \
6ae9ed
+-device usb-hub,id=hub0 \
6ae9ed
+-device usb-hub,id=hub1 \
6ae9ed
+-device usb-mouse,id=input0 \
6ae9ed
+-device usb-mouse,id=input1 \
6ae9ed
+-device usb-mouse,id=input2 \
6ae9ed
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
6ae9ed
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-autoassign.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-autoassign.xml
6ae9ed
new file mode 100644
6ae9ed
index 0000000..6425c50
6ae9ed
--- /dev/null
6ae9ed
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-autoassign.xml
6ae9ed
@@ -0,0 +1,39 @@
6ae9ed
+<domain type='qemu'>
6ae9ed
+  <name>QEMUGuest1</name>
6ae9ed
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
6ae9ed
+  <memory unit='KiB'>219136</memory>
6ae9ed
+  <currentMemory unit='KiB'>219136</currentMemory>
6ae9ed
+  <vcpu placement='static'>1</vcpu>
6ae9ed
+  <os>
6ae9ed
+    <type arch='i686' machine='pc'>hvm</type>
6ae9ed
+    <boot dev='hd'/>
6ae9ed
+  </os>
6ae9ed
+  <devices>
6ae9ed
+    <emulator>/usr/bin/qemu</emulator>
6ae9ed
+    <controller type='usb' index='0' model='ich9-ehci1'>
6ae9ed
+      <address type='pci' domain='0' bus='0' slot='4' function='7'/>
6ae9ed
+    </controller>
6ae9ed
+    <controller type='usb' index='0' model='ich9-uhci1'>
6ae9ed
+      <master startport='0'/>
6ae9ed
+      <address type='pci' domain='0' bus='0' slot='4' function='0' multifunction='on'/>
6ae9ed
+    </controller>
6ae9ed
+    <controller type='usb' index='0' model='ich9-uhci2'>
6ae9ed
+      <master startport='2'/>
6ae9ed
+      <address type='pci' domain='0' bus='0' slot='4' function='1'/>
6ae9ed
+    </controller>
6ae9ed
+    <controller type='usb' index='0' model='ich9-uhci3'>
6ae9ed
+      <master startport='4'/>
6ae9ed
+      <address type='pci' domain='0' bus='0' slot='4' function='2'/>
6ae9ed
+    </controller>
6ae9ed
+    <hub type='usb'/>
6ae9ed
+    <input type='mouse' bus='usb'>
6ae9ed
+    </input>
6ae9ed
+    <hub type='usb'>
6ae9ed
+    </hub>
6ae9ed
+    <input type='mouse' bus='usb'>
6ae9ed
+    </input>
6ae9ed
+    <input type='mouse' bus='usb'>
6ae9ed
+    </input>
6ae9ed
+    <memballoon model='virtio'/>
6ae9ed
+  </devices>
6ae9ed
+</domain>
6ae9ed
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-port-autoassign.args b/tests/qemuxml2argvdata/qemuxml2argv-usb-port-autoassign.args
6ae9ed
new file mode 100644
6ae9ed
index 0000000..aa80919
6ae9ed
--- /dev/null
6ae9ed
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-port-autoassign.args
6ae9ed
@@ -0,0 +1,28 @@
6ae9ed
+LC_ALL=C \
6ae9ed
+PATH=/bin \
6ae9ed
+HOME=/home/test \
6ae9ed
+USER=test \
6ae9ed
+LOGNAME=test \
6ae9ed
+QEMU_AUDIO_DRV=none \
6ae9ed
+/usr/bin/qemu \
6ae9ed
+-name QEMUGuest1 \
6ae9ed
+-S \
6ae9ed
+-M pc \
6ae9ed
+-m 214 \
6ae9ed
+-smp 1 \
6ae9ed
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
6ae9ed
+-nographic \
6ae9ed
+-nodefconfig \
6ae9ed
+-nodefaults \
6ae9ed
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
6ae9ed
+server,nowait \
6ae9ed
+-mon chardev=charmonitor,id=monitor,mode=readline \
6ae9ed
+-no-acpi \
6ae9ed
+-boot c \
6ae9ed
+-usb \
6ae9ed
+-device usb-hub,id=hub0,bus=usb.0,port=1 \
6ae9ed
+-device usb-hub,id=hub1 \
6ae9ed
+-device usb-mouse,id=input0 \
6ae9ed
+-device usb-mouse,id=input1 \
6ae9ed
+-device usb-mouse,id=input2 \
6ae9ed
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
6ae9ed
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-port-autoassign.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-port-autoassign.xml
6ae9ed
new file mode 100644
6ae9ed
index 0000000..a2fe34e
6ae9ed
--- /dev/null
6ae9ed
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-port-autoassign.xml
6ae9ed
@@ -0,0 +1,27 @@
6ae9ed
+<domain type='qemu'>
6ae9ed
+  <name>QEMUGuest1</name>
6ae9ed
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
6ae9ed
+  <memory unit='KiB'>219136</memory>
6ae9ed
+  <currentMemory unit='KiB'>219136</currentMemory>
6ae9ed
+  <vcpu placement='static'>1</vcpu>
6ae9ed
+  <os>
6ae9ed
+    <type arch='i686' machine='pc'>hvm</type>
6ae9ed
+    <boot dev='hd'/>
6ae9ed
+  </os>
6ae9ed
+  <devices>
6ae9ed
+    <emulator>/usr/bin/qemu</emulator>
6ae9ed
+    <controller type='usb' index='0'/>
6ae9ed
+    <memballoon model='virtio'/>
6ae9ed
+    <hub type='usb'>
6ae9ed
+      <address type='usb' bus='0' port='1'/>
6ae9ed
+    </hub>
6ae9ed
+    <input type='mouse' bus='usb'>
6ae9ed
+    </input>
6ae9ed
+    <hub type='usb'>
6ae9ed
+    </hub>
6ae9ed
+    <input type='mouse' bus='usb'>
6ae9ed
+    </input>
6ae9ed
+    <input type='mouse' bus='usb'>
6ae9ed
+    </input>
6ae9ed
+  </devices>
6ae9ed
+</domain>
6ae9ed
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-xhci-autoassign.args b/tests/qemuxml2argvdata/qemuxml2argv-usb-xhci-autoassign.args
6ae9ed
new file mode 100644
6ae9ed
index 0000000..7c5e6a5
6ae9ed
--- /dev/null
6ae9ed
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-xhci-autoassign.args
6ae9ed
@@ -0,0 +1,27 @@
6ae9ed
+LC_ALL=C \
6ae9ed
+PATH=/bin \
6ae9ed
+HOME=/home/test \
6ae9ed
+USER=test \
6ae9ed
+LOGNAME=test \
6ae9ed
+QEMU_AUDIO_DRV=none \
6ae9ed
+/usr/bin/qemu \
6ae9ed
+-name QEMUGuest1 \
6ae9ed
+-S \
6ae9ed
+-M pc \
6ae9ed
+-m 214 \
6ae9ed
+-smp 1 \
6ae9ed
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
6ae9ed
+-nographic \
6ae9ed
+-nodefconfig \
6ae9ed
+-nodefaults \
6ae9ed
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
6ae9ed
+server,nowait \
6ae9ed
+-mon chardev=charmonitor,id=monitor,mode=readline \
6ae9ed
+-no-acpi \
6ae9ed
+-boot c \
6ae9ed
+-device nec-usb-xhci,p2=8,p3=8,id=usb,bus=pci.0,addr=0x3 \
6ae9ed
+-device usb-hub,id=hub0 \
6ae9ed
+-device usb-hub,id=hub1 \
6ae9ed
+-device usb-mouse,id=input0 \
6ae9ed
+-device usb-mouse,id=input1 \
6ae9ed
+-device usb-mouse,id=input2
6ae9ed
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-xhci-autoassign.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-xhci-autoassign.xml
6ae9ed
new file mode 100644
6ae9ed
index 0000000..9c87b5f
6ae9ed
--- /dev/null
6ae9ed
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-xhci-autoassign.xml
6ae9ed
@@ -0,0 +1,25 @@
6ae9ed
+<domain type='qemu'>
6ae9ed
+  <name>QEMUGuest1</name>
6ae9ed
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
6ae9ed
+  <memory unit='KiB'>219136</memory>
6ae9ed
+  <currentMemory unit='KiB'>219136</currentMemory>
6ae9ed
+  <vcpu placement='static'>1</vcpu>
6ae9ed
+  <os>
6ae9ed
+    <type arch='i686' machine='pc'>hvm</type>
6ae9ed
+    <boot dev='hd'/>
6ae9ed
+  </os>
6ae9ed
+  <devices>
6ae9ed
+    <emulator>/usr/bin/qemu</emulator>
6ae9ed
+    <controller type='usb' index='0' model='nec-xhci' ports='8'/>
6ae9ed
+    <hub type='usb'/>
6ae9ed
+    <input type='mouse' bus='usb'>
6ae9ed
+    </input>
6ae9ed
+    <hub type='usb'>
6ae9ed
+    </hub>
6ae9ed
+    <input type='mouse' bus='usb'>
6ae9ed
+    </input>
6ae9ed
+    <input type='mouse' bus='usb'>
6ae9ed
+    </input>
6ae9ed
+    <memballoon model='none'/>
6ae9ed
+  </devices>
6ae9ed
+</domain>
6ae9ed
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
6ae9ed
index 9c18989..e434470 100644
6ae9ed
--- a/tests/qemuxml2argvtest.c
6ae9ed
+++ b/tests/qemuxml2argvtest.c
6ae9ed
@@ -1156,6 +1156,10 @@ mymain(void)
6ae9ed
     DO_TEST_PARSE_ERROR("usb-ich9-no-companion",
6ae9ed
             QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
6ae9ed
             QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1);
6ae9ed
+    DO_TEST("usb-ich9-autoassign",
6ae9ed
+            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
6ae9ed
+            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1,
6ae9ed
+            QEMU_CAPS_USB_HUB);
6ae9ed
     DO_TEST("usb-hub",
6ae9ed
             QEMU_CAPS_CHARDEV, QEMU_CAPS_USB_HUB,
6ae9ed
             QEMU_CAPS_NODEFCONFIG);
6ae9ed
@@ -1168,6 +1172,9 @@ mymain(void)
6ae9ed
     DO_TEST("usb-ports",
6ae9ed
             QEMU_CAPS_CHARDEV, QEMU_CAPS_USB_HUB,
6ae9ed
             QEMU_CAPS_NODEFCONFIG);
6ae9ed
+    DO_TEST("usb-port-autoassign",
6ae9ed
+            QEMU_CAPS_CHARDEV, QEMU_CAPS_USB_HUB,
6ae9ed
+            QEMU_CAPS_NODEFCONFIG);
6ae9ed
     DO_TEST("usb-redir",
6ae9ed
             QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
6ae9ed
             QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_USB_HUB,
6ae9ed
@@ -1222,6 +1229,10 @@ mymain(void)
6ae9ed
     DO_TEST("usb-controller-xhci",
6ae9ed
             QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_PIIX3_USB_UHCI,
6ae9ed
             QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_NEC_USB_XHCI_PORTS);
6ae9ed
+    DO_TEST("usb-xhci-autoassign",
6ae9ed
+            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_PIIX3_USB_UHCI,
6ae9ed
+            QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_NEC_USB_XHCI_PORTS,
6ae9ed
+            QEMU_CAPS_USB_HUB);
6ae9ed
 
6ae9ed
     DO_TEST("smbios", QEMU_CAPS_SMBIOS_TYPE);
6ae9ed
     DO_TEST_PARSE_ERROR("smbios-date", QEMU_CAPS_SMBIOS_TYPE);
6ae9ed
-- 
6ae9ed
2.9.2
6ae9ed