Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 03 May 2026 23:09:21 +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: 47ae0135d461 - main - tests/if_lagg: Minor improvements
Message-ID:  <69f7d5a1.24ca7.59eba5c7@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=47ae0135d461854b72b905ac77bf3e1f5b2868bc

commit 47ae0135d461854b72b905ac77bf3e1f5b2868bc
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-05-03 15:48:49 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-05-03 21:51:50 +0000

    tests/if_lagg: Minor improvements
    
    - Set require.kmods instead of relying on ifconfig to load if_lagg.ko,
      as this doesn't work when running within a jail.
    - Simplify helper functions which create tap and lagg devices.
    
    MFC after:      1 week
---
 tests/sys/net/if_lagg_test.sh | 35 +++++++++++------------------------
 1 file changed, 11 insertions(+), 24 deletions(-)

diff --git a/tests/sys/net/if_lagg_test.sh b/tests/sys/net/if_lagg_test.sh
index 992cdd1ebc0d..7351700b3b82 100755
--- a/tests/sys/net/if_lagg_test.sh
+++ b/tests/sys/net/if_lagg_test.sh
@@ -35,6 +35,7 @@ create_head()
 {
 	atf_set "descr" "Create a lagg and assign an address"
 	atf_set "require.user" "root"
+	atf_set "require.kmods" if_lagg
 }
 create_body()
 {
@@ -78,6 +79,7 @@ status_stress_head()
 {
 	atf_set "descr" "Simultaneously query a lagg while also creating or destroying it."
 	atf_set "require.user" "root"
+	atf_set "require.kmods" if_lagg
 }
 status_stress_body()
 {
@@ -133,6 +135,7 @@ create_destroy_stress_head()
 {
 	atf_set "descr" "Simultaneously create and destroy a lagg"
 	atf_set "require.user" "root"
+	atf_set "require.kmods" if_lagg
 }
 create_destroy_stress_body()
 {
@@ -187,6 +190,7 @@ lacp_linkstate_destroy_stress_head()
 {
 	atf_set "descr" "Simultaneously destroy an LACP lagg and change its childrens link states"
 	atf_set "require.user" "root"
+	atf_set "require.kmods" if_lagg
 }
 lacp_linkstate_destroy_stress_body()
 {
@@ -246,6 +250,7 @@ up_destroy_stress_head()
 {
 	atf_set "descr" "Simultaneously up and destroy a lagg"
 	atf_set "require.user" "root"
+	atf_set "require.kmods" if_lagg
 }
 up_destroy_stress_body()
 {
@@ -303,6 +308,7 @@ set_ether_head()
 {
 	atf_set "descr" "Set a lagg's ethernet address"
 	atf_set "require.user" "root"
+	atf_set "require.kmods" if_lagg
 }
 set_ether_body()
 {
@@ -341,6 +347,7 @@ updown_head()
 {
 	atf_set "descr" "upping or downing a lagg ups or downs its children"
 	atf_set "require.user" "root"
+	atf_set "require.kmods" if_lagg
 }
 updown_body()
 {
@@ -418,35 +425,15 @@ atf_init_test_cases()
 # Creates a new tap(4) interface, registers it for cleanup, and echoes it
 get_tap()
 {
-	local TAPN=0
-	while ! ifconfig tap${TAPN} create > /dev/null 2>&1; do
-		if [ "$TAPN" -ge 8 ]; then
-			atf_skip "Could not create a tap(4) interface"
-		else
-			TAPN=$(($TAPN + 1))
-		fi
-	done
-	local TAPD=tap${TAPN}
-	# Record the TAP device so we can clean it up later
-	echo ${TAPD} >> "devices_to_cleanup"
-	echo ${TAPD}
+	ifconfig tap create > tap
+	cat tap | tee -a devices_to_cleanup
 }
 
 # Creates a new lagg(4) interface, registers it for cleanup, and echoes it
 get_lagg()
 {
-	local LAGGN=0
-	while ! ifconfig lagg${LAGGN} create > /dev/null 2>&1; do
-		if [ "$LAGGN" -ge 8 ]; then
-			atf_skip "Could not create a lagg(4) interface"
-		else
-			LAGGN=$(($LAGGN + 1))
-		fi
-	done
-	local LAGGD=lagg${LAGGN}
-	# Record the lagg device so we can clean it up later
-	echo ${LAGGD} >> "devices_to_cleanup"
-	echo ${LAGGD}
+	ifconfig lagg create > lagg
+	cat lagg | tee -a devices_to_cleanup
 }
 
 cleanup_tap_and_lagg()


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69f7d5a1.24ca7.59eba5c7>