[PATCH v1 5/6] tests: Add tests for ivshmem device handling

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

 



Add XML parsing and qemu command line tests for the ivshmem
device support.

Signed-off-by: Maxime Leroy <maxime.leroy@xxxxxxxxx>
---
 tests/qemuxml2argvdata/qemuxml2argv-ivshmem.args | 10 +++++++
 tests/qemuxml2argvdata/qemuxml2argv-ivshmem.xml  | 35 ++++++++++++++++++++++++
 tests/qemuxml2argvtest.c                         |  3 ++
 tests/qemuxml2xmltest.c                          |  2 ++
 4 files changed, 50 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ivshmem.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ivshmem.xml

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ivshmem.args b/tests/qemuxml2argvdata/qemuxml2argv-ivshmem.args
new file mode 100644
index 0000000..8a5cc0f
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ivshmem.args
@@ -0,0 +1,10 @@
+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 -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
+-device ivshmem,chardev=charshmem0,msi=on,vectors=32,ioeventfd=on \
+-chardev socket,id=charshmem0,path=/tmp/socket-shmem0 \
+-device ivshmem,size=32m,chardev=charshmem1,msi=on,vectors=32 \
+-chardev socket,id=charshmem1,path=/tmp/socket-shmem1 \
+-device ivshmem,size=32m,shm=shmem2,bus=pci.0,addr=0x8
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ivshmem.xml b/tests/qemuxml2argvdata/qemuxml2argv-ivshmem.xml
new file mode 100644
index 0000000..7177612
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ivshmem.xml
@@ -0,0 +1,35 @@
+<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='x86_64' 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>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <memballoon model='virtio'/>
+    <shmem name='shmem0' model='ivshmem'>
+      <server path='/tmp/socket-shmem0'/>
+      <msi vectors='32' ioeventfd='on'/>
+    </shmem>
+    <shmem name='shmem1' model='ivshmem'>
+      <server path='/tmp/socket-shmem1'/>
+      <size unit='M'>32</size>
+      <msi vectors='32'/>
+    </shmem>
+    <shmem name='shmem2' model='ivshmem'>
+      <size unit='M'>32</size>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
+    </shmem>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 65dc9c7..f91ac36 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1431,6 +1431,9 @@ mymain(void)
     DO_TEST("panic", QEMU_CAPS_DEVICE_PANIC,
             QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
 
+    DO_TEST("ivshmem", QEMU_CAPS_PCIDEVICE,
+            QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_IVSHMEM);
+
     virObjectUnref(driver.config);
     virObjectUnref(driver.caps);
     virObjectUnref(driver.xmlopt);
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 5941323..4e62fe9 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -388,6 +388,8 @@ mymain(void)
     DO_TEST_DIFFERENT("numatune-memnode");
     DO_TEST("numatune-memnode-no-memory");
 
+    DO_TEST("ivshmem");
+
     virObjectUnref(driver.caps);
     virObjectUnref(driver.xmlopt);
 
-- 
1.9.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]