git: a8c74d6c64df - main - tests/ndp: fix ndp_routeinfo_option testcase flakiness

From: Siva Mahadevan <siva_at_FreeBSD.org>
Date: Thu, 21 May 2026 14:22:58 UTC
The branch main has been updated by siva:

URL: https://cgit.FreeBSD.org/src/commit/?id=a8c74d6c64dfddae95b9c6d48a8ea82b7c4d7b25

commit a8c74d6c64dfddae95b9c6d48a8ea82b7c4d7b25
Author:     Siva Mahadevan <siva@FreeBSD.org>
AuthorDate: 2026-05-21 14:22:22 +0000
Commit:     Siva Mahadevan <siva@FreeBSD.org>
CommitDate: 2026-05-21 14:22:22 +0000

    tests/ndp: fix ndp_routeinfo_option testcase flakiness
    
    Since we are sleeping for an indefinite period of time waiting
    for the default route to appear, the expire times may be gone
    past 1+ seconds, causing the Expire column to show <1800 or <600.
    
    Fixes:  f6bcc0925f0ea838da5183dc503f847e56d15cc8
    
    Reviewed by:    pouria
    Approved by:    lwhsu (mentor)
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D56712
---
 tests/sys/netinet6/ndp.sh | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/tests/sys/netinet6/ndp.sh b/tests/sys/netinet6/ndp.sh
index 35ea6655d922..636a5558b7a8 100755
--- a/tests/sys/netinet6/ndp.sh
+++ b/tests/sys/netinet6/ndp.sh
@@ -834,11 +834,16 @@ ndp_routeinfo_option_body() {
 	done
 
 	# Make sure routes from rti option are being installed
-	atf_check -s exit:0 \
-		-o match:"^${route1}/32[[:space:]]+${lladdr}.*1800" \
-		-o match:"^${route2}/48[[:space:]]+${lladdr}.*600" \
-		-o match:"^default[[:space:]]+${lladdr}" \
-		jexec ${jname} netstat -rn6
+	atf_check -s exit:0 -o save:netstat_out netstat -j ${jname} -rn6
+	atf_check -s exit:0 -o match:"^default[[:space:]]+${lladdr}" \
+		cat netstat_out
+
+	# Ensure that route1's and route2's expiration times are correct
+	# respectively and do not get swapped
+	expire1="$(grep "^${route1}/32[[:space:]]*${lladdr}" netstat_out | cut -wf5)"
+	atf_check -s exit:0 test 601 -le ${expire1} -a ${expire1} -le 1800
+	expire2="$(grep "^${route2}/48[[:space:]]*${lladdr}" netstat_out | cut -wf5)"
+	atf_check -s exit:0 test ${expire2} -le 600
 
 	# Verify the default route lifetime and its preference is overwrited
 	atf_check -s exit:0 \