99cbc7
From 846887a895a0b2b1fceeedffed8fdbeb15e355cc Mon Sep 17 00:00:00 2001
99cbc7
Message-Id: <846887a895a0b2b1fceeedffed8fdbeb15e355cc@dist-git>
99cbc7
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
99cbc7
Date: Thu, 11 Apr 2019 15:14:15 -0400
99cbc7
Subject: [PATCH] tests: add channel-unix-guestfwd
99cbc7
MIME-Version: 1.0
99cbc7
Content-Type: text/plain; charset=UTF-8
99cbc7
Content-Transfer-Encoding: 8bit
99cbc7
99cbc7
Test guestfwd channels backed by UNIX sockets.
99cbc7
99cbc7
Signed-off-by: Ján Tomko <jtomko@redhat.com>
99cbc7
(cherry picked from commit 8e0266d5bb4004c009080543982bfed6b93a3476)
99cbc7
99cbc7
Partially-Resolves: https://bugzilla.redhat.com/1658198
99cbc7
Signed-off-by: Laine Stump <laine@redhat.com>
99cbc7
Signed-off-by: Laine Stump <laine@laine.org>
99cbc7
Message-Id: <20190411191453.24055-4-laine@redhat.com>
99cbc7
Acked-by: Michal Privoznik <mprivozn@redhat.com>
99cbc7
---
99cbc7
 .../channel-unix-guestfwd.x86_64-2.5.0.args   | 33 +++++++++++++++++
99cbc7
 .../channel-unix-guestfwd.x86_64-latest.args  | 36 ++++++++++++++++++
99cbc7
 .../channel-unix-guestfwd.xml                 | 37 +++++++++++++++++++
99cbc7
 tests/qemuxml2argvtest.c                      |  2 +
99cbc7
 4 files changed, 108 insertions(+)
99cbc7
 create mode 100644 tests/qemuxml2argvdata/channel-unix-guestfwd.x86_64-2.5.0.args
99cbc7
 create mode 100644 tests/qemuxml2argvdata/channel-unix-guestfwd.x86_64-latest.args
99cbc7
 create mode 100644 tests/qemuxml2argvdata/channel-unix-guestfwd.xml
99cbc7
99cbc7
diff --git a/tests/qemuxml2argvdata/channel-unix-guestfwd.x86_64-2.5.0.args b/tests/qemuxml2argvdata/channel-unix-guestfwd.x86_64-2.5.0.args
99cbc7
new file mode 100644
99cbc7
index 0000000000..f0e718e4a2
99cbc7
--- /dev/null
99cbc7
+++ b/tests/qemuxml2argvdata/channel-unix-guestfwd.x86_64-2.5.0.args
99cbc7
@@ -0,0 +1,33 @@
99cbc7
+LC_ALL=C \
99cbc7
+PATH=/bin \
99cbc7
+HOME=/home/test \
99cbc7
+USER=test \
99cbc7
+LOGNAME=test \
99cbc7
+QEMU_AUDIO_DRV=none \
99cbc7
+/usr/bin/qemu-system-x86_64 \
99cbc7
+-name guest=QEMUGuest1,debug-threads=on \
99cbc7
+-S \
99cbc7
+-machine pc-i440fx-2.5,accel=kvm,usb=off,dump-guest-core=off \
99cbc7
+-m 214 \
99cbc7
+-realtime mlock=off \
99cbc7
+-smp 1,sockets=1,cores=1,threads=1 \
99cbc7
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
99cbc7
+-display none \
99cbc7
+-no-user-config \
99cbc7
+-nodefaults \
99cbc7
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
99cbc7
+server,nowait \
99cbc7
+-mon chardev=charmonitor,id=monitor,mode=control \
99cbc7
+-rtc base=utc \
99cbc7
+-no-shutdown \
99cbc7
+-no-acpi \
99cbc7
+-boot strict=on \
99cbc7
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
99cbc7
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
99cbc7
+-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
99cbc7
+-chardev socket,id=charchannel0,path=/tmp/guestfwd-listen.socket,server,nowait \
99cbc7
+-netdev user,guestfwd=tcp:10.0.2.1:4600-chardev:charchannel0,id=user-channel0 \
99cbc7
+-chardev socket,id=charchannel1,path=/tmp/guestfwd-connect.socket \
99cbc7
+-netdev user,guestfwd=tcp:10.0.2.1:4601-chardev:charchannel1,id=user-channel1 \
99cbc7
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
99cbc7
+-msg timestamp=on
99cbc7
diff --git a/tests/qemuxml2argvdata/channel-unix-guestfwd.x86_64-latest.args b/tests/qemuxml2argvdata/channel-unix-guestfwd.x86_64-latest.args
99cbc7
new file mode 100644
99cbc7
index 0000000000..f9b9ee5fdb
99cbc7
--- /dev/null
99cbc7
+++ b/tests/qemuxml2argvdata/channel-unix-guestfwd.x86_64-latest.args
99cbc7
@@ -0,0 +1,36 @@
99cbc7
+LC_ALL=C \
99cbc7
+PATH=/bin \
99cbc7
+HOME=/home/test \
99cbc7
+USER=test \
99cbc7
+LOGNAME=test \
99cbc7
+QEMU_AUDIO_DRV=none \
99cbc7
+/usr/bin/qemu-system-x86_64 \
99cbc7
+-name guest=QEMUGuest1,debug-threads=on \
99cbc7
+-S \
99cbc7
+-object secret,id=masterKey0,format=raw,\
99cbc7
+file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
99cbc7
+-machine pc,accel=kvm,usb=off,dump-guest-core=off \
99cbc7
+-m 214 \
99cbc7
+-realtime mlock=off \
99cbc7
+-smp 1,sockets=1,cores=1,threads=1 \
99cbc7
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
99cbc7
+-display none \
99cbc7
+-no-user-config \
99cbc7
+-nodefaults \
99cbc7
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
99cbc7
+-mon chardev=charmonitor,id=monitor,mode=control \
99cbc7
+-rtc base=utc \
99cbc7
+-no-shutdown \
99cbc7
+-no-acpi \
99cbc7
+-boot strict=on \
99cbc7
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
99cbc7
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
99cbc7
+-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
99cbc7
+-chardev socket,id=charchannel0,fd=1729,server,nowait \
99cbc7
+-netdev user,guestfwd=tcp:10.0.2.1:4600-chardev:charchannel0,id=user-channel0 \
99cbc7
+-chardev socket,id=charchannel1,path=/tmp/guestfwd-connect.socket \
99cbc7
+-netdev user,guestfwd=tcp:10.0.2.1:4601-chardev:charchannel1,id=user-channel1 \
99cbc7
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
99cbc7
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
99cbc7
+resourcecontrol=deny \
99cbc7
+-msg timestamp=on
99cbc7
diff --git a/tests/qemuxml2argvdata/channel-unix-guestfwd.xml b/tests/qemuxml2argvdata/channel-unix-guestfwd.xml
99cbc7
new file mode 100644
99cbc7
index 0000000000..c9698a1259
99cbc7
--- /dev/null
99cbc7
+++ b/tests/qemuxml2argvdata/channel-unix-guestfwd.xml
99cbc7
@@ -0,0 +1,37 @@
99cbc7
+<domain type='kvm'>
99cbc7
+  <name>QEMUGuest1</name>
99cbc7
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
99cbc7
+  <memory unit='KiB'>219100</memory>
99cbc7
+  <currentMemory unit='KiB'>219100</currentMemory>
99cbc7
+  <vcpu>1</vcpu>
99cbc7
+  <os>
99cbc7
+    <type arch='x86_64' machine='pc'>hvm</type>
99cbc7
+    <boot dev='hd'/>
99cbc7
+  </os>
99cbc7
+  <clock offset='utc'/>
99cbc7
+  <on_poweroff>destroy</on_poweroff>
99cbc7
+  <on_reboot>restart</on_reboot>
99cbc7
+  <on_crash>destroy</on_crash>
99cbc7
+  <devices>
99cbc7
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
99cbc7
+    <disk type='block' device='disk'>
99cbc7
+      <source dev='/dev/HostVG/QEMUGuest1'/>
99cbc7
+      <target dev='hda' bus='ide'/>
99cbc7
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
99cbc7
+    </disk>
99cbc7
+    <controller type='usb' index='0'/>
99cbc7
+    <controller type='ide' index='0'/>
99cbc7
+    <controller type='pci' index='0' model='pci-root'/>
99cbc7
+    <channel type='unix'>
99cbc7
+      <source mode='bind' path='/tmp/guestfwd-listen.socket'/>
99cbc7
+      <target type='guestfwd' address='10.0.2.1' port='4600'/>
99cbc7
+    </channel>
99cbc7
+    <channel type='unix'>
99cbc7
+      <source mode='connect' path='/tmp/guestfwd-connect.socket'/>
99cbc7
+      <target type='guestfwd' address='10.0.2.1' port='4601'/>
99cbc7
+    </channel>
99cbc7
+    <input type='mouse' bus='ps2'/>
99cbc7
+    <input type='keyboard' bus='ps2'/>
99cbc7
+    <memballoon model='virtio'/>
99cbc7
+  </devices>
99cbc7
+</domain>
99cbc7
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
99cbc7
index f401076731..693e768d66 100644
99cbc7
--- a/tests/qemuxml2argvtest.c
99cbc7
+++ b/tests/qemuxml2argvtest.c
99cbc7
@@ -1403,6 +1403,8 @@ mymain(void)
99cbc7
             QEMU_CAPS_DEVICE_PCI_SERIAL);
99cbc7
 
99cbc7
     DO_TEST("channel-guestfwd", NONE);
99cbc7
+    DO_TEST_CAPS_VER("channel-unix-guestfwd", "2.5.0");
99cbc7
+    DO_TEST_CAPS_LATEST("channel-unix-guestfwd");
99cbc7
     DO_TEST("channel-virtio", NONE);
99cbc7
     DO_TEST("channel-virtio-state", NONE);
99cbc7
     DO_TEST("channel-virtio-auto", NONE);
99cbc7
-- 
99cbc7
2.21.0
99cbc7