Skip to content

Commit c273289

Browse files
Florian Westphalummakynes
authored andcommitted
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: 25d8bce ("selftests: add script to stress-test nft packet path vs. control plane") Reported-by: Mirsad Goran Todorovac <[email protected]> Signed-off-by: Florian Westphal <[email protected]> Tested-by: Mirsad Goran Todorovac <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 8fed756 commit c273289

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

tools/testing/selftests/netfilter/nft_trans_stress.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,20 @@
1010
ksft_skip=4
1111

1212
testns=testns-$(mktemp -u "XXXXXXXX")
13+
tmp=""
1314

1415
tables="foo bar baz quux"
1516
global_ret=0
1617
eret=0
1718
lret=0
1819

20+
cleanup() {
21+
ip netns pids "$testns" | xargs kill 2>/dev/null
22+
ip netns del "$testns"
23+
24+
rm -f "$tmp"
25+
}
26+
1927
check_result()
2028
{
2129
local r=$1
@@ -43,6 +51,7 @@ if [ $? -ne 0 ];then
4351
exit $ksft_skip
4452
fi
4553

54+
trap cleanup EXIT
4655
tmp=$(mktemp)
4756

4857
for table in $tables; do
@@ -139,11 +148,4 @@ done
139148

140149
check_result $lret "add/delete with nftrace enabled"
141150

142-
pkill -9 ping
143-
144-
wait
145-
146-
rm -f "$tmp"
147-
ip netns del "$testns"
148-
149151
exit $global_ret
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
timeout=120

0 commit comments

Comments
 (0)