[RFC PATCH 5/5] 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  | 36 ++++++++++++++++++++++++
 tests/qemuxml2argvtest.c                         |  3 ++
 tests/qemuxml2xmltest.c                          |  2 ++
 4 files changed, 51 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..c707ba2
--- /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=charivshmem0,msi=on,vectors=32,ioeventfd=on \
+-chardev socket,id=charivshmem0,path=/tmp/socket-ivshmem0 \
+-device ivshmem,size=32m,role=master,chardev=charivshmem1,msi=on,vectors=32 \
+-chardev socket,id=charivshmem1,path=/tmp/socket-ivshmem1 \
+-device ivshmem,size=32m,role=peer,shm=ivshmem2,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..8214869
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ivshmem.xml
@@ -0,0 +1,36 @@
+<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'/>
+    <ivshmem use_server='yes'>
+      <source file='/tmp/socket-ivshmem0'/>
+      <msi vectors='32' ioeventfd='on'/>
+    </ivshmem>
+    <ivshmem use_server='yes' role='master'>
+      <source file='/tmp/socket-ivshmem1'/>
+      <size unit='M'>32</size>
+      <msi vectors='32'/>
+    </ivshmem>
+    <ivshmem use_server='no' role='peer'>
+      <source file='ivshmem2'/>
+      <size unit='M'>32</size>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
+    </ivshmem>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 12ecabc..b2a2bc4 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1412,6 +1412,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 451dedc..9bb692a 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -382,6 +382,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]