aboutgitcodebugslistschat
path: root/test/two_guests
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-07-15 15:21:34 +1000
committerStefano Brivio <sbrivio@redhat.com>2022-07-22 19:41:42 +0200
commit1aaa2bd189cb42a26ee411fd1652e7479d82f005 (patch)
tree56b8221eccaf1198620485593045dfbc39f41e0c /test/two_guests
parent05dc1c65c11c05709ebde73e74d91fd29226ba9c (diff)
downloadpasst-1aaa2bd189cb42a26ee411fd1652e7479d82f005.tar
passt-1aaa2bd189cb42a26ee411fd1652e7479d82f005.tar.gz
passt-1aaa2bd189cb42a26ee411fd1652e7479d82f005.tar.bz2
passt-1aaa2bd189cb42a26ee411fd1652e7479d82f005.tar.lz
passt-1aaa2bd189cb42a26ee411fd1652e7479d82f005.tar.xz
passt-1aaa2bd189cb42a26ee411fd1652e7479d82f005.tar.zst
passt-1aaa2bd189cb42a26ee411fd1652e7479d82f005.zip
tests: Use socat instead of netcat
Commit 41c02e10 ("tests: Use nmap-ncat instead of openbsd netcat for pasta tests") updated the pasta tests to use the nmap version of ncat instead of the openbsd version, for greater portability. For some upcoming changes, however, we'll be wanting to use socat. "socat" can do everything "ncat" can and more, so let's move all the tests using host tools (either directly on the host or via mbuto generated images) to using socat instead. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> [sbrivio: Fix a typo in port specification, 31337 instead of x31337] Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'test/two_guests')
-rw-r--r--test/two_guests/basic22
1 files changed, 11 insertions, 11 deletions
diff --git a/test/two_guests/basic b/test/two_guests/basic
index 850a27b..cf0b975 100644
--- a/test/two_guests/basic
+++ b/test/two_guests/basic
@@ -11,9 +11,9 @@
# Copyright (c) 2021 Red Hat GmbH
# Author: Stefano Brivio <sbrivio@redhat.com>
-g1tools ip jq dhclient nc cat
-g2tools ip jq dhclient nc cat
-htools ip jq cat md5sum cut
+g1tools ip jq dhclient socat cat
+g2tools ip jq dhclient socat cat
+htools ip jq md5sum cut
test Interface names
g1out IFNAME1 ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
@@ -46,8 +46,8 @@ check [ "__ADDR2_6__" = "__HOST_ADDR6__" ]
test TCP/IPv4: guest 1 > guest 2
g1out GW1 ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
-guest2b nc -4 -l 10004 > msg
-guest1 echo "Hello_from_guest_1" | nc -N __GW1__ 10004
+guest2b socat -u TCP4-LISTEN:10004 OPEN:msg,create,trunc
+guest1 echo "Hello_from_guest_1" | socat -u STDIN TCP4:__GW1__:10004
guest2w
sleep 1
g2out MSG2 cat msg
@@ -55,24 +55,24 @@ check [ "__MSG2__" = "Hello_from_guest_1" ]
test TCP/IPv6: guest 2 > guest 1
g2out GW2_6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
-guest1b nc -6 -l 10001 > msg
-guest2 echo "Hello_from_guest_2" | nc -N __GW2_6__%__IFNAME2__ 10001
+guest1b socat -u TCP6-LISTEN:10001 OPEN:msg,create,trunc
+guest2 echo "Hello_from_guest_2" | socat -u STDIN TCP6:[__GW2_6__%__IFNAME2__]:10001
guest1w
sleep 1
g1out MSG1 cat msg
check [ "__MSG1__" = "Hello_from_guest_2" ]
test UDP/IPv4: guest 1 > guest 2
-guest2b nc -u -W1 -4 -l 10004 > msg
-guest1 echo "Hello_from_guest_1" | nc -u -q1 __GW1__ 10004
+guest2b socat -u TCP4-LISTEN:10004 OPEN:msg,create,trunc
+guest1 echo "Hello_from_guest_1" | socat -u STDIN TCP4:__GW1__:10004
guest2w
sleep 1
g2out MSG2 cat msg
check [ "__MSG2__" = "Hello_from_guest_1" ]
test UDP/IPv6: guest 2 > guest 1
-guest1b nc -u -W1 -6 -l 10001 > msg
-guest2 echo "Hello_from_guest_2" | nc -u -q1 -N __GW2_6__%__IFNAME2__ 10001
+guest1b socat -u TCP6-LISTEN:10001 OPEN:msg,create,trunc
+guest2 echo "Hello_from_guest_2" | socat -u STDIN TCP6:[__GW2_6__%__IFNAME2__]:10001
guest1w
sleep 1
g1out MSG1 cat msg