提交 d30a7d54 编写于 作者: F Fabian Frederick 提交者: Pablo Neira Ayuso

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: NFabian Frederick <fabf@skynet.be>
Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
上级 5b1a995b
...@@ -7,8 +7,7 @@ ksft_skip=4 ...@@ -7,8 +7,7 @@ ksft_skip=4
sfx=$(mktemp -u "XXXXXXXX") sfx=$(mktemp -u "XXXXXXXX")
ns0="ns0-$sfx" ns0="ns0-$sfx"
nft --version > /dev/null 2>&1 if ! nft --version > /dev/null 2>&1; then
if [ $? -ne 0 ];then
echo "SKIP: Could not run test without nft tool" echo "SKIP: Could not run test without nft tool"
exit $ksft_skip exit $ksft_skip
fi fi
...@@ -86,8 +85,7 @@ check_one_counter() ...@@ -86,8 +85,7 @@ check_one_counter()
local want="packets $2" local want="packets $2"
local verbose="$3" local verbose="$3"
cnt=$(ip netns exec "$ns0" nft list counter inet filter $cname | grep -q "$want") if ! ip netns exec "$ns0" nft list counter inet filter $cname | grep -q "$want"; then
if [ $? -ne 0 ];then
echo "FAIL: $cname, want \"$want\", got" echo "FAIL: $cname, want \"$want\", got"
ret=1 ret=1
ip netns exec "$ns0" nft list counter inet filter $cname ip netns exec "$ns0" nft list counter inet filter $cname
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册