tests: Use more explicit netcat options for distro/fedora tests

distro/fedora contains two versions of the basic tests, used for different
Fedora versions.  One uses explicit listening address for netcat in some
extra places, the other does not.  Apparently the older netcat versions
didn't require the explicit addresses.  Not supplying addresses doesn't
test anything useful though, just a detail in netcat's behaviour.  So,
it's cleaner to just always supply explicit addresses.

In addition, we're explicitly expecting the nmap version of ncat, also
known as "ncat".  So, it's more explicit what we're after if we invoke it
via that name rather than "nc", which will go via an /etc/alternatives
link.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[sbrivio: Fix port argument in distro_quick_pasta_test{,_fedora34} too]
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
David Gibson 2022-06-10 12:32:41 +10:00 committed by Stefano Brivio
parent d7d467f60c
commit 6703da44c1

View file

@ -16,13 +16,13 @@ htools wget virt-edit guestfish head sed cat kill
# 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 ::1 9999) &
host (ncat -6 -l ::1 10000 > /tmp/init_msg; echo "from_init" | ncat ::1 9999) &
hostb ./pasta
sleep 1
host PS1='$ '
host nc -6 -l -p 9999 > /tmp/ns_msg &
host ncat -6 -l ::1 9999 > /tmp/ns_msg &
sleep 2
host echo "from_ns" | nc ::1 10000
host echo "from_ns" | ncat ::1 10000
sleep 2
host echo
sleep 1
@ -34,17 +34,17 @@ hout INIT_MSG cat /tmp/init_msg
check [ __INIT_MSG__ = "from_ns" ]
endef
# Explicit listening address, bracketed paste mode off, needed from Fedora 34
# Bracketed paste mode off, needed from Fedora 34
def distro_quick_pasta_test_fedora34
host bind 'set enable-bracketed-paste off'
host (nc -6 -l -p 10000 > /tmp/init_msg; echo "from_init" | nc -6 ::1 9999) &
host (ncat -6 -l ::1 10000 > /tmp/init_msg; echo "from_init" | ncat -6 ::1 9999) &
hostb ./pasta
sleep 1
host PS1='$ '
host bind 'set enable-bracketed-paste off'
host nc -6 -l ::1 9999 > /tmp/ns_msg &
host ncat -6 -l ::1 9999 > /tmp/ns_msg &
sleep 2
host echo "from_ns" | nc -6 ::1 10000
host echo "from_ns" | ncat -6 ::1 10000
sleep 2
host echo
hout NS_MSG cat /tmp/ns_msg