diff options
author | Fabian Frederick <fabf@skynet.be> | 2020-09-09 20:26:24 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2020-09-22 01:55:11 +0200 |
commit | d30a7d54e8481acbb5cc42016c817e598c3d697b (patch) | |
tree | 673e6a570cf712969c30da71161ccc484feb3e27 /tools | |
parent | 5b1a995bfa93667762badbe1d8f0f7ad680bdf29 (diff) | |
download | linux-stable-d30a7d54e8481acbb5cc42016c817e598c3d697b.tar.gz linux-stable-d30a7d54e8481acbb5cc42016c817e598c3d697b.tar.bz2 linux-stable-d30a7d54e8481acbb5cc42016c817e598c3d697b.zip |
selftests: netfilter: remove unused cnt and simplify command testing
cnt was not used in nft_meta.sh
This patch also fixes 2 shellcheck SC2181 warnings:
"check exit code directly with e.g. 'if mycmd;', not indirectly with
$?."
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/testing/selftests/netfilter/nft_meta.sh | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/tools/testing/selftests/netfilter/nft_meta.sh b/tools/testing/selftests/netfilter/nft_meta.sh index 1f5b46542c14..18a1abca3262 100755 --- a/tools/testing/selftests/netfilter/nft_meta.sh +++ b/tools/testing/selftests/netfilter/nft_meta.sh @@ -7,8 +7,7 @@ ksft_skip=4 sfx=$(mktemp -u "XXXXXXXX") ns0="ns0-$sfx" -nft --version > /dev/null 2>&1 -if [ $? -ne 0 ];then +if ! nft --version > /dev/null 2>&1; then echo "SKIP: Could not run test without nft tool" exit $ksft_skip fi @@ -86,8 +85,7 @@ check_one_counter() local want="packets $2" local verbose="$3" - cnt=$(ip netns exec "$ns0" nft list counter inet filter $cname | grep -q "$want") - if [ $? -ne 0 ];then + if ! ip netns exec "$ns0" nft list counter inet filter $cname | grep -q "$want"; then echo "FAIL: $cname, want \"$want\", got" ret=1 ip netns exec "$ns0" nft list counter inet filter $cname |