From: Marc-André Lureau <marcandre.lureau(a)redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau(a)redhat.com>
---
.../vhost-user-gpu-secondary.args | 35 +++++++++++++++
.../vhost-user-gpu-secondary.xml | 44 +++++++++++++++++++
tests/qemuxml2argvdata/vhost-user-vga.args | 32 ++++++++++++++
tests/qemuxml2argvdata/vhost-user-vga.xml | 41 +++++++++++++++++
tests/qemuxml2argvtest.c | 21 +++++++++
5 files changed, 173 insertions(+)
create mode 100644 tests/qemuxml2argvdata/vhost-user-gpu-secondary.args
create mode 100644 tests/qemuxml2argvdata/vhost-user-gpu-secondary.xml
create mode 100644 tests/qemuxml2argvdata/vhost-user-vga.args
create mode 100644 tests/qemuxml2argvdata/vhost-user-vga.xml
diff --git a/tests/qemuxml2argvdata/vhost-user-gpu-secondary.args
b/tests/qemuxml2argvdata/vhost-user-gpu-secondary.args
new file mode 100644
index 0000000000..413de05370
--- /dev/null
+++ b/tests/qemuxml2argvdata/vhost-user-gpu-secondary.args
@@ -0,0 +1,35 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-object memory-backend-memfd,id=ram-node0,share=yes,size=224395264 \
+-numa node,nodeid=0,cpus=0,memdev=ram-node0 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev
socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
+-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
+-chardev socket,id=chr-vu-video0,fd=0 \
+-chardev socket,id=chr-vu-video1,fd=0 \
+-device vhost-user-vga,id=video0,max_outputs=1,chardev=chr-vu-video0,bus=pci.0,addr=0x2
\
+-device
vhost-user-gpu-pci,id=video1,max_outputs=1,chardev=chr-vu-video1,bus=pci.0,addr=0x4 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/vhost-user-gpu-secondary.xml
b/tests/qemuxml2argvdata/vhost-user-gpu-secondary.xml
new file mode 100644
index 0000000000..2142497d6e
--- /dev/null
+++ b/tests/qemuxml2argvdata/vhost-user-gpu-secondary.xml
@@ -0,0 +1,44 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <memoryBacking>
+ <access mode='shared'/>
+ <source type='memfd'/>
+ </memoryBacking>
+ <vcpu placement='static'>1</vcpu>
+ <cpu>
+ <numa>
+ <cell id='0' cpus='0' memory='219136'
unit='KiB'/>
+ </numa>
+ </cpu>
+ <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-system-i686</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='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='virtio'/>
+ <video>
+ <model type='virtio' heads='1' vhostuser='yes'/>
+ </video>
+ <video>
+ <model type='virtio' heads='1' vhostuser='yes'/>
+ </video>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/vhost-user-vga.args
b/tests/qemuxml2argvdata/vhost-user-vga.args
new file mode 100644
index 0000000000..7f6a1a6a58
--- /dev/null
+++ b/tests/qemuxml2argvdata/vhost-user-vga.args
@@ -0,0 +1,32 @@
+LC_ALL=C PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-object memory-backend-memfd,id=ram-node0,share=yes,size=224395264 \
+-numa node,nodeid=0,cpus=0,memdev=ram-node0 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev
socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
+-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
+-chardev socket,id=chr-vu-video0,fd=0 \
+-device vhost-user-vga,id=video0,max_outputs=1,chardev=chr-vu-video0,bus=pci.0,addr=0x2
\
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/vhost-user-vga.xml
b/tests/qemuxml2argvdata/vhost-user-vga.xml
new file mode 100644
index 0000000000..81b1e7643e
--- /dev/null
+++ b/tests/qemuxml2argvdata/vhost-user-vga.xml
@@ -0,0 +1,41 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <memoryBacking>
+ <access mode='shared'/>
+ <source type='memfd'/>
+ </memoryBacking>
+ <vcpu placement='static'>1</vcpu>
+ <cpu>
+ <numa>
+ <cell id='0' cpus='0' memory='219136'
unit='KiB'/>
+ </numa>
+ </cpu>
+ <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-system-i686</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='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='virtio'/>
+ <video>
+ <model type='virtio' heads='1' vhostuser='yes'/>
+ </video>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 49220733ae..da684df3c0 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -674,6 +674,15 @@ mymain(void)
virFileWrapperAddPrefix("/home/user/.config/qemu/firmware",
abs_srcdir
"/qemufirmwaredata/home/user/.config/qemu/firmware");
+ virFileWrapperAddPrefix(SYSCONFDIR "/qemu/vhost-user",
+ abs_srcdir
"/qemuvhostuserdata/etc/qemu/vhost-user");
+ virFileWrapperAddPrefix(PREFIX "/share/qemu/vhost-user",
+ abs_srcdir
"/qemuvhostuserdata/usr/share/qemu/vhost-user");
+ virFileWrapperAddPrefix("/home/user/.config/qemu/vhost-user",
+ abs_srcdir
"/qemuvhostuserdata/home/user/.config/qemu/vhost-user");
+ virFileWrapperAddPrefix("/usr/libexec/qemu/vhost-user",
+ abs_srcdir
"/qemuvhostuserdata/usr/libexec/qemu/vhost-user");
+
/**
* The following set of macros allows testing of XML -> argv conversion with a
* real set of capabilities gathered from a real qemu copy. It is desired to use
@@ -2959,6 +2968,18 @@ mymain(void)
DO_TEST_CAPS_LATEST("os-firmware-efi-secboot");
DO_TEST_CAPS_ARCH_LATEST("aarch64-os-firmware-efi", "aarch64");
+ DO_TEST("vhost-user-vga",
+ QEMU_CAPS_OBJECT_MEMORY_MEMFD,
+ QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+ QEMU_CAPS_DEVICE_VHOST_USER_GPU,
+ QEMU_CAPS_DEVICE_VHOST_USER_VGA);
+
+ DO_TEST("vhost-user-gpu-secondary",
+ QEMU_CAPS_OBJECT_MEMORY_MEMFD,
+ QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+ QEMU_CAPS_DEVICE_VHOST_USER_GPU,
+ QEMU_CAPS_DEVICE_VHOST_USER_VGA);
+
if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
virFileDeleteTree(fakerootdir);
--
2.22.0.rc2.384.g1a9a72ea1d