[ovs-dev] [PATCH] system-traffic: use appropriate nc options for installed version
Lance Richardson
lrichard at redhat.com
Thu Jan 21 19:57:04 UTC 2016
The "conntrack - ICMP related with NAT" test case currently fails
on systems using the nmap version of nc because this version
does not support the -q command-line option.
Fix this by detecting when the nmap version is in use and using the
corresponding "--send-only" command-line option:
--send-only Only send data, ignoring received; quit on EOF
Signed-off-by: Lance Richardson <lrichard at redhat.com>
---
tests/atlocal.in | 7 +++++++
tests/system-traffic.at | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/tests/atlocal.in b/tests/atlocal.in
index 5815c6c..2a163db 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -117,3 +117,10 @@ if test "$HAVE_PYTHON" = "yes" \
else
HAVE_PYFTPDLIB="no"
fi
+
+# Determine correct netcat option to quit on stdin EOF
+if nc --version 2>&1 | grep -q nmap.org; then
+ NC_EOF_OPT="--send-only"
+else
+ NC_EOF_OPT="-q 1"
+fi
diff --git a/tests/system-traffic.at b/tests/system-traffic.at
index 74ca0a0..1c0fe81 100644
--- a/tests/system-traffic.at
+++ b/tests/system-traffic.at
@@ -1693,7 +1693,7 @@ AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
dnl UDP packets from ns0->ns1 should solicit "destination unreachable" response.
dnl We pass "-q 1" here to handle openbsd-style nc that can't quit immediately.
-NS_CHECK_EXEC([at_ns0], [bash -c "echo a | nc -q 1 -u 10.1.1.2 10000"])
+NS_CHECK_EXEC([at_ns0], [bash -c "echo a | nc $NC_EOF_OPT -u 10.1.1.2 10000"])
AT_CHECK([ovs-appctl revalidator/purge], [0])
AT_CHECK([ovs-ofctl -O OpenFlow15 dump-flows br0 | ofctl_strip | sort | grep -v drop], [0], [dnl
--
2.1.4
More information about the dev
mailing list