public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top
Subject: [PATCH 01/10] test: Convert distro tests to use socat instead of nc/ncat
Date: Thu, 18 Aug 2022 16:13:49 +1000	[thread overview]
Message-ID: <20220818061358.1775944-2-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20220818061358.1775944-1-david@gibson.dropbear.id.au>

[-- Attachment #1: Type: text/plain, Size: 21331 bytes --]

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(a)gibson.dropbear.id.au>
---
 test/distro/debian   | 28 +++++++++++++-------------
 test/distro/fedora   | 48 ++++++++++++++++++++++----------------------
 test/distro/opensuse | 18 ++++++++---------
 test/distro/ubuntu   | 16 +++++++--------
 4 files changed, 55 insertions(+), 55 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 ad2108f..75b49c8 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 b9a0446..b85a4e2 100644
--- a/test/distro/ubuntu
+++ b/test/distro/ubuntu
@@ -16,13 +16,13 @@ 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	(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	PS1='$ '
-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
@@ -59,7 +59,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 +92,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 +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="-Wno-missing-field-initializers -Wno-missing-braces -Wno-type-limits -Wno-sign-compare" make
@@ -145,7 +145,7 @@ 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
-host	apt-get -y install make gcc netcat-openbsd
+host	apt-get -y install make gcc socat
 
 host	make clean
 host	CFLAGS="-Werror" make
@@ -169,7 +169,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
-- 
@@ -16,13 +16,13 @@ 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	(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	PS1='$ '
-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
@@ -59,7 +59,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 +92,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 +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="-Wno-missing-field-initializers -Wno-missing-braces -Wno-type-limits -Wno-sign-compare" make
@@ -145,7 +145,7 @@ 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
-host	apt-get -y install make gcc netcat-openbsd
+host	apt-get -y install make gcc socat
 
 host	make clean
 host	CFLAGS="-Werror" make
@@ -169,7 +169,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
-- 
2.37.2


  reply	other threads:[~2022-08-18  6:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-18  6:13 [PATCH 00/10] passt test fixes, batch 6 David Gibson
2022-08-18  6:13 ` David Gibson [this message]
2022-08-18  6:13 ` [PATCH 02/10] test: Split cppcheck and clang-tidy tests into different files David Gibson
2022-08-18  6:13 ` [PATCH 03/10] test: Remove unused *_XTERM variables David Gibson
2022-08-18  6:13 ` [PATCH 04/10] test: Ignore video processing temporary files David Gibson
2022-08-18  6:13 ` [PATCH 05/10] test: Split setup/teardown functions for build and distro tests David Gibson
2022-08-18  6:13 ` [PATCH 06/10] test: Only select a single interface or gateway in tests David Gibson
2022-08-18  6:13 ` [PATCH 07/10] test: Rename slightly misleading "valgrind" tests David Gibson
2022-08-18  6:13 ` [PATCH 08/10] test: Use shutdown test for pasta David Gibson
2022-08-18  6:13 ` [PATCH 09/10] test: Log debugging output from test script David Gibson
2022-08-18  6:13 ` [PATCH 10/10] test: Kill qemu by pidfile rather than ^C David Gibson
2022-08-21 20:23 ` [PATCH 00/10] passt test fixes, batch 6 Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220818061358.1775944-2-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).