Skip to content

Commit

Permalink
selftests: netfilter: reduce zone stress test running time
Browse files Browse the repository at this point in the history
This selftests needs almost 3 minutes to complete, reduce the
insertes zones to 1000.  Test now completes in about 20 seconds.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Florian Westphal authored and ummakynes committed Jan 26, 2022
1 parent 34243b9 commit c858620
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tools/testing/selftests/netfilter/nft_zones_many.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ns="ns-$sfx"
# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4

zones=20000
zones=2000
have_ct_tool=0
ret=0

Expand Down Expand Up @@ -75,18 +75,18 @@ EOF

while [ $i -lt $max_zones ]; do
local start=$(date +%s%3N)
i=$((i + 10000))
i=$((i + 1000))
j=$((j + 1))
# nft rule in output places each packet in a different zone.
dd if=/dev/zero of=/dev/stdout bs=8k count=10000 2>/dev/null | ip netns exec "$ns" socat STDIN UDP:127.0.0.1:12345,sourceport=12345
dd if=/dev/zero of=/dev/stdout bs=8k count=1000 2>/dev/null | ip netns exec "$ns" socat STDIN UDP:127.0.0.1:12345,sourceport=12345
if [ $? -ne 0 ] ;then
ret=1
break
fi

stop=$(date +%s%3N)
local duration=$((stop-start))
echo "PASS: added 10000 entries in $duration ms (now $i total, loop $j)"
echo "PASS: added 1000 entries in $duration ms (now $i total, loop $j)"
done

if [ $have_ct_tool -eq 1 ]; then
Expand Down Expand Up @@ -128,11 +128,11 @@ test_conntrack_tool() {
break
fi

if [ $((i%10000)) -eq 0 ];then
if [ $((i%1000)) -eq 0 ];then
stop=$(date +%s%3N)

local duration=$((stop-start))
echo "PASS: added 10000 entries in $duration ms (now $i total)"
echo "PASS: added 1000 entries in $duration ms (now $i total)"
start=$stop
fi
done
Expand Down

0 comments on commit c858620

Please sign in to comment.