Date: Fri, 26 Jun 2026 15:18:34 +0000 From: Siva Mahadevan <siva@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: a13936fcdc8d - stable/15 - tests/pf/route_to: check_random: rely on test timeout to fail Message-ID: <6a3e984a.230a8.237ed139@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by siva: URL: https://cgit.FreeBSD.org/src/commit/?id=a13936fcdc8dc3f37125614daa424a9cf1ae380d commit a13936fcdc8dc3f37125614daa424a9cf1ae380d Author: Siva Mahadevan <siva@FreeBSD.org> AuthorDate: 2026-06-17 16:52:00 +0000 Commit: Siva Mahadevan <siva@FreeBSD.org> CommitDate: 2026-06-26 15:16:43 +0000 tests/pf/route_to: check_random: rely on test timeout to fail This test is known to be flaky if 10 attempts happens to be not enough for the test to pass. Usually, this test passes in ~4-6 attempts. See https://ci.freebsd.org/job/FreeBSD-main-amd64-test/28664/testReport/junit/sys.netpfil.pf/route_to/random_table/ Rely on the timeout (default 5 mins) to catch a failure here, rather than just 10 attempts. It's very unlikely that 5 mins worth of attempts still isn't enough. For a history of flakiness, see https://ci.freebsd.org/job/FreeBSD-main-amd64-test/lastSuccessfulBuild/testReport/junit/sys.netpfil.pf/route_to/random_table/history/ PR: 289477 Reviewed by: kp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D57408 (cherry picked from commit 1294f332aec02e111b47d69e0d91e32dc2624001) --- tests/sys/netpfil/pf/route_to.sh | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/sys/netpfil/pf/route_to.sh b/tests/sys/netpfil/pf/route_to.sh index 13b60c8f80bc..99387aa3802d 100644 --- a/tests/sys/netpfil/pf/route_to.sh +++ b/tests/sys/netpfil/pf/route_to.sh @@ -29,10 +29,10 @@ common_dir=$(atf_get_srcdir)/../common # We need to somehow test if the random algorithm of pf_map_addr() is working. -# The table or prefix contains multiple IP next-hop addresses, for each one try -# to establish up to 10 connections. Fail the test if with this many attempts -# the "good" target has not been chosen. However this choice is random, -# the check might still ocasionally fail. +# The table or prefix contains multiple IP next-hop addresses. For each one, +# repeatedly try to establish connections until the "good" target has been chosen. +# However, since this choice is random, the test might still ocasionally fail +# due to timeout. check_random() { if [ "$1" = "IPv4" ]; then ping_from="${net_clients_4}.1" @@ -47,8 +47,9 @@ check_random() { port=42000 states=$(mktemp) || exit 1 for good_target in $good_targets; do - found="no" - for attempt in $(seq 1 10); do + # Loop until either the "good" target has been chosen + # or the test times out. + while :; do port=$(( port + 1 )) jexec router pfctl -Fs atf_check -s exit:0 ${common_dir}/pft_ping.py \ @@ -65,13 +66,9 @@ check_random() { done fi; if grep -qE "route-to: ${good_target}@" $states; then - found=yes break fi done - if [ "${found}" = "no" ]; then - atf_fail "Target ${good_target} not selected after ${attempt} attempts!" - fi done } @@ -1354,8 +1351,7 @@ prefer_ipv6_nexthop_mixed_af_roundrobin_ipv6_body() # The "random" flag will pick random hosts from the table but will # not dive into prefixes, always choosing the 0th address. # Proper address family will be choosen. The choice being random makes - # testing it non-trivial. We do 10 attempts to have each target chosen. - # Hopefully this is enough to have this test pass often enough. + # testing it non-trivial. # pf_map_addr() starts iterating over hosts of the pool from the 2nd # host. This behaviour was here before adding prefer-ipv6-nexthophome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a3e984a.230a8.237ed139>
