git: b103fc49ae16 - main - netinet tests: Make some tests more reliable when run in parallel

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Mon, 09 Sep 2024 15:28:45 UTC
The branch main has been updated by markj:

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

commit b103fc49ae160fdce221c2fffa98dde9bc0ff3b0
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-09-09 15:28:24 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-09-09 15:28:24 +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
---
 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 7e12dae6a4fa..a6f07d135724 100644
--- a/tests/sys/netinet/Makefile
+++ b/tests/sys/netinet/Makefile
@@ -27,8 +27,15 @@ ATF_TESTS_SH=	arp \
 ATF_TESTS_PYTEST+=	carp.py
 ATF_TESTS_PYTEST+=	igmp.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 45e88b50164b..753571fbf7a1 100644
--- a/tests/sys/netinet6/Makefile
+++ b/tests/sys/netinet6/Makefile
@@ -16,7 +16,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 \