The branch stable/14 has been updated by markj:

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

commit 5937f2ffe3e37b8668e6b29ac817c1612cb81865
Author:     Mark Johnston <[email protected]>
AuthorDate: 2026-05-03 15:48:49 +0000
Commit:     Mark Johnston <[email protected]>
CommitDate: 2026-05-19 16:46:28 +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
    
    (cherry picked from commit 47ae0135d461854b72b905ac77bf3e1f5b2868bc)
---
 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 6b99aaedfbbf..8484470c54ee 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()
 {
@@ -137,6 +139,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()
 {
@@ -193,6 +196,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()
 {
@@ -256,6 +260,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()
 {
@@ -315,6 +320,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()
 {
@@ -353,6 +359,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()
 {
@@ -434,35 +441,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()

Reply via email to