Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Apr 2026 16:13:43 +0000
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 30b7621d46cc - main - tests/sys/net: Set require.kmods where appropriate
Message-ID:  <69e7a237.3939b.3ef2ce7b@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by markj:

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

commit 30b7621d46cc06053c0cb40bb691fbcecbfdab7f
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-04-21 14:30:36 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-04-21 16:13:19 +0000

    tests/sys/net: Set require.kmods where appropriate
---
 tests/sys/net/if_geneve.sh | 99 +++++++---------------------------------------
 tests/sys/net/if_gif.sh    | 26 +++---------
 tests/sys/net/if_stf.sh    | 20 ++--------
 tests/sys/net/if_wg.sh     | 12 ++----
 4 files changed, 27 insertions(+), 130 deletions(-)

diff --git a/tests/sys/net/if_geneve.sh b/tests/sys/net/if_geneve.sh
index 7eb2649b44a9..e747d414d8cb 100644
--- a/tests/sys/net/if_geneve.sh
+++ b/tests/sys/net/if_geneve.sh
@@ -31,6 +31,7 @@ ether_ipv4_head()
 {
 	atf_set descr 'Create a geneve(4) l2 tunnel over an ipv4 underlay using epair and pass traffic between jails'
 	atf_set require.user root
+	atf_set require.kmods if_geneve
 }
 
 ether_ipv4_body()
@@ -46,10 +47,6 @@ ether_ipv4_body()
 	v6tunnel2=2001:db8::2
 	vni1=1
 
-	if ! kldstat -q -m if_geneve; then
-		atf_skip "This test requires if_geneve"
-	fi
-
 	vnet_init
 	epair=$(vnet_mkepair)
 	vnet_mkjail genevetest1 ${epair}a
@@ -90,6 +87,7 @@ ether_ipv6_head()
 {
 	atf_set descr 'Create a geneve(4) l2 tunnel over an ipv6 underlay using epair and pass traffic between jails'
 	atf_set require.user root
+	atf_set require.kmods if_geneve
 }
 
 ether_ipv6_body()
@@ -105,10 +103,6 @@ ether_ipv6_body()
 	v6tunnel2=2001:db8::2
 	vni1=1
 
-	if ! kldstat -q -m if_geneve; then
-		atf_skip "This test requires if_geneve"
-	fi
-
 	vnet_init
 	epair=$(vnet_mkepair)
 	vnet_mkjail genevetest1 ${epair}a
@@ -149,6 +143,7 @@ inherit_ipv4_head()
 {
 	atf_set descr 'Create a geneve(4) l3 tunnel over an ipv4 underlay using epair and pass traffic between jails'
 	atf_set require.user root
+	atf_set require.kmods if_geneve
 }
 
 inherit_ipv4_body()
@@ -164,10 +159,6 @@ inherit_ipv4_body()
 	v6tunnel2=2001:db8::2
 	vni1=2
 
-	if ! kldstat -q -m if_geneve; then
-		atf_skip "This test requires if_geneve"
-	fi
-
 	vnet_init
 	epair=$(vnet_mkepair)
 	vnet_mkjail genevetest1 ${epair}a
@@ -208,6 +199,7 @@ inherit_ipv6_head()
 {
 	atf_set descr 'Create a geneve(4) l3 tunnel over an ipv6 underlay using epair and pass traffic between jails'
 	atf_set require.user root
+	atf_set require.kmods if_geneve
 }
 
 inherit_ipv6_body()
@@ -223,10 +215,6 @@ inherit_ipv6_body()
 	v6tunnel2=2001:db8::2
 	vni1=1
 
-	if ! kldstat -q -m if_geneve; then
-		atf_skip "This test requires if_geneve"
-	fi
-
 	vnet_init
 	epair=$(vnet_mkepair)
 	vnet_mkjail genevetest1 ${epair}a
@@ -267,6 +255,7 @@ ether_ipv6_blind_options_head()
 {
 	atf_set descr 'Create a geneve(4) l2 ipv6 tunnel and test geneve options'
 	atf_set require.user root
+	atf_set require.kmods if_geneve
 }
 
 ether_ipv6_blind_options_body()
@@ -280,10 +269,6 @@ ether_ipv6_blind_options_body()
 	v6tunnel2=2001:db8::2
 	vni1=1
 
-	if ! kldstat -q -m if_geneve; then
-		atf_skip "This test requires if_geneve"
-	fi
-
 	vnet_init
 	epair=$(vnet_mkepair)
 	vnet_mkjail genevetest1 ${epair}a
@@ -351,6 +336,7 @@ ether_ipv6_external_head()
 {
 	atf_set descr 'Create a geneve(4) l2 ipv6 tunnel and test geneve collect metadata'
 	atf_set require.user root
+	atf_set require.kmods if_geneve
 }
 
 ether_ipv6_external_body()
@@ -364,10 +350,6 @@ ether_ipv6_external_body()
 	v6tunnel2=2001:db8::2
 	vni1=1
 
-	if ! kldstat -q -m if_geneve; then
-		atf_skip "This test requires if_geneve"
-	fi
-
 	vnet_init
 	epair=$(vnet_mkepair)
 	vnet_mkjail genevetest1 ${epair}a
@@ -407,6 +389,7 @@ ether_ipv4_multicast_head()
 {
 	atf_set descr 'Create a geneve(4) l2 ipv4 multicast tunnel using epair and pass traffic between jails'
 	atf_set require.user root
+	atf_set require.kmods if_geneve ip_mroute
 }
 
 ether_ipv4_multicast_body()
@@ -423,13 +406,6 @@ ether_ipv4_multicast_body()
 	v6tunnel2=2001:db8::2
 	vni1=1
 
-	if ! kldstat -q -m if_geneve; then
-		atf_skip "This test requires if_geneve"
-	fi
-	if ! kldstat -q -m ip_mroute; then
-		atf_skip "This test requires ip_mroute"
-	fi
-
 	vnet_init
 	epair=$(vnet_mkepair)
 	vnet_mkjail genevetest1 ${epair}a
@@ -467,7 +443,6 @@ ether_ipv4_multicast_body()
 	atf_check -s exit:0 -o ignore jexec genevetest1 ping -nc 1 -t 1 $v6tunnel2
 	atf_check -s exit:0 -o ignore jexec genevetest2 ping -nc 1 -t 1 $v4tunnel1
 	atf_check -s exit:0 -o ignore jexec genevetest2 ping -nc 1 -t 1 $v6tunnel1
-
 }
 
 ether_ipv4_multicast_cleanup()
@@ -480,6 +455,7 @@ ether_ipv6_multicast_head()
 {
 	atf_set descr 'Create a geneve(4) l2 ipv6 multicast tunnel using epair and pass traffic between jails'
 	atf_set require.user root
+	atf_set require.kmods if_geneve ip6_mroute
 }
 
 ether_ipv6_multicast_body()
@@ -496,13 +472,6 @@ ether_ipv6_multicast_body()
 	v6tunnel2=2001:db8::2
 	vni1=1
 
-	if ! kldstat -q -m if_geneve; then
-		atf_skip "This test requires if_geneve"
-	fi
-	if ! kldstat -q -m ip6_mroute; then
-		atf_skip "This test requires ip6_mroute"
-	fi
-
 	vnet_init
 	epair=$(vnet_mkepair)
 	vnet_mkjail genevetest1 ${epair}a
@@ -537,7 +506,6 @@ ether_ipv6_multicast_body()
 	atf_check -s exit:0 -o ignore jexec genevetest1 ping -nc 1 -t 1 $v6tunnel2
 	atf_check -s exit:0 -o ignore jexec genevetest2 ping -nc 1 -t 1 $v4tunnel1
 	atf_check -s exit:0 -o ignore jexec genevetest2 ping -nc 1 -t 1 $v6tunnel1
-
 }
 
 ether_ipv6_multicast_cleanup()
@@ -550,6 +518,7 @@ ether_ipv4_multicast_without_dev_head()
 {
 	atf_set descr 'Create a geneve(4) l2 ipv4 multicast tunnel without specifying genevedev using epair and pass traffic between jails'
 	atf_set require.user root
+	atf_set require.kmods if_geneve ip_mroute
 }
 
 ether_ipv4_multicast_without_dev_body()
@@ -566,13 +535,6 @@ ether_ipv4_multicast_without_dev_body()
 	v6tunnel2=2001:db8::2
 	vni1=1
 
-	if ! kldstat -q -m if_geneve; then
-		atf_skip "This test requires if_geneve"
-	fi
-	if ! kldstat -q -m ip_mroute; then
-		atf_skip "This test requires ip_mroute"
-	fi
-
 	vnet_init
 	epair=$(vnet_mkepair)
 	vnet_mkjail genevetest1 ${epair}a
@@ -622,6 +584,7 @@ ether_ipv6_multicast_without_dev_head()
 {
 	atf_set descr 'Create a geneve(4) l2 ipv6 multicast tunnel without specifying genevedev using epair and pass traffic between jails'
 	atf_set require.user root
+	atf_set require.kmods if_geneve ip6_mroute
 }
 
 ether_ipv6_multicast_without_dev_body()
@@ -638,13 +601,6 @@ ether_ipv6_multicast_without_dev_body()
 	v6tunnel2=2001:db8::2
 	vni1=1
 
-	if ! kldstat -q -m if_geneve; then
-		atf_skip "This test requires if_geneve"
-	fi
-	if ! kldstat -q -m ip6_mroute; then
-		atf_skip "This test requires ip6_mroute"
-	fi
-
 	vnet_init
 	epair=$(vnet_mkepair)
 	vnet_mkjail genevetest1 ${epair}a
@@ -690,6 +646,7 @@ inherit_ipv4_multicast_head()
 {
 	atf_set descr 'Create a geneve(4) l3 ipv4 multicast tunnel using epair and pass traffic between jails'
 	atf_set require.user root
+	atf_set require.kmods if_geneve ip_mroute
 }
 
 inherit_ipv4_multicast_body()
@@ -706,13 +663,6 @@ inherit_ipv4_multicast_body()
 	v6tunnel2=2001:db8::2
 	vni1=1
 
-	if ! kldstat -q -m if_geneve; then
-		atf_skip "This test requires if_geneve"
-	fi
-	if ! kldstat -q -m ip_mroute; then
-		atf_skip "This test requires ip_mroute"
-	fi
-
 	vnet_init
 	epair=$(vnet_mkepair)
 	vnet_mkjail genevetest1 ${epair}a
@@ -753,7 +703,6 @@ inherit_ipv4_multicast_body()
 	atf_check -s exit:0 -o ignore jexec genevetest2 ping -nc 1 -t 1 $v4tunnel1
 	atf_check -s exit:0 -o ignore jexec genevetest1 ping -nc 1 -t 1 $v6tunnel2
 	atf_check -s exit:0 -o ignore jexec genevetest2 ping -nc 1 -t 1 $v6tunnel1
-
 }
 
 inherit_ipv4_multicast_cleanup()
@@ -766,6 +715,7 @@ inherit_ipv6_multicast_head()
 {
 	atf_set descr 'Create a geneve(4) l3 ipv6 multicast tunnel using epair and pass traffic between jails'
 	atf_set require.user root
+	atf_set require.kmods if_geneve ip6_mroute
 }
 
 inherit_ipv6_multicast_body()
@@ -782,13 +732,6 @@ inherit_ipv6_multicast_body()
 	v6tunnel2=2001:db8::2
 	vni1=1
 
-	if ! kldstat -q -m if_geneve; then
-		atf_skip "This test requires if_geneve"
-	fi
-	if ! kldstat -q -m ip6_mroute; then
-		atf_skip "This test requires ip6_mroute"
-	fi
-
 	vnet_init
 	epair=$(vnet_mkepair)
 	vnet_mkjail genevetest1 ${epair}a
@@ -826,7 +769,6 @@ inherit_ipv6_multicast_body()
 	atf_check -s exit:0 -o ignore jexec genevetest2 ping -nc 1 -t 1 $v6tunnel1
 	atf_check -s exit:0 -o ignore jexec genevetest1 ping -nc 1 -t 1 $v4tunnel2
 	atf_check -s exit:0 -o ignore jexec genevetest2 ping -nc 1 -t 1 $v4tunnel1
-
 }
 
 inherit_ipv6_multicast_cleanup()
@@ -839,6 +781,7 @@ inherit_ipv4_multicast_without_dev_head()
 {
 	atf_set descr 'Create a geneve(4) l3 ipv4 multicast tunnel without specifying genevedev using epair and pass traffic between jails'
 	atf_set require.user root
+	atf_set require.kmods if_geneve ip_mroute
 }
 
 inherit_ipv4_multicast_without_dev_body()
@@ -855,13 +798,6 @@ inherit_ipv4_multicast_without_dev_body()
 	v6tunnel2=2001:db8::2
 	vni1=1
 
-	if ! kldstat -q -m if_geneve; then
-		atf_skip "This test requires if_geneve"
-	fi
-	if ! kldstat -q -m ip_mroute; then
-		atf_skip "This test requires ip_mroute"
-	fi
-
 	vnet_init
 	epair=$(vnet_mkepair)
 	vnet_mkjail genevetest1 ${epair}a
@@ -914,6 +850,7 @@ inherit_ipv6_multicast_without_dev_head()
 {
 	atf_set descr 'Create a geneve(4) l3 ipv6 multicast tunnel without specifying genevedev using epair and pass traffic between jails'
 	atf_set require.user root
+	atf_set require.kmods if_geneve ip6_mroute
 }
 
 inherit_ipv6_multicast_without_dev_body()
@@ -930,13 +867,6 @@ inherit_ipv6_multicast_without_dev_body()
 	v6tunnel2=2001:db8::2
 	vni1=1
 
-	if ! kldstat -q -m if_geneve; then
-		atf_skip "This test requires if_geneve"
-	fi
-	if ! kldstat -q -m ip6_mroute; then
-		atf_skip "This test requires ip6_mroute"
-	fi
-
 	vnet_init
 	epair=$(vnet_mkepair)
 	vnet_mkjail genevetest1 ${epair}a
@@ -972,7 +902,6 @@ inherit_ipv6_multicast_without_dev_body()
 	atf_check -s exit:0 -o ignore jexec genevetest2 ping -nc 1 -t 1 $v6tunnel1
 	atf_check -s exit:0 -o ignore jexec genevetest1 ping -nc 1 -t 1 $v4tunnel2
 	atf_check -s exit:0 -o ignore jexec genevetest2 ping -nc 1 -t 1 $v4tunnel1
-
 }
 
 inherit_ipv6_multicast_without_dev_cleanup()
diff --git a/tests/sys/net/if_gif.sh b/tests/sys/net/if_gif.sh
index bff88f9e75b6..147e77f2179b 100644
--- a/tests/sys/net/if_gif.sh
+++ b/tests/sys/net/if_gif.sh
@@ -31,14 +31,12 @@ atf_test_case "4in4" "cleanup"
 {
 	atf_set descr 'IPv4 in IPv4 tunnel'
 	atf_set require.user root
+	atf_set require.kmods if_gif
 }
 
 4in4_body()
 {
 	vnet_init
-	if ! kldstat -q -m if_gif; then
-		atf_skip "This test requires if_gif"
-	fi
 
 	epair=$(vnet_mkepair)
 
@@ -75,14 +73,12 @@ atf_test_case "6in4" "cleanup"
 {
 	atf_set descr 'IPv6 in IPv4 tunnel'
 	atf_set require.user root
+	atf_set require.kmods if_gif
 }
 
 6in4_body()
 {
 	vnet_init
-	if ! kldstat -q -m if_gif; then
-		atf_skip "This test requires if_gif"
-	fi
 
 	epair=$(vnet_mkepair)
 
@@ -119,14 +115,12 @@ atf_test_case "4in6" "cleanup"
 {
 	atf_set descr 'IPv4 in IPv6 tunnel'
 	atf_set require.user root
+	atf_set require.kmods if_gif
 }
 
 4in6_body()
 {
 	vnet_init
-	if ! kldstat -q -m if_gif; then
-		atf_skip "This test requires if_gif"
-	fi
 
 	epair=$(vnet_mkepair)
 
@@ -163,14 +157,12 @@ atf_test_case "6in6" "cleanup"
 {
 	atf_set descr 'IPv6 in IPv6 tunnel'
 	atf_set require.user root
+	atf_set require.kmods if_gif
 }
 
 6in6_body()
 {
 	vnet_init
-	if ! kldstat -q -m if_gif; then
-		atf_skip "This test requires if_gif"
-	fi
 
 	epair=$(vnet_mkepair)
 
@@ -207,6 +199,7 @@ etherip_head()
 {
 	atf_set descr 'EtherIP regression'
 	atf_set require.user root
+	atf_set require.kmods if_gif
 }
 
 etherip_body()
@@ -214,10 +207,6 @@ etherip_body()
 	vnet_init
 	vnet_init_bridge
 
-	if ! kldstat -q -m if_gif; then
-		atf_skip "This test requires if_gif"
-	fi
-
 	epair=$(vnet_mkepair)
 
 	vnet_mkjail one ${epair}a
@@ -283,6 +272,7 @@ etherip6_head()
 {
 	atf_set descr 'EtherIP over IPv6 regression'
 	atf_set require.user root
+	atf_set require.kmods if_gif
 }
 
 etherip6_body()
@@ -290,10 +280,6 @@ etherip6_body()
 	vnet_init
 	vnet_init_bridge
 
-	if ! kldstat -q -m if_gif; then
-		atf_skip "This test requires if_gif"
-	fi
-
 	epair=$(vnet_mkepair)
 
 	vnet_mkjail one ${epair}a
diff --git a/tests/sys/net/if_stf.sh b/tests/sys/net/if_stf.sh
index 71b00f308014..49565bb533fb 100644
--- a/tests/sys/net/if_stf.sh
+++ b/tests/sys/net/if_stf.sh
@@ -31,17 +31,12 @@ atf_test_case "6to4" "cleanup"
 {
 	atf_set descr 'Test 6to4'
 	atf_set require.user root
+	atf_set require.kmods if_gif if_stf
 }
 
 6to4_body()
 {
 	vnet_init
-	if ! kldstat -q -m if_stf; then
-		atf_skip "This test requires if_stf"
-	fi
-	if ! kldstat -q -m if_gif; then
-		atf_skip "This test requires if_gif"
-	fi
 
 	epair=$(vnet_mkepair)
 
@@ -83,19 +78,13 @@ atf_test_case "6rd" "cleanup"
 {
 	atf_set descr '6RD test'
 	atf_set require.user root
+	atf_set require.kmods if_gif if_stf
 }
 
 6rd_body()
 {
 	vnet_init
 
-	if ! kldstat -q -m if_stf; then
-		atf_skip "This test requires if_stf"
-	fi
-	if ! kldstat -q -m if_gif; then
-		atf_skip "This test requires if_gif"
-	fi
-
 	epair=$(vnet_mkepair)
 	vnet_mkjail br ${epair}a
 	jexec br ifconfig ${epair}a 192.0.2.1/24 up
@@ -136,16 +125,13 @@ atf_test_case "6rd_peer" "cleanup"
 {
 	atf_set descr '6RD peer test'
 	atf_set require.user root
+	atf_set require.kmods if_stf
 }
 
 6rd_peer_body()
 {
 	vnet_init
 
-	if ! kldstat -q -m if_stf; then
-		atf_skip "This test requires if_stf"
-	fi
-
 	epair=$(vnet_mkepair)
 
 	vnet_mkjail one ${epair}a
diff --git a/tests/sys/net/if_wg.sh b/tests/sys/net/if_wg.sh
index 1f51d86c8efa..8af05fc76b19 100644
--- a/tests/sys/net/if_wg.sh
+++ b/tests/sys/net/if_wg.sh
@@ -96,6 +96,7 @@ wg_basic_crossaf_head()
 {
 	atf_set descr 'Create a wg(4) tunnel and pass IPv4 traffic over an IPv6 nexthop'
 	atf_set require.user root
+	atf_set require.kmods if_wg
 }
 
 wg_basic_crossaf_body()
@@ -104,8 +105,6 @@ wg_basic_crossaf_body()
 	local endpoint1 endpoint2 tunnel1 tunnel2
 	local testnet testlocal testremote
 
-	kldload -n if_wg || atf_skip "This test requires if_wg and could not load it"
-
 	pri1=$(wg genkey)
 	pri2=$(wg genkey)
 
@@ -425,6 +424,7 @@ wg_allowedip_incremental_head()
 {
 	atf_set descr "Add/remove allowed-ips from a peer with the +/- incremental syntax"
 	atf_set require.user root
+	atf_set require.kmods if_wg
 }
 
 wg_allowedip_incremental_body()
@@ -432,8 +432,6 @@ wg_allowedip_incremental_body()
 	local pri1 pri2 pub1 pub2 wg1
 	local tunnel1 tunnel2 tunnel3
 
-	kldload -n if_wg || atf_skip "This test requires if_wg and could not load it"
-
 	pri1=$(wg genkey)
 	pri2=$(wg genkey)
 	pub2=$(echo "$pri2" | wg pubkey)
@@ -503,6 +501,7 @@ wg_allowedip_incremental_inet6_head()
 {
 	atf_set descr "Add/remove IPv6 allowed-ips from a peer with the +/- incremental syntax"
 	atf_set require.user root
+	atf_set require.kmods if_wg
 }
 
 wg_allowedip_incremental_inet6_body()
@@ -510,8 +509,6 @@ wg_allowedip_incremental_inet6_body()
 	local pri1 pri2 pub1 pub2 wg1
 	local tunnel1 tunnel2
 
-	kldload -n if_wg || atf_skip "This test requires if_wg and could not load it"
-
 	pri1=$(wg genkey)
 	pri2=$(wg genkey)
 	pub2=$(echo "$pri2" | wg pubkey)
@@ -557,6 +554,7 @@ wg_allowedip_incremental_stealing_head()
 {
 	atf_set descr "Add/remove allowed-ips from a peer with the +/- incremental syntax to steal"
 	atf_set require.user root
+	atf_set require.kmods if_wg
 }
 
 wg_allowedip_incremental_stealing_body()
@@ -565,8 +563,6 @@ wg_allowedip_incremental_stealing_body()
 	local regex2 regex3
 	local tunnel1 tunnel2
 
-	kldload -n if_wg || atf_skip "This test requires if_wg and could not load it"
-
 	pri1=$(wg genkey)
 	pri2=$(wg genkey)
 	pri3=$(wg genkey)


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69e7a237.3939b.3ef2ce7b>