Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests: netfilter: nft_concat_range.sh: reduce debug kernel run time

Even a 1h timeout isn't enough for nft_concat_range.sh to complete on
debug kernels.

Reduce test complexity and only match on single entry if
KSFT_MACHINE_SLOW is set.

To spot 'slow' tests, print the subtest duration (in seconds) in
addition to the status.

Add new nft_concat_range_perf.sh script, not executed via kselftest,
to run the performance (pps match rate) tests.

Those need about 25m to complete which seems too much to run this
via 'make run_tests'.

Signed-off-by: Florian Westphal <fw@strlen.de>
Link: https://lore.kernel.org/r/20240430145810.23447-1-fw@strlen.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Florian Westphal and committed by
Jakub Kicinski
496bc586 fff6e6ac

+34 -6
+2
tools/testing/selftests/net/netfilter/Makefile
··· 28 28 TEST_PROGS += rpath.sh 29 29 TEST_PROGS += xt_string.sh 30 30 31 + TEST_PROGS_EXTENDED = nft_concat_range_perf.sh 32 + 31 33 TEST_GEN_PROGS = conntrack_dump_flush 32 34 33 35 TEST_GEN_FILES = audit_logread
+1
tools/testing/selftests/net/netfilter/config
··· 85 85 CONFIG_VLAN_8021Q=m 86 86 CONFIG_XFRM_USER=m 87 87 CONFIG_XFRM_STATISTICS=y 88 + CONFIG_NET_PKTGEN=m
+22 -6
tools/testing/selftests/net/netfilter/nft_concat_range.sh
··· 19 19 # - timeout: check that packets match entries until they expire 20 20 # - performance: estimate matching rate, compare with rbtree and hash baselines 21 21 TESTS="reported_issues correctness concurrency timeout" 22 - [ "${quicktest}" != "1" ] && TESTS="${TESTS} performance" 22 + [ -n "$NFT_CONCAT_RANGE_TESTS" ] && TESTS="${NFT_CONCAT_RANGE_TESTS}" 23 23 24 24 # Set types, defined by TYPE_ variables below 25 25 TYPES="net_port port_net net6_port port_proto net6_port_mac net6_port_mac_proto ··· 31 31 32 32 # List of possible paths to pktgen script from kernel tree for performance tests 33 33 PKTGEN_SCRIPT_PATHS=" 34 - ../../../../samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh 34 + ../../../../../samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh 35 35 pktgen/pktgen_bench_xmit_mode_netif_receive.sh" 36 36 37 37 # Definition of set types: ··· 951 951 killall iperf 2>/dev/null 952 952 killall netperf 2>/dev/null 953 953 killall netserver 2>/dev/null 954 + } 955 + 956 + cleanup_exit() { 957 + cleanup 954 958 rm -f "$tmp" 955 959 } 956 960 ··· 1375 1371 setup veth send_"${proto}" set || return ${ksft_skip} 1376 1372 1377 1373 timeout=3 1374 + 1375 + [ "$KSFT_MACHINE_SLOW" = "yes" ] && timeout=8 1376 + 1378 1377 range_size=1 1379 1378 for i in $(seq "$start" $((start + count))); do 1380 1379 end=$((start + range_size)) ··· 1393 1386 range_size=$((range_size + 1)) 1394 1387 start=$((end + range_size)) 1395 1388 done 1396 - sleep 3 1389 + sleep $timeout 1397 1390 for i in $(seq "$start" $((start + count))); do 1398 1391 end=$((start + range_size)) 1399 1392 srcstart=$((start + src_delta)) ··· 1487 1480 } 1488 1481 1489 1482 test_bug_flush_remove_add() { 1483 + rounds=100 1484 + [ "$KSFT_MACHINE_SLOW" = "yes" ] && rounds=10 1485 + 1490 1486 set_cmd='{ set s { type ipv4_addr . inet_service; flags interval; }; }' 1491 1487 elem1='{ 10.0.0.1 . 22-25, 10.0.0.1 . 10-20 }' 1492 1488 elem2='{ 10.0.0.1 . 10-20, 10.0.0.1 . 22-25 }' 1493 - for i in $(seq 1 100); do 1489 + for i in $(seq 1 $rounds); do 1494 1490 nft add table t "$set_cmd" || return ${ksft_skip} 1495 1491 nft add element t s "$elem1" 2>/dev/null || return 1 1496 1492 nft flush set t s 2>/dev/null || return 1 ··· 1562 1552 # Run everything in a separate network namespace 1563 1553 [ "${1}" != "run" ] && { unshare -n "${0}" run; exit $?; } 1564 1554 tmp="$(mktemp)" 1565 - trap cleanup EXIT 1555 + trap cleanup_exit EXIT 1566 1556 1567 1557 # Entry point for test runs 1568 1558 passed=0 ··· 1594 1584 continue 1595 1585 fi 1596 1586 1597 - printf " %-60s " "${display}" 1587 + [ "$KSFT_MACHINE_SLOW" = "yes" ] && count=1 1588 + 1589 + printf " %-32s " "${display}" 1590 + tthen=$(date +%s) 1598 1591 eval test_"${name}" 1599 1592 ret=$? 1593 + 1594 + tnow=$(date +%s) 1595 + printf "%5ds%-30s" $((tnow-tthen)) 1600 1596 1601 1597 if [ $ret -eq 0 ]; then 1602 1598 printf "[ OK ]\n"
+9
tools/testing/selftests/net/netfilter/nft_concat_range_perf.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + # 4 + 5 + source lib.sh 6 + 7 + [ "$KSFT_MACHINE_SLOW" = yes ] && exit ${ksft_skip} 8 + 9 + NFT_CONCAT_RANGE_TESTS="performance" exec ./nft_concat_range.sh