Skip to content

Commit d30a7d5

Browse files
Fabian Frederickummakynes
authored andcommitted
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>
1 parent 5b1a995 commit d30a7d5

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

‎tools/testing/selftests/netfilter/nft_meta.sh‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ ksft_skip=4
77
sfx=$(mktemp -u "XXXXXXXX")
88
ns0="ns0-$sfx"
99

10-
nft --version > /dev/null 2>&1
11-
if [ $? -ne 0 ];then
10+
if ! nft --version > /dev/null 2>&1; then
1211
echo "SKIP: Could not run test without nft tool"
1312
exit $ksft_skip
1413
fi
@@ -86,8 +85,7 @@ check_one_counter()
8685
local want="packets $2"
8786
local verbose="$3"
8887

89-
cnt=$(ip netns exec "$ns0" nft list counter inet filter $cname | grep -q "$want")
90-
if [ $? -ne 0 ];then
88+
if ! ip netns exec "$ns0" nft list counter inet filter $cname | grep -q "$want"; then
9189
echo "FAIL: $cname, want \"$want\", got"
9290
ret=1
9391
ip netns exec "$ns0" nft list counter inet filter $cname

0 commit comments

Comments
 (0)