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