From a8598c7e70df60e1193993ac6b7c4c729518c7aa Mon Sep 17 00:00:00 2001 From: David Gibson Date: Thu, 18 Aug 2022 16:13:49 +1000 Subject: 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 [sbrivio: keep using netcat-openbsd in Ubuntu 16.04 ppc64 test, as socat is unavailable there] Signed-off-by: Stefano Brivio --- test/distro/opensuse | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'test/distro/opensuse') 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 -- cgit v1.2.3