aboutgitcodebugslistschat
path: root/test
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-08-18 16:13:49 +1000
committerStefano Brivio <sbrivio@redhat.com>2022-08-20 19:07:12 +0200
commita8598c7e70df60e1193993ac6b7c4c729518c7aa (patch)
treeea7bc8ae3176d6edb5cb479d6ab355f39ef0f513 /test
parent662407de0fae6335bbaff935a5d7969853e547a0 (diff)
downloadpasst-a8598c7e70df60e1193993ac6b7c4c729518c7aa.tar
passt-a8598c7e70df60e1193993ac6b7c4c729518c7aa.tar.gz
passt-a8598c7e70df60e1193993ac6b7c4c729518c7aa.tar.bz2
passt-a8598c7e70df60e1193993ac6b7c4c729518c7aa.tar.lz
passt-a8598c7e70df60e1193993ac6b7c4c729518c7aa.tar.xz
passt-a8598c7e70df60e1193993ac6b7c4c729518c7aa.tar.zst
passt-a8598c7e70df60e1193993ac6b7c4c729518c7aa.zip
test: Convert distro tests to use socat instead of nc/ncat
We've recently converted most of our tests to use socat instead of nc/netcat/ncat, because socat is more powerful and we don't need to deal with the several possible variants of netcat. We still use nc or ncat for the distro tests. Because there we control the guest environment and can pick our tools, there isn't the same reason to switch to socat. However, using socat here as well makes the tests a bit easier to read, and doesn't require people reading or modifying them to become familiar with an additional tool. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> [sbrivio: keep using netcat-openbsd in Ubuntu 16.04 ppc64 test, as socat is unavailable there] Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/distro/debian28
-rw-r--r--test/distro/fedora48
-rw-r--r--test/distro/opensuse18
-rw-r--r--test/distro/ubuntu32
4 files changed, 74 insertions, 52 deletions
diff --git a/test/distro/debian b/test/distro/debian
index 1548761..0fac983 100644
--- a/test/distro/debian
+++ b/test/distro/debian
@@ -18,12 +18,12 @@ htools cat kill qemu-system-x86_64 qemu-system-aarch64 qemu-system-ppc64
def distro_quick_pasta_test
host export SHELL="/bin/dash"
host dash
-host (nc -w1 -6 -l -p 10000 > /tmp/init_msg; echo "from_init" | nc -q0 ::1 9999) &
+host (socat -u TCP6-LISTEN:10000 OPEN:/tmp/init_msg,create,trunc; echo "from_init" | socat -u STDIN TCP6:[::1]:9999) &
hostb ./pasta
sleep 1
-host nc -w1 -6 -l -p 9999 > /tmp/ns_msg &
+host socat -u TCP6-LISTEN:9999 OPEN:/tmp/ns_msg,create,trunc &
sleep 2
-host echo "from_ns" | nc -q0 ::1 10000
+host echo "from_ns" | socat -u STDIN TCP6:[::1]:10000
sleep 2
host echo
sleep 1
@@ -47,7 +47,7 @@ host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial
host PS1='$ '
sleep 2
host apt-get update
-host apt-get -y install make gcc netcat-openbsd
+host apt-get -y install make gcc socat
host make clean
host CFLAGS="-Wno-missing-field-initializers -Wno-missing-braces -Wno-type-limits" make
@@ -68,7 +68,7 @@ host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial
host PS1='$ '
sleep 2
host apt-get update
-host apt-get -y install make gcc netcat-openbsd
+host apt-get -y install make gcc socat
host make clean
host CFLAGS="-Werror" make
@@ -86,7 +86,7 @@ host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial
host PS1='$ '
sleep 2
host apt-get update
-host apt-get -y install make gcc netcat-openbsd
+host apt-get -y install make gcc socat
host make clean
host CFLAGS="-Werror" make
@@ -104,7 +104,7 @@ host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios _
host PS1='$ '
sleep 2
host apt-get update
-host apt-get -y install make gcc netcat-openbsd
+host apt-get -y install make gcc socat
host make clean
host CFLAGS="-Werror" make
@@ -122,7 +122,7 @@ host ./qrap 5 qemu-system-ppc64 -m 2048 -smp 2 -nographic -serial stdio -nodefau
host PS1='$ '
sleep 2
host apt-get update
-host apt-get -y install make gcc netcat-openbsd
+host apt-get -y install make gcc socat
host make clean
host CFLAGS="-Werror" make
@@ -140,7 +140,7 @@ test Debian GNU/Linux 11 (bullseye, stable), amd64
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-11-nocloud-amd64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
sleep 2
host apt-get update
-host apt-get -y install make gcc netcat-openbsd
+host apt-get -y install make gcc socat
host make clean
host CFLAGS="-Werror" make
@@ -156,7 +156,7 @@ test Debian GNU/Linux 11 (bullseye, stable), aarch64
host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-11-generic-arm64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
sleep 2
host apt-get update
-host apt-get -y install make gcc netcat-openbsd
+host apt-get -y install make gcc socat
host make clean
host CFLAGS="-Werror" make
@@ -172,7 +172,7 @@ test Debian GNU/Linux 11 (bullseye, stable), ppc64le
host ./qrap 5 qemu-system-ppc64 -m 2048 -smp 2 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-11-generic-ppc64el.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
sleep 2
host apt-get update
-host apt-get -y install make gcc netcat-openbsd
+host apt-get -y install make gcc socat
host make clean
host CFLAGS="-Werror" make
@@ -198,7 +198,7 @@ sleep 2
host growpart /dev/sda 1
host resize2fs -p /dev/sda1
host apt-get update
-host apt-get -y install make gcc netcat-openbsd
+host apt-get -y install make gcc socat
host make clean
host CFLAGS="-Werror" make
@@ -217,7 +217,7 @@ sleep 2
host growpart /dev/vda 1
host resize2fs -p /dev/vda1
host apt-get update
-host apt-get -y install make gcc netcat-openbsd
+host apt-get -y install make gcc socat
host make clean
host CFLAGS="-Werror" make
@@ -233,7 +233,7 @@ test Debian GNU/Linux sid (experimental), ppc64le
host ./qrap 5 qemu-system-ppc64 -m 2048 -smp 2 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-sid-nocloud-ppc64el-daily.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
sleep 2
host apt-get update
-host apt-get -y install make gcc netcat-openbsd
+host apt-get -y install make gcc socat
host make clean
host CFLAGS="-Werror" make
diff --git a/test/distro/fedora b/test/distro/fedora
index 56805c5..daad6a4 100644
--- a/test/distro/fedora
+++ b/test/distro/fedora
@@ -16,13 +16,13 @@ htools cat kill qemu-system-x86_64
# Quick pasta test: send message from init to ns, and from ns to init
def distro_quick_pasta_test
-host (ncat -6 -l ::1 10000 > /tmp/init_msg; echo "from_init" | ncat ::1 9999) &
+host (socat -u TCP6-LISTEN:10000,bind=[::1] OPEN:/tmp/init_msg,create,trunc; echo "from_init" | socat -u STDIN TCP6:[::1]:9999) &
hostb ./pasta
sleep 1
host PS1='$ '
-host ncat -6 -l ::1 9999 > /tmp/ns_msg &
+host socat -u TCP6-LISTEN:9999,bind=[::1] OPEN:/tmp/ns_msg,create,trunc &
sleep 2
-host echo "from_ns" | ncat ::1 10000
+host echo "from_ns" | socat -u STDIN TCP6:[::1]:10000
sleep 2
host echo
sleep 1
@@ -37,14 +37,14 @@ endef
# Bracketed paste mode off, needed from Fedora 34
def distro_quick_pasta_test_fedora34
host bind 'set enable-bracketed-paste off'
-host (ncat -6 -l ::1 10000 > /tmp/init_msg; echo "from_init" | ncat -6 ::1 9999) &
+host (socat -u TCP6-LISTEN:10000,bind=[::1] OPEN:/tmp/init_msg,create,trunc; echo "from_init" | socat -u STDIN TCP6:[::1]:9999) &
hostb ./pasta
sleep 1
host PS1='$ '
host bind 'set enable-bracketed-paste off'
-host ncat -6 -l ::1 9999 > /tmp/ns_msg &
+host socat -u TCP6-LISTEN:9999,bind=[::1] OPEN:/tmp/ns_msg,create,trunc &
sleep 2
-host echo "from_ns" | ncat -6 ::1 10000
+host echo "from_ns" | socat -u STDIN TCP6:[::1]:10000
sleep 2
host echo
hout NS_MSG cat /tmp/ns_msg
@@ -65,7 +65,7 @@ test Fedora 26, x86_64
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-26-1.5.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
-host yum -y install make gcc nmap-ncat
+host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
@@ -85,7 +85,7 @@ test Fedora 27, x86_64
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-27-1.6.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
-host yum -y install make gcc nmap-ncat
+host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
@@ -102,7 +102,7 @@ test Fedora 28, x86_64
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-28-1.1.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
-host yum -y install make gcc nmap-ncat
+host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
@@ -119,7 +119,7 @@ test Fedora 28, aarch64
host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-28-1.1.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
-host yum -y install make gcc nmap-ncat
+host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
@@ -139,7 +139,7 @@ test Fedora 29, x86_64
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-29-1.2.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
-host yum -y install make gcc nmap-ncat
+host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
@@ -156,7 +156,7 @@ test Fedora 29, aarch64
host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-29-1.2.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
-host yum -y install make gcc nmap-ncat
+host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
@@ -176,7 +176,7 @@ test Fedora 30, x86_64
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-30-1.2.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
-host yum -y install make gcc nmap-ncat
+host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
@@ -193,7 +193,7 @@ test Fedora 30, aarch64
host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-30-1.2.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
-host yum -y install make gcc nmap-ncat
+host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
@@ -213,7 +213,7 @@ test Fedora 31, x86_64
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-31-1.9.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
-host yum -y install make gcc nmap-ncat
+host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
@@ -230,7 +230,7 @@ test Fedora 31, aarch64
host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-31-1.9.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
-host yum -y install make gcc nmap-ncat
+host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
@@ -250,7 +250,7 @@ test Fedora 32, x86_64
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-32-1.6.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
-host yum -y install make gcc nmap-ncat
+host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
@@ -267,7 +267,7 @@ test Fedora 32, aarch64
host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-32-1.6.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
-host yum -y install make gcc nmap-ncat
+host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
@@ -287,7 +287,7 @@ test Fedora 33, x86_64
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-33-1.2.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
-host yum -y install make gcc nmap-ncat
+host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
@@ -304,7 +304,7 @@ test Fedora 33, aarch64
host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-33-1.2.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
-host yum -y install make gcc nmap-ncat
+host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
@@ -324,7 +324,7 @@ test Fedora 34, x86_64
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-34-1.2.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
-host yum -y install make gcc nmap-ncat
+host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
@@ -341,7 +341,7 @@ test Fedora 34, aarch64
host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-34-1.2.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
-host yum -y install make gcc nmap-ncat
+host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
@@ -361,7 +361,7 @@ test Fedora 35, x86_64
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-35-1.2.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
-host yum -y install make gcc nmap-ncat
+host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
@@ -378,7 +378,7 @@ test Fedora 35, aarch64
host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-35-1.2.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
-host yum -y install make gcc nmap-ncat
+host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
diff --git a/test/distro/opensuse b/test/distro/opensuse
index d77821a..d48deb7 100644
--- a/test/distro/opensuse
+++ b/test/distro/opensuse
@@ -16,13 +16,13 @@ htools qemu-img virt-edit guestfish head sed cat kill qemu-system-x86_64 qemu-sy
# Quick pasta test: send message from init to ns, and from ns to init
def distro_quick_pasta_test
-host (nc -6 -l -p 10000 > /tmp/init_msg; echo "from_init" | nc -N ::1 9999) &
+host (socat -u TCP6-LISTEN:10000 OPEN:/tmp/init_msg,create,trunc; echo "from_init" | socat -u STDIN TCP6:[::1]:9999) &
hostb ./pasta
sleep 1
host PS1='$ '
-host nc -6 -l -p 9999 > /tmp/ns_msg &
+host socat -u TCP6-LISTEN:9999 OPEN:/tmp/ns_msg,create,trunc &
sleep 2
-host echo "from_ns" | nc -N ::1 10000
+host echo "from_ns" | socat -u STDIN TCP6:[::1]:10000
sleep 2
host echo
sleep 1
@@ -57,7 +57,7 @@ host ip link set eth0 up
sleep 2
host echo "DNSSERVERS='__DNS6__'" | netconfig modify -s dns_resolver -i eth0
# zypper sometimes segfaults, hence the retries
-host for i in $(seq 1 10); do zypper install -y gcc make netcat-openbsd && break; done; echo
+host for i in $(seq 1 10); do zypper install -y gcc make socat && break; done; echo
host make clean
host CFLAGS="-Werror" make
@@ -85,7 +85,7 @@ host ip link set eth0 up
sleep 2
host echo "DNSSERVERS='__DNS6__'" | netconfig modify -s dns_resolver -i eth0
# zypper sometimes segfaults, hence the retries
-host for i in $(seq 1 10); do zypper install -y gcc make netcat-openbsd && break; done; echo
+host for i in $(seq 1 10); do zypper install -y gcc make socat && break; done; echo
host make clean
host CFLAGS="-Werror" make
@@ -112,7 +112,7 @@ host ip link set eth0 up
sleep 2
host echo "DNSSERVERS='__DNS6__'" | netconfig modify -s dns_resolver -i eth0
# zypper sometimes segfaults, hence the retries
-host for i in $(seq 1 10); do zypper install -y gcc make netcat-openbsd && break; done; echo
+host for i in $(seq 1 10); do zypper install -y gcc make socat && break; done; echo
host make clean
host CFLAGS="-Werror" make
@@ -137,7 +137,7 @@ sleep 10
host echo "DNSSERVERS='__DNS6__'" | netconfig modify -s dns_resolver -i enp0s1
sleep 10
# No segfaults ever seen with this
-host zypper install -y gcc make netcat-openbsd; echo
+host zypper install -y gcc make socat; echo
host make clean
host CFLAGS="-Werror" make
@@ -165,7 +165,7 @@ host ip link set eth0 up
sleep 10
host echo "DNSSERVERS='__DNS6__'" | netconfig modify -s dns_resolver -i eth0
sleep 10
-host zypper install -y gcc make netcat-openbsd; echo
+host zypper install -y gcc make socat; echo
host make clean
host CFLAGS="-Werror" make
@@ -192,7 +192,7 @@ host ip link set ens2 up
sleep 2
host echo "DNSSERVERS='__DNS6__'" | netconfig modify -s dns_resolver -i ens2
# zypper sometimes segfaults, hence the retries
-host for i in $(seq 1 10); do zypper install -y gcc make netcat-openbsd && break; done; echo
+host for i in $(seq 1 10); do zypper install -y gcc make socat && break; done; echo
host make clean
host CFLAGS="-Werror" make
diff --git a/test/distro/ubuntu b/test/distro/ubuntu
index ec6c819..6666f38 100644
--- a/test/distro/ubuntu
+++ b/test/distro/ubuntu
@@ -16,6 +16,26 @@ htools qemu-img virt-edit guestfish cat kill qemu-system-x86_64 qemu-system-ppc6
# Quick pasta test: send message from init to ns, and from ns to init
def distro_quick_pasta_test
+host (socat -u TCP6-LISTEN:10000 OPEN:/tmp/init_msg,create,trunc; echo "from_init" | socat -u STDIN TCP6:[::1]:9999) &
+hostb ./pasta
+sleep 1
+host PS1='$ '
+host socat -u TCP6-LISTEN:9999 OPEN:/tmp/ns_msg,create,trunc &
+sleep 2
+host echo "from_ns" | socat -u STDIN TCP6:[::1]:10000
+sleep 2
+host echo
+sleep 1
+hout NS_MSG cat /tmp/ns_msg
+check [ __NS_MSG__ = "from_init" ]
+hostb exit
+host echo
+hout INIT_MSG cat /tmp/init_msg
+check [ __INIT_MSG__ = "from_ns" ]
+endef
+
+# Quick pasta test: netcat-openbsd version for Ubuntu 16.04 ppc64
+def distro_quick_pasta_test_netcat
host (nc -w1 -6 -l -p 10000 > /tmp/init_msg; echo "from_init" | nc -q0 ::1 9999) &
hostb ./pasta
sleep 1
@@ -59,7 +79,7 @@ host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial
host PS1='$ '
sleep 2
host apt-get update
-host apt-get -y install make gcc netcat-openbsd
+host apt-get -y install make gcc socat
host make clean
host CFLAGS="-Wno-missing-field-initializers -Wno-missing-braces -Wno-type-limits" make
@@ -92,7 +112,7 @@ host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial
host PS1='$ '
sleep 2
host apt-get update
-host apt-get -y install make gcc netcat-openbsd
+host apt-get -y install make gcc socat
host make clean
host CFLAGS="-Wno-missing-field-initializers -Wno-missing-braces -Wno-type-limits -Wno-sign-compare" make
@@ -122,7 +142,7 @@ host ./qrap 5 qemu-system-ppc64 -m 2048 -smp 2 -nographic -serial stdio -nodefau
host PS1='$ '
sleep 2
host apt-get update
-host apt-get -y install make gcc netcat-openbsd
+host apt-get -y install make gcc socat
host make clean
host CFLAGS="-Wno-missing-field-initializers -Wno-missing-braces -Wno-type-limits -Wno-sign-compare" make
@@ -145,12 +165,14 @@ host dhclient -4
# Skip apt-get update here: some updates to xenial-updates around 2022-01-30
# broke dependencies for libc6 and gcc-5 -- note that powerpc is not officially
# supported on this version
+
+# socat not available: install netcat-openbsd and run the test with it
host apt-get -y install make gcc netcat-openbsd
host make clean
host CFLAGS="-Werror" make
-distro_quick_pasta_test
+distro_quick_pasta_test_netcat
hint
sleep 1
@@ -169,7 +191,7 @@ host apt-get -y remove needrestart snapd
host dhclient -4
sleep 2
host apt-get update
-host apt-get -y install make gcc netcat-openbsd
+host apt-get -y install make gcc socat
host make clean
host CFLAGS="-Werror" make