[libvirt] [PATCHv2 1/5] Add test for virtio serial port assignment

Ján Tomko jtomko at redhat.com
Tue Mar 17 11:41:38 UTC 2015


Add a test to demonstrate the effect of this series.
---
 .../qemuxml2argv-channel-virtio-autoassign.args    | 20 +++++++++
 .../qemuxml2argv-channel-virtio-autoassign.xml     | 50 ++++++++++++++++++++++
 tests/qemuxml2argvtest.c                           |  2 +
 3 files changed, 72 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-autoassign.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-autoassign.xml

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-autoassign.args b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-autoassign.args
new file mode 100644
index 0000000..d64a228
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-autoassign.args
@@ -0,0 +1,20 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c \
+-device virtio-serial-pci,id=virtio-serial0,max_ports=4,vectors=4,bus=pci.0\
+,addr=0x3 -device virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa \
+-usb -hda /dev/HostVG/QEMUGuest1 \
+-chardev pty,id=charchannel0 -device virtserialport,bus=virtio-serial0.0,nr=1,\
+chardev=charchannel0,id=channel0,name=org.linux-kvm.port.0 \
+-chardev pty,id=charchannel1 -device virtserialport,bus=virtio-serial0.0,nr=2,\
+chardev=charchannel1,id=channel1,name=org.linux-kvm.port.foo \
+-chardev pty,id=charchannel2 -device virtserialport,bus=virtio-serial0.0,nr=1,\
+chardev=charchannel2,id=channel2,name=org.linux-kvm.port.bar \
+-chardev pty,id=charchannel3 -device virtserialport,bus=virtio-serial0.2,nr=1,\
+chardev=charchannel3,id=channel3,name=org.linux-kvm.port.wizz \
+-chardev pty,id=charchannel4 -device virtserialport,bus=virtio-serial0.0,nr=3,\
+chardev=charchannel4,id=channel4,name=org.linux-kvm.port.ooh \
+-chardev pty,id=charchannel5 -device virtserialport,bus=virtio-serial0.0,nr=4,\
+chardev=charchannel5,id=channel5,name=org.linux-kvm.port.lla \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-autoassign.xml b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-autoassign.xml
new file mode 100644
index 0000000..ac0744e
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-autoassign.xml
@@ -0,0 +1,50 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='virtio-serial' index='0' ports='4' vectors='4'/>
+    <controller type='virtio-serial' index='1'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
+    </controller>
+    <channel type='pty'>
+      <target type='virtio' name='org.linux-kvm.port.0'/>
+    </channel>
+    <channel type='pty'>
+      <target type='virtio' name='org.linux-kvm.port.foo'/>
+    </channel>
+    <channel type='pty'>
+      <target type='virtio' name='org.linux-kvm.port.bar'/>
+      <address type='virtio-serial' controller='0' port='1'/>
+    </channel>
+    <channel type='pty'>
+      <target type='virtio' name='org.linux-kvm.port.wizz'/>
+      <address type='virtio-serial' controller='0' bus='2'/>
+    </channel>
+    <channel type='pty'>
+      <target type='virtio' name='org.linux-kvm.port.ooh'/>
+    </channel>
+    <channel type='pty'>
+      <target type='virtio' name='org.linux-kvm.port.lla'/>
+    </channel>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index fcf5218..0ec68f4 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1070,6 +1070,8 @@ mymain(void)
             QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
     DO_TEST("channel-virtio-auto",
             QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
+    DO_TEST("channel-virtio-autoassign",
+            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
     DO_TEST("console-virtio",
             QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
     DO_TEST("console-virtio-many",
-- 
2.0.5




More information about the libvir-list mailing list