Skip to content

Commit

Permalink
selftests: netfilter: fix transaction test script timeout handling
Browse files Browse the repository at this point in the history
commit c273289 upstream.

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 <mirsad.todorovac@alu.unizg.hr>
Signed-off-by: Florian Westphal <fw@strlen.de>
Tested-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Florian Westphal authored and gregkh committed Jan 18, 2023
1 parent e888658 commit 213b22a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
16 changes: 9 additions & 7 deletions tools/testing/selftests/netfilter/nft_trans_stress.sh
Expand Up @@ -10,12 +10,20 @@
ksft_skip=4

testns=testns-$(mktemp -u "XXXXXXXX")
tmp=""

tables="foo bar baz quux"
global_ret=0
eret=0
lret=0

cleanup() {
ip netns pids "$testns" | xargs kill 2>/dev/null
ip netns del "$testns"

rm -f "$tmp"
}

check_result()
{
local r=$1
Expand Down Expand Up @@ -43,6 +51,7 @@ if [ $? -ne 0 ];then
exit $ksft_skip
fi

trap cleanup EXIT
tmp=$(mktemp)

for table in $tables; do
Expand Down Expand Up @@ -139,11 +148,4 @@ done

check_result $lret "add/delete with nftrace enabled"

pkill -9 ping

wait

rm -f "$tmp"
ip netns del "$testns"

exit $global_ret
1 change: 1 addition & 0 deletions tools/testing/selftests/netfilter/settings
@@ -0,0 +1 @@
timeout=120

0 comments on commit 213b22a

Please sign in to comment.