git: 9e6ff43535e4 - stable/14 - netinet tests: Make some tests more reliable when run in parallel

From: Igor Ostapenko <igoro_at_FreeBSD.org>
Date: Thu, 17 Oct 2024 13:49:54 UTC
The branch stable/14 has been updated by igoro:

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

commit 9e6ff43535e4b345202ff9586c2e72eed14e4114
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-09-09 15:28:24 +0000
Commit:     Igor Ostapenko <igoro@FreeBSD.org>
CommitDate: 2024-10-17 13:45:45 +0000

    netinet tests: Make some tests more reliable when run in parallel
    
    Many of the modified tests add epair interfaces to the host, though most
    of the tests themselves run in a VNET jail.  scapy in particular becomes
    unhappy when the list of interfaces changes as it is running, so, to
    improve reliability of parallel test runs, isolate tests which add
    epairs to the host.
    
    Also serialize arp tests, as they examine the dmesg as part of the test.
    
    The list of modified tests is not exhaustive, it was determined by
    running the test suite with parallelization enabled and looking at
    failures.  It may be easier to just automatically enable VNET jailing of
    all netinet tests, but let's be more particular for now.
    
    Reviewed by:    kp
    MFC after:      1 month
    Differential Revision:  https://reviews.freebsd.org/D46606
    
    (cherry picked from commit b103fc49ae160fdce221c2fffa98dde9bc0ff3b0)
    
    Approved by:    kp (mentor), markj (mentor)
---
 tests/sys/netinet/Makefile  | 11 +++++++++--
 tests/sys/netinet6/Makefile | 18 +++++++++++++++++-
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/tests/sys/netinet/Makefile b/tests/sys/netinet/Makefile
index 44f76508bf5c..8fa12378990c 100644
--- a/tests/sys/netinet/Makefile
+++ b/tests/sys/netinet/Makefile
@@ -25,8 +25,15 @@ ATF_TESTS_SH=	arp \
 
 ATF_TESTS_PYTEST+=	carp.py
 
-TEST_METADATA.divert+=	required_programs="python"
-TEST_METADATA.forward+=	required_programs="python"
+# Some of the arp tests look for log messages in the dmesg buffer, so run them
+# serially to avoid problems with interleaved output.
+TEST_METADATA.arp+=	is_exclusive="true"
+TEST_METADATA.divert+=	required_programs="python"	\
+			execenv="jail"			\
+			execenv_jail_params="vnet allow.raw_sockets"
+TEST_METADATA.forward+=	required_programs="python"	\
+			execenv="jail"			\
+			execenv_jail_params="vnet allow.raw_sockets"
 TEST_METADATA.output+=	required_programs="python"
 TEST_METADATA.redirect+= required_programs="python"
 TEST_METADATA.tcp6_v4mapped_bind_test+=	is_exclusive="true"
diff --git a/tests/sys/netinet6/Makefile b/tests/sys/netinet6/Makefile
index 46f6f26115fe..6af0d13c5f03 100644
--- a/tests/sys/netinet6/Makefile
+++ b/tests/sys/netinet6/Makefile
@@ -17,7 +17,23 @@ ATF_TESTS_SH=		exthdr \
 			ndp \
 			proxy_ndp
 
-TEST_METADATA.output6+=	required_programs="python"
+TEST_METADATA.divert+=	execenv="jail"		\
+			execenv_jail_params="vnet allow.raw_sockets"
+TEST_METADATA.exthdr+=	execenv="jail"		\
+			execenv_jail_params="vnet allow.raw_sockets"
+TEST_METADATA.forward6+= execenv="jail"		\
+			execenv_jail_params="vnet allow.raw_sockets"
+TEST_METADATA.ndp+=	execenv="jail"		\
+			execenv_jail_params="vnet allow.raw_sockets"
+TEST_METADATA.output6+=	execenv="jail"		\
+			execenv_jail_params="vnet allow.raw_sockets" \
+			required_programs="python"
+TEST_METADATA.proxy_ndp+= execenv="jail"		\
+			execenv_jail_params="vnet allow.raw_sockets"
+TEST_METADATA.redirect+= execenv="jail"		\
+			execenv_jail_params="vnet allow.raw_sockets"
+TEST_METADATA.scapyi386+= execenv="jail"		\
+			execenv_jail_params="vnet allow.raw_sockets"
 
 ${PACKAGE}FILES+=	exthdr.py \
 			mld.py \