tests: shell: Fix skip checks with --host mode
Phil Sutter
reviewerPATCH 1/1 tests: shell: Fix skip checks with --host mode
When testing host binaries, XT_MULTI variable contains just the program name without path component which most skip checks didn't expect. Fix them, and while being at it also reduce indenting level in two scripts by moving the skip check up front with an early exit call.
Fixes 416898e335322 ("tests/shell: Support testing host binaries")
Signed-off-by Phil Sutter <[email protected]>
--- .../arptables/0001-arptables-save-restore_0 | 2 +- .../0002-arptables-restore-defaults_0 | 2 +- .../arptables/0003-arptables-verbose-output_0 | 2 +- .../testcases/ebtables/0001-ebtables-basic_0 | 135 +++++++++--------- .../ebtables/0002-ebtables-save-restore_0 | 2 +- .../ebtables/0003-ebtables-restore-defaults_0 | 2 +- .../testcases/ebtables/0004-save-counters_0 | 2 +- .../testcases/ebtables/0005-ifnamechecks_0 | 2 +- .../firewalld-restore/0001-firewalld_0 | 2 +- .../testcases/ipt-restore/0004-restore-race_0 | 2 +- .../shell/testcases/nft-only/0001compat_0 | 15 +- .../shell/testcases/nft-only/0002invflags_0 | 2 +- .../nft-only/0003delete-with-comment_0 | 2 +- 13 files changed, 88 insertions(+), 84 deletions(-)
iptables/tests/shell/testcases/arptables/0001-arptables-save-restore_0 +1 -1
@@ -4,7 +4,7 @@ set -e #set -x # there is no legacy backend to test -[[ $XT_MULTI == */xtables-nft-multi ]] || { echo "skip $XT_MULTI"; exit 0; } +[[ $XT_MULTI == *xtables-nft-multi ]] || { echo "skip $XT_MULTI"; exit 0; } # fill arptables manually
iptables/tests/shell/testcases/arptables/0002-arptables-restore-defaults_0 +1 -1
@@ -3,7 +3,7 @@ set -e # there is no legacy backend to test -[[ $XT_MULTI == */xtables-nft-multi ]] || { echo "skip $XT_MULTI"; exit 0; } +[[ $XT_MULTI == *xtables-nft-multi ]] || { echo "skip $XT_MULTI"; exit 0; } # arptables-restore reuses preloaded targets and matches, make sure defaults # apply to consecutive rules using the same target/match as a previous one
iptables/tests/shell/testcases/arptables/0003-arptables-verbose-output_0 +1 -1
@@ -4,7 +4,7 @@ set -e set -x # there is no legacy backend to test -[[ $XT_MULTI == */xtables-nft-multi ]] || { echo "skip $XT_MULTI"; exit 0; } +[[ $XT_MULTI == *xtables-nft-multi ]] || { echo "skip $XT_MULTI"; exit 0; } $XT_MULTI arptables -N foo
iptables/tests/shell/testcases/ebtables/0001-ebtables-basic_0 +69 -66
155 lines not on this page · raw message
iptables/tests/shell/testcases/ebtables/0002-ebtables-save-restore_0 +1 -1
@@ -4,7 +4,7 @@ set -e #set -x # there is no legacy backend to test -[[ $XT_MULTI == */xtables-nft-multi ]] || { echo "skip $XT_MULTI"; exit 0; } +[[ $XT_MULTI == *xtables-nft-multi ]] || { echo "skip $XT_MULTI"; exit 0; } # fill ebtables manually
iptables/tests/shell/testcases/ebtables/0003-ebtables-restore-defaults_0 +1 -1
@@ -3,7 +3,7 @@ set -e # there is no legacy backend to test -[[ $XT_MULTI == */xtables-nft-multi ]] || { echo "skip $XT_MULTI"; exit 0; } +[[ $XT_MULTI == *xtables-nft-multi ]] || { echo "skip $XT_MULTI"; exit 0; } # ebtables-restore reuses preloaded targets and matches, make sure defaults # apply to consecutive rules using the same target/match as a previous one
iptables/tests/shell/testcases/ebtables/0004-save-counters_0 +1 -1
@@ -3,7 +3,7 @@ set -e # there is no legacy backend to test -[[ $XT_MULTI == */xtables-nft-multi ]] || { echo "skip $XT_MULTI"; exit 0; } +[[ $XT_MULTI == *xtables-nft-multi ]] || { echo "skip $XT_MULTI"; exit 0; } $XT_MULTI ebtables --init-table $XT_MULTI ebtables -A FORWARD -i nodev123 -o nodev432 -j ACCEPT
iptables/tests/shell/testcases/ebtables/0005-ifnamechecks_0 +1 -1
@@ -3,7 +3,7 @@ set -e # there is no legacy backend to test -[[ $XT_MULTI == */xtables-nft-multi ]] || { echo "skip $XT_MULTI"; exit 0; } +[[ $XT_MULTI == *xtables-nft-multi ]] || { echo "skip $XT_MULTI"; exit 0; } EXPECT='*filter :INPUT ACCEPT
iptables/tests/shell/testcases/firewalld-restore/0001-firewalld_0 +1 -1
@@ -231,7 +231,7 @@ for table in nat mangle raw filter;do done case "$XT_MULTI" in -*/xtables-nft-multi) +*xtables-nft-multi) # nft-multi displays chain names in different order, work around this for now tmpfile2=$(mktemp) sort "$tmpfile" > "$tmpfile2"
iptables/tests/shell/testcases/ipt-restore/0004-restore-race_0 +1 -1
@@ -86,7 +86,7 @@ if [ $LINES1 -ne $LINES2 ]; then fi case "$XT_MULTI" in -*/xtables-nft-multi) +*xtables-nft-multi) attempts=$((RANDOM%10)) attempts=$((attempts+1)) ;;
iptables/tests/shell/testcases/nft-only/0001compat_0 +8 -7
@@ -5,17 +5,18 @@ # xtables: avoid bogus 'is incompatible' warning case "$XT_MULTI" in -*/xtables-nft-multi) - nft -v >/dev/null || exit 0 - nft 'add table ip nft-test; add chain ip nft-test foobar { type filter hook forward priority 42; }' || exit 1 - nft 'add table ip6 nft-test; add chain ip6 nft-test foobar { type filter hook forward priority 42; }' || exit 1 - - $XT_MULTI iptables -L -t filter || exit 1 - $XT_MULTI ip6tables -L -t filter || exit 1 +*xtables-nft-multi) ;; *) echo skip $XT_MULTI + exit 0 ;; esac +nft -v >/dev/null || exit 0 +nft 'add table ip nft-test; add chain ip nft-test foobar { type filter hook forward priority 42; }' || exit 1 +nft 'add table ip6 nft-test; add chain ip6 nft-test foobar { type filter hook forward priority 42; }' || exit 1 + +$XT_MULTI iptables -L -t filter || exit 1 +$XT_MULTI ip6tables -L -t filter || exit 1 exit 0
iptables/tests/shell/testcases/nft-only/0002invflags_0 +1 -1
@@ -2,7 +2,7 @@ set -e -[[ $XT_MULTI == */xtables-nft-multi ]] || { echo "skip $XT_MULTI"; exit 0; } +[[ $XT_MULTI == *xtables-nft-multi ]] || { echo "skip $XT_MULTI"; exit 0; } $XT_MULTI iptables -A INPUT -p tcp --dport 53 ! -s 192.168.0.1 -j ACCEPT $XT_MULTI ip6tables -A INPUT -p tcp --dport 53 ! -s feed:babe::1 -j ACCEPT
iptables/tests/shell/testcases/nft-only/0003delete-with-comment_0 +1 -1
@@ -2,7 +2,7 @@ set -e -[[ $XT_MULTI == */xtables-nft-multi ]] || { echo "skip $XT_MULTI"; exit 0; } +[[ $XT_MULTI == *xtables-nft-multi ]] || { echo "skip $XT_MULTI"; exit 0; } comment1="foo bar" comment2="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Signature · 1 line
2.24.1