diff mbox

[ovs-dev,2/3] system-traffic: Skip test cases if netcat is not installed.

Message ID 1481250847-49316-2-git-send-email-yihung.wei@gmail.com
State Accepted
Headers show

Commit Message

Yi-Hung Wei Dec. 9, 2016, 2:34 a.m. UTC
Test cases that use netcat will fail if netcat is not installed. This patch
detects if netcat is present, and skips those test cases if netcat is not there.

Singed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
---
 tests/atlocal.in        | 17 +++++++++++++++++
 tests/system-traffic.at |  5 +++++
 2 files changed, 22 insertions(+)

Comments

Joe Stringer Dec. 14, 2016, 11:14 p.m. UTC | #1
On 8 December 2016 at 18:34, Yi-Hung Wei <yihung.wei@gmail.com> wrote:
> Test cases that use netcat will fail if netcat is not installed. This patch
> detects if netcat is present, and skips those test cases if netcat is not there.
>
> Singed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>

FYI, if you do "git commit -s [...]" then it will apply the signoff to
the commit message using your gitconfig user. Then you can "sign" off,
instead of "singing" off ;)

Thanks, applied to master.
diff mbox

Patch

diff --git a/tests/atlocal.in b/tests/atlocal.in
index f518cda..1353b46 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -124,6 +124,23 @@  else
     HAVE_PYFTPDLIB="no"
 fi
 
+# Look for a commnand in the system. If it is found, defines
+# HAVE_COMMAND="yes", otherwise HAVE_COMMAND="no".
+FindCommand()
+{
+    which $1 > /dev/null 2>&1
+    status=$?
+    var=HAVE_`echo "$1" | tr '[a-z]' '[A-Z]'`
+    if test "$status" = "0"; then
+        eval ${var}="yes"
+    else
+        eval ${var}="no"
+    fi
+}
+
+# Set HAVE_NC
+FindCommand nc
+
 # Determine correct netcat option to quit on stdin EOF
 if nc --version 2>&1 | grep -q nmap.org; then
     NC_EOF_OPT="--send-only"
diff --git a/tests/system-traffic.at b/tests/system-traffic.at
index 801dfe3..ffeca35 100644
--- a/tests/system-traffic.at
+++ b/tests/system-traffic.at
@@ -338,6 +338,7 @@  OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
 AT_SETUP([datapath - basic truncate action])
+AT_SKIP_IF([test $HAVE_NC = no])
 OVS_TRAFFIC_VSWITCHD_START()
 AT_CHECK([ovs-ofctl del-flows br0])
 
@@ -454,6 +455,7 @@  dnl   ns1: connect to br0, with IP:10.1.1.2
 dnl   br-underlay: with IP: 172.31.1.100
 dnl   ns0: connect to br-underlay, with IP: 10.1.1.1
 AT_SETUP([datapath - truncate and output to gre tunnel])
+AT_SKIP_IF([test $HAVE_NC = no])
 OVS_CHECK_GRE()
 OVS_TRAFFIC_VSWITCHD_START()
 
@@ -1479,6 +1481,7 @@  OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
 AT_SETUP([conntrack - ICMP related])
+AT_SKIP_IF([test $HAVE_NC = no])
 CHECK_CONNTRACK()
 OVS_TRAFFIC_VSWITCHD_START()
 
@@ -2408,6 +2411,7 @@  OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
 AT_SETUP([conntrack - ICMP related with NAT])
+AT_SKIP_IF([test $HAVE_NC = no])
 CHECK_CONNTRACK()
 CHECK_CONNTRACK_NAT()
 OVS_TRAFFIC_VSWITCHD_START()
@@ -2832,6 +2836,7 @@  AT_CLEANUP
 
 
 AT_SETUP([conntrack - DNAT load balancing with NC])
+AT_SKIP_IF([test $HAVE_NC = no])
 CHECK_CONNTRACK()
 CHECK_CONNTRACK_NAT()
 OVS_TRAFFIC_VSWITCHD_START()