|
|
3730f4 |
From 8537751e48dfacee11d48ad3f050bdacc930284c Mon Sep 17 00:00:00 2001
|
|
|
3730f4 |
From: Phil Sutter <psutter@redhat.com>
|
|
|
3730f4 |
Date: Fri, 17 Jan 2020 12:50:23 +0100
|
|
|
3730f4 |
Subject: [PATCH] tests: shell: Search diff tool once and for all
|
|
|
3730f4 |
|
|
|
3730f4 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1790793
|
|
|
3730f4 |
Upstream Status: nftables commit 68310ba0f9c20
|
|
|
3730f4 |
|
|
|
3730f4 |
commit 68310ba0f9c2066f7463d66a1a1938b66fb8a4c4
|
|
|
3730f4 |
Author: Phil Sutter <phil@nwl.cc>
|
|
|
3730f4 |
Date: Tue Jan 14 16:50:35 2020 +0100
|
|
|
3730f4 |
|
|
|
3730f4 |
tests: shell: Search diff tool once and for all
|
|
|
3730f4 |
|
|
|
3730f4 |
Instead of calling 'which diff' over and over again, just detect the
|
|
|
3730f4 |
tool's presence in run-tests.sh and pass $DIFF to each testcase just
|
|
|
3730f4 |
like with nft binary.
|
|
|
3730f4 |
|
|
|
3730f4 |
Fall back to using 'true' command to avoid the need for any conditional
|
|
|
3730f4 |
calling in test cases.
|
|
|
3730f4 |
|
|
|
3730f4 |
While being at it, unify potential diff calls so that a string
|
|
|
3730f4 |
comparison in shell happens irrespective of diff presence.
|
|
|
3730f4 |
|
|
|
3730f4 |
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
|
3730f4 |
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
3730f4 |
---
|
|
|
3730f4 |
tests/shell/run-tests.sh | 7 ++++++-
|
|
|
3730f4 |
tests/shell/testcases/flowtable/0010delete_handle_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/listing/0003table_0 | 6 ++----
|
|
|
3730f4 |
tests/shell/testcases/listing/0004table_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/listing/0005ruleset_ip_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/listing/0006ruleset_ip6_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/listing/0007ruleset_inet_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/listing/0008ruleset_arp_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/listing/0009ruleset_bridge_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/listing/0010sets_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/listing/0011sets_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/listing/0012sets_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/listing/0013objects_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/listing/0014objects_0 | 6 ++----
|
|
|
3730f4 |
tests/shell/testcases/listing/0015dynamic_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/listing/0017objects_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/listing/0018data_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/listing/0019set_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/listing/0020flowtable_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/maps/0003map_add_many_elements_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/maps/0004interval_map_create_once_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/maps/0008interval_map_delete_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/netns/0001nft-f_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/netns/0002loosecommands_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/netns/0003many_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/nft-f/0016redefines_1 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/optionals/delete_object_handles_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/optionals/update_object_handles_0 | 3 +--
|
|
|
3730f4 |
.../shell/testcases/rule_management/0001addinsertposition_0 | 12 ++++--------
|
|
|
3730f4 |
tests/shell/testcases/sets/0028delete_handle_0 | 3 +--
|
|
|
3730f4 |
tests/shell/testcases/sets/0036add_set_element_expiration_0 | 5 ++++-
|
|
|
3730f4 |
tests/shell/testcases/transactions/0003table_0 | 4 +---
|
|
|
3730f4 |
tests/shell/testcases/transactions/0040set_0 | 3 +--
|
|
|
3730f4 |
33 files changed, 46 insertions(+), 75 deletions(-)
|
|
|
3730f4 |
|
|
|
3730f4 |
diff --git a/tests/shell/run-tests.sh b/tests/shell/run-tests.sh
|
|
|
3730f4 |
index 632ccce..29a2c39 100755
|
|
|
3730f4 |
--- a/tests/shell/run-tests.sh
|
|
|
3730f4 |
+++ b/tests/shell/run-tests.sh
|
|
|
3730f4 |
@@ -43,6 +43,11 @@ if [ ! -x "$MODPROBE" ] ; then
|
|
|
3730f4 |
msg_error "no modprobe binary found"
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
|
|
|
3730f4 |
+DIFF="$(which diff)"
|
|
|
3730f4 |
+if [ ! -x "$DIFF" ] ; then
|
|
|
3730f4 |
+ DIFF=true
|
|
|
3730f4 |
+fi
|
|
|
3730f4 |
+
|
|
|
3730f4 |
if [ "$1" == "-v" ] ; then
|
|
|
3730f4 |
VERBOSE=y
|
|
|
3730f4 |
shift
|
|
|
3730f4 |
@@ -96,7 +101,7 @@ do
|
|
|
3730f4 |
kernel_cleanup
|
|
|
3730f4 |
|
|
|
3730f4 |
msg_info "[EXECUTING] $testfile"
|
|
|
3730f4 |
- test_output=$(NFT=$NFT ${testfile} 2>&1)
|
|
|
3730f4 |
+ test_output=$(NFT=$NFT DIFF=$DIFF ${testfile} 2>&1)
|
|
|
3730f4 |
rc_got=$?
|
|
|
3730f4 |
echo -en "\033[1A\033[K" # clean the [EXECUTING] foobar line
|
|
|
3730f4 |
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/flowtable/0010delete_handle_0 b/tests/shell/testcases/flowtable/0010delete_handle_0
|
|
|
3730f4 |
index 985d4a3..8dd8d9f 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/flowtable/0010delete_handle_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/flowtable/0010delete_handle_0
|
|
|
3730f4 |
@@ -16,7 +16,6 @@ EXPECTED="table inet t {
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list ruleset)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/listing/0003table_0 b/tests/shell/testcases/listing/0003table_0
|
|
|
3730f4 |
index 1b288e4..5060be0 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/listing/0003table_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/listing/0003table_0
|
|
|
3730f4 |
@@ -11,15 +11,13 @@ $NFT add table test
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list table test)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
|
|
|
3730f4 |
# also this way
|
|
|
3730f4 |
GET="$($NFT list table ip test)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/listing/0004table_0 b/tests/shell/testcases/listing/0004table_0
|
|
|
3730f4 |
index 2c7c995..1d69119 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/listing/0004table_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/listing/0004table_0
|
|
|
3730f4 |
@@ -12,8 +12,7 @@ $NFT add table test2
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list table test)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/listing/0005ruleset_ip_0 b/tests/shell/testcases/listing/0005ruleset_ip_0
|
|
|
3730f4 |
index c326680..39c0328 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/listing/0005ruleset_ip_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/listing/0005ruleset_ip_0
|
|
|
3730f4 |
@@ -15,7 +15,6 @@ $NFT add table bridge test
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list ruleset ip)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/listing/0006ruleset_ip6_0 b/tests/shell/testcases/listing/0006ruleset_ip6_0
|
|
|
3730f4 |
index 093d5a5..1b67f50 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/listing/0006ruleset_ip6_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/listing/0006ruleset_ip6_0
|
|
|
3730f4 |
@@ -15,7 +15,6 @@ $NFT add table bridge test
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list ruleset ip6)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/listing/0007ruleset_inet_0 b/tests/shell/testcases/listing/0007ruleset_inet_0
|
|
|
3730f4 |
index b24cc4c..257c7a9 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/listing/0007ruleset_inet_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/listing/0007ruleset_inet_0
|
|
|
3730f4 |
@@ -15,7 +15,6 @@ $NFT add table bridge test
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list ruleset inet)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/listing/0008ruleset_arp_0 b/tests/shell/testcases/listing/0008ruleset_arp_0
|
|
|
3730f4 |
index fff0fee..be42c47 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/listing/0008ruleset_arp_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/listing/0008ruleset_arp_0
|
|
|
3730f4 |
@@ -15,7 +15,6 @@ $NFT add table bridge test
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list ruleset arp)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/listing/0009ruleset_bridge_0 b/tests/shell/testcases/listing/0009ruleset_bridge_0
|
|
|
3730f4 |
index 247ed47..c6a99f5 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/listing/0009ruleset_bridge_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/listing/0009ruleset_bridge_0
|
|
|
3730f4 |
@@ -15,7 +15,6 @@ $NFT add table bridge test
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list ruleset bridge)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/listing/0010sets_0 b/tests/shell/testcases/listing/0010sets_0
|
|
|
3730f4 |
index 855cceb..0f5f2bd 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/listing/0010sets_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/listing/0010sets_0
|
|
|
3730f4 |
@@ -57,7 +57,6 @@ $NFT add set inet filter set2 { type icmpv6_type \; }
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list sets)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/listing/0011sets_0 b/tests/shell/testcases/listing/0011sets_0
|
|
|
3730f4 |
index aac9eac..b6f12b5 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/listing/0011sets_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/listing/0011sets_0
|
|
|
3730f4 |
@@ -38,7 +38,6 @@ $NFT add rule inet filter test tcp dport {80, 443}
|
|
|
3730f4 |
GET="$($NFT list sets)"
|
|
|
3730f4 |
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/listing/0012sets_0 b/tests/shell/testcases/listing/0012sets_0
|
|
|
3730f4 |
index da16d94..6e4c959 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/listing/0012sets_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/listing/0012sets_0
|
|
|
3730f4 |
@@ -33,7 +33,6 @@ $NFT add set inet filter set2 { type icmpv6_type \; }
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list sets inet)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/listing/0013objects_0 b/tests/shell/testcases/listing/0013objects_0
|
|
|
3730f4 |
index f691579..4d39143 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/listing/0013objects_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/listing/0013objects_0
|
|
|
3730f4 |
@@ -42,7 +42,6 @@ $NFT add table test-ip
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list table test)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/listing/0014objects_0 b/tests/shell/testcases/listing/0014objects_0
|
|
|
3730f4 |
index 20f6840..31d94f8 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/listing/0014objects_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/listing/0014objects_0
|
|
|
3730f4 |
@@ -17,15 +17,13 @@ $NFT add table test-ip
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list quotas)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list quota test https-quota)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/listing/0015dynamic_0 b/tests/shell/testcases/listing/0015dynamic_0
|
|
|
3730f4 |
index 4ff74e3..65fbe62 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/listing/0015dynamic_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/listing/0015dynamic_0
|
|
|
3730f4 |
@@ -16,8 +16,7 @@ $NFT -f - <<< "$EXPECTED"
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list set ip filter test_set)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/listing/0017objects_0 b/tests/shell/testcases/listing/0017objects_0
|
|
|
3730f4 |
index 8a586e8..c4e72db 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/listing/0017objects_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/listing/0017objects_0
|
|
|
3730f4 |
@@ -13,7 +13,6 @@ $NFT flush map inet filter countermap
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list map inet filter countermap)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/listing/0018data_0 b/tests/shell/testcases/listing/0018data_0
|
|
|
3730f4 |
index 544b6bf..4af253d 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/listing/0018data_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/listing/0018data_0
|
|
|
3730f4 |
@@ -13,7 +13,6 @@ $NFT flush map inet filter ipmap
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list map inet filter ipmap)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/listing/0019set_0 b/tests/shell/testcases/listing/0019set_0
|
|
|
3730f4 |
index 54a8a06..6e8cb4d 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/listing/0019set_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/listing/0019set_0
|
|
|
3730f4 |
@@ -13,7 +13,6 @@ $NFT flush set inet filter ipset
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list set inet filter ipset)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/listing/0020flowtable_0 b/tests/shell/testcases/listing/0020flowtable_0
|
|
|
3730f4 |
index 6f630f1..2f0a98d 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/listing/0020flowtable_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/listing/0020flowtable_0
|
|
|
3730f4 |
@@ -15,7 +15,6 @@ $NFT -f - <<< "$EXPECTED"
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list flowtable inet filter f)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/maps/0003map_add_many_elements_0 b/tests/shell/testcases/maps/0003map_add_many_elements_0
|
|
|
3730f4 |
index 047f949..2b254c5 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/maps/0003map_add_many_elements_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/maps/0003map_add_many_elements_0
|
|
|
3730f4 |
@@ -61,8 +61,7 @@ EXPECTED="table ip x {
|
|
|
3730f4 |
}"
|
|
|
3730f4 |
GET=$($NFT list ruleset)
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/maps/0004interval_map_create_once_0 b/tests/shell/testcases/maps/0004interval_map_create_once_0
|
|
|
3730f4 |
index 58b399c..3de0c9d 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/maps/0004interval_map_create_once_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/maps/0004interval_map_create_once_0
|
|
|
3730f4 |
@@ -60,8 +60,7 @@ EXPECTED="table ip x {
|
|
|
3730f4 |
}"
|
|
|
3730f4 |
GET=$($NFT list ruleset)
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/maps/0008interval_map_delete_0 b/tests/shell/testcases/maps/0008interval_map_delete_0
|
|
|
3730f4 |
index 7da6eb3..39ea312 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/maps/0008interval_map_delete_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/maps/0008interval_map_delete_0
|
|
|
3730f4 |
@@ -26,7 +26,6 @@ $NFT add element filter m { 127.0.0.2 : 0x2 }
|
|
|
3730f4 |
|
|
|
3730f4 |
GET=$($NFT -s list ruleset)
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/netns/0001nft-f_0 b/tests/shell/testcases/netns/0001nft-f_0
|
|
|
3730f4 |
index 8194226..a591f2c 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/netns/0001nft-f_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/netns/0001nft-f_0
|
|
|
3730f4 |
@@ -93,8 +93,7 @@ fi
|
|
|
3730f4 |
KERNEL_RULESET="$($IP netns exec $NETNS_NAME $NFT list ruleset)"
|
|
|
3730f4 |
$IP netns del $NETNS_NAME
|
|
|
3730f4 |
if [ "$RULESET" != "$KERNEL_RULESET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$RULESET") <(echo "$KERNEL_RULESET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$RULESET") <(echo "$KERNEL_RULESET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
exit 0
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/netns/0002loosecommands_0 b/tests/shell/testcases/netns/0002loosecommands_0
|
|
|
3730f4 |
index 465c2e8..231f1fb 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/netns/0002loosecommands_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/netns/0002loosecommands_0
|
|
|
3730f4 |
@@ -56,7 +56,6 @@ RULESET="table ip t {
|
|
|
3730f4 |
KERNEL_RULESET="$($IP netns exec $NETNS_NAME $NFT list ruleset)"
|
|
|
3730f4 |
$IP netns del $NETNS_NAME
|
|
|
3730f4 |
if [ "$RULESET" != "$KERNEL_RULESET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$RULESET") <(echo "$KERNEL_RULESET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$RULESET") <(echo "$KERNEL_RULESET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/netns/0003many_0 b/tests/shell/testcases/netns/0003many_0
|
|
|
3730f4 |
index a5fcb5d..afe9117 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/netns/0003many_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/netns/0003many_0
|
|
|
3730f4 |
@@ -97,8 +97,7 @@ function test_netns()
|
|
|
3730f4 |
KERNEL_RULESET="$($IP netns exec $NETNS_NAME $NFT list ruleset)"
|
|
|
3730f4 |
if [ "$RULESET" != "$KERNEL_RULESET" ] ; then
|
|
|
3730f4 |
echo "E: ruleset in netns $NETNS_NAME differs from the loaded" >&2
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$RULESET") <(echo "$KERNEL_RULESET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$RULESET") <(echo "$KERNEL_RULESET")
|
|
|
3730f4 |
$IP netns del $NETNS_NAME
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/nft-f/0016redefines_1 b/tests/shell/testcases/nft-f/0016redefines_1
|
|
|
3730f4 |
index 4c26b37..1f59f6b 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/nft-f/0016redefines_1
|
|
|
3730f4 |
+++ b/tests/shell/testcases/nft-f/0016redefines_1
|
|
|
3730f4 |
@@ -26,8 +26,7 @@ $NFT -f - <<< "$RULESET"
|
|
|
3730f4 |
GET="$($NFT list ruleset)"
|
|
|
3730f4 |
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/optionals/delete_object_handles_0 b/tests/shell/testcases/optionals/delete_object_handles_0
|
|
|
3730f4 |
index a2ae422..9b65e67 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/optionals/delete_object_handles_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/optionals/delete_object_handles_0
|
|
|
3730f4 |
@@ -37,7 +37,6 @@ table ip6 test-ip6 {
|
|
|
3730f4 |
GET="$($NFT list ruleset)"
|
|
|
3730f4 |
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/optionals/update_object_handles_0 b/tests/shell/testcases/optionals/update_object_handles_0
|
|
|
3730f4 |
index 17c0c86..8b12b8c 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/optionals/update_object_handles_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/optionals/update_object_handles_0
|
|
|
3730f4 |
@@ -19,7 +19,6 @@ EXPECTED="table ip test-ip {
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list ruleset)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/rule_management/0001addinsertposition_0 b/tests/shell/testcases/rule_management/0001addinsertposition_0
|
|
|
3730f4 |
index bb3fda5..237e9e3 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/rule_management/0001addinsertposition_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/rule_management/0001addinsertposition_0
|
|
|
3730f4 |
@@ -30,8 +30,7 @@ for arg in "position 2" "handle 2" "index 0"; do
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list ruleset)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
done
|
|
|
3730f4 |
@@ -42,8 +41,7 @@ for arg in "position 3" "handle 3" "index 1"; do
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list ruleset)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
done
|
|
|
3730f4 |
@@ -62,8 +60,7 @@ for arg in "position 3" "handle 3" "index 1"; do
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list ruleset)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
done
|
|
|
3730f4 |
@@ -82,8 +79,7 @@ for arg in "position 2" "handle 2" "index 0"; do
|
|
|
3730f4 |
|
|
|
3730f4 |
GET="$($NFT list ruleset)"
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
done
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/sets/0028delete_handle_0 b/tests/shell/testcases/sets/0028delete_handle_0
|
|
|
3730f4 |
index 5ad17c2..c6d1253 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/sets/0028delete_handle_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/sets/0028delete_handle_0
|
|
|
3730f4 |
@@ -29,7 +29,6 @@ EXPECTED="table ip test-ip {
|
|
|
3730f4 |
GET="$($NFT list ruleset)"
|
|
|
3730f4 |
|
|
|
3730f4 |
if [ "$EXPECTED" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/sets/0036add_set_element_expiration_0 b/tests/shell/testcases/sets/0036add_set_element_expiration_0
|
|
|
3730f4 |
index 8dfed6c..51ed0f2 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/sets/0036add_set_element_expiration_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/sets/0036add_set_element_expiration_0
|
|
|
3730f4 |
@@ -8,6 +8,9 @@ add element ip x y { 1.1.1.1 timeout 30s expires 15s }"
|
|
|
3730f4 |
|
|
|
3730f4 |
test_output=$($NFT -e -f - <<< "$RULESET" 2>&1)
|
|
|
3730f4 |
|
|
|
3730f4 |
-diff -u <(echo "$test_output") <(echo "$RULESET")
|
|
|
3730f4 |
+if [ "$test_output" != "$RULESET" ] ; then
|
|
|
3730f4 |
+ $DIFF -u <(echo "$test_output") <(echo "$RULESET")
|
|
|
3730f4 |
+ exit 1
|
|
|
3730f4 |
+fi
|
|
|
3730f4 |
|
|
|
3730f4 |
$NFT "add chain ip x c; add rule ip x c ip saddr @y"
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/transactions/0003table_0 b/tests/shell/testcases/transactions/0003table_0
|
|
|
3730f4 |
index 6861eab..91186de 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/transactions/0003table_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/transactions/0003table_0
|
|
|
3730f4 |
@@ -14,7 +14,6 @@ fi
|
|
|
3730f4 |
|
|
|
3730f4 |
KERNEL_RULESET="$($NFT list ruleset)"
|
|
|
3730f4 |
if [ "" != "$KERNEL_RULESET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
echo "Got a ruleset, but expected empty: "
|
|
|
3730f4 |
echo "$KERNEL_RULESET"
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
@@ -42,7 +41,6 @@ $NFT -f - <<< "$RULESETFAIL" && exit 2
|
|
|
3730f4 |
|
|
|
3730f4 |
KERNEL_RULESET="$($NFT list ruleset)"
|
|
|
3730f4 |
if [ "$RULESET" != "$KERNEL_RULESET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$RULESET") <(echo "$KERNEL_RULESET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$RULESET") <(echo "$KERNEL_RULESET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
diff --git a/tests/shell/testcases/transactions/0040set_0 b/tests/shell/testcases/transactions/0040set_0
|
|
|
3730f4 |
index a404abc..468816b 100755
|
|
|
3730f4 |
--- a/tests/shell/testcases/transactions/0040set_0
|
|
|
3730f4 |
+++ b/tests/shell/testcases/transactions/0040set_0
|
|
|
3730f4 |
@@ -29,8 +29,7 @@ fi
|
|
|
3730f4 |
GET="$($NFT list ruleset)"
|
|
|
3730f4 |
|
|
|
3730f4 |
if [ "$RULESET" != "$GET" ] ; then
|
|
|
3730f4 |
- DIFF="$(which diff)"
|
|
|
3730f4 |
- [ -x $DIFF ] && $DIFF -u <(echo "$RULESET") <(echo "$GET")
|
|
|
3730f4 |
+ $DIFF -u <(echo "$RULESET") <(echo "$GET")
|
|
|
3730f4 |
exit 1
|
|
|
3730f4 |
fi
|
|
|
3730f4 |
|
|
|
3730f4 |
--
|
|
|
3730f4 |
1.8.3.1
|
|
|
3730f4 |
|