[ovs-dev] [PATCH] tests: Skip tests that need "normal" diff if not available.
Ben Pfaff
blp at ovn.org
Mon Apr 2 17:14:49 UTC 2018
busybox diff does not support "normal" diff format, only the unified
format. A few OVS tests rely on "normal" format, so those would fail.
This commit avoids the problem by skipping tests that require "normal"
format if it is not available.
Reported-by: Stuart Cardall <developer at it-offshore.co.uk>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2018-March/046460.html
Signed-off-by: Ben Pfaff <blp at ovn.org>
---
tests/atlocal.in | 10 ++++++++++
tests/ovsdb-server.at | 5 +++++
2 files changed, 15 insertions(+)
diff --git a/tests/atlocal.in b/tests/atlocal.in
index 55f9333eee08..2721a588cb90 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -170,6 +170,16 @@ find_command tcpdump
CURL_OPT="-g -v --max-time 1 --retry 2 --retry-delay 1 --connect-timeout 1"
+# Determine whether "diff" supports "normal" diffs. (busybox diff does not.)
+diff () {
+ busybox diff "$@"
+}
+if echo xyzzy | diff /dev/null - | grep '^>' >/dev/null; then
+ DIFF_SUPPORTS_NORMAL_FORMAT=yes
+else
+ DIFF_SUPPORTS_NORMAL_FORMAT=no
+fi
+
# Turn off proxies.
unset http_proxy
unset https_proxy
diff --git a/tests/ovsdb-server.at b/tests/ovsdb-server.at
index 2781a14004eb..cbbccab5e5db 100644
--- a/tests/ovsdb-server.at
+++ b/tests/ovsdb-server.at
@@ -1455,6 +1455,7 @@ AT_BANNER([OVSDB -- ovsdb-server replication table-exclusion])
m4_define([OVSDB_CHECK_REPLICATION],
[AT_SETUP([$1])
AT_KEYWORDS([ovsdb server tcp replication table-exclusion])
+ AT_SKIP_IF([test $DIFF_SUPPORTS_NORMAL_FORMAT = no])
$2 > schema
AT_CHECK([ovsdb-tool create db1 schema], [0], [stdout], [ignore])
AT_CHECK([ovsdb-tool create db2 schema], [0], [stdout], [ignore])
@@ -1532,6 +1533,8 @@ AT_CLEANUP
#ovsdb-server/set-sync-exclude-tables command
AT_SETUP([ovsdb-server/set-sync-exclude-tables])
AT_KEYWORDS([ovsdb server replication set-exclude-tables])
+AT_SKIP_IF([test $DIFF_SUPPORTS_NORMAL_FORMAT = no])
+
replication_schema > schema
AT_CHECK([ovsdb-tool create db1 schema], [0], [stdout], [ignore])
AT_CHECK([ovsdb-tool create db2 schema], [0], [stdout], [ignore])
@@ -1619,6 +1622,8 @@ AT_CLEANUP
#ovsdb-server/disconnect-active-server command
AT_SETUP([ovsdb-server/disconnect-active-server])
AT_KEYWORDS([ovsdb server replication disconnect-active-server])
+AT_SKIP_IF([test $DIFF_SUPPORTS_NORMAL_FORMAT = no])
+
replication_schema > schema
AT_CHECK([ovsdb-tool create db1 schema], [0], [stdout], [ignore])
AT_CHECK([ovsdb-tool create db2 schema], [0], [stdout], [ignore])
--
2.16.1
More information about the dev
mailing list