提交 c273289f 编写于 作者: F Florian Westphal 提交者: Pablo Neira Ayuso

selftests: netfilter: fix transaction test script timeout handling

The kselftest framework uses a default timeout of 45 seconds for
all test scripts.

Increase the timeout to two minutes for the netfilter tests, this
should hopefully be enough,

Make sure that, should the script be canceled, the net namespace and
the spawned ping instances are removed.

Fixes: 25d8bced ("selftests: add script to stress-test nft packet path vs. control plane")
Reported-by: NMirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
Signed-off-by: NFlorian Westphal <fw@strlen.de>
Tested-by: NMirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
上级 8fed7565
...@@ -10,12 +10,20 @@ ...@@ -10,12 +10,20 @@
ksft_skip=4 ksft_skip=4
testns=testns-$(mktemp -u "XXXXXXXX") testns=testns-$(mktemp -u "XXXXXXXX")
tmp=""
tables="foo bar baz quux" tables="foo bar baz quux"
global_ret=0 global_ret=0
eret=0 eret=0
lret=0 lret=0
cleanup() {
ip netns pids "$testns" | xargs kill 2>/dev/null
ip netns del "$testns"
rm -f "$tmp"
}
check_result() check_result()
{ {
local r=$1 local r=$1
...@@ -43,6 +51,7 @@ if [ $? -ne 0 ];then ...@@ -43,6 +51,7 @@ if [ $? -ne 0 ];then
exit $ksft_skip exit $ksft_skip
fi fi
trap cleanup EXIT
tmp=$(mktemp) tmp=$(mktemp)
for table in $tables; do for table in $tables; do
...@@ -139,11 +148,4 @@ done ...@@ -139,11 +148,4 @@ done
check_result $lret "add/delete with nftrace enabled" check_result $lret "add/delete with nftrace enabled"
pkill -9 ping
wait
rm -f "$tmp"
ip netns del "$testns"
exit $global_ret exit $global_ret
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册