git: fd5828b62bdb - stable/12 - bridge tests: Avoid building a switching loop

Kristof Provost kp at FreeBSD.org
Tue Mar 2 15:18:07 UTC 2021


The branch stable/12 has been updated by kp:

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

commit fd5828b62bdb5738143c81edb139365aa4151567
Author:     Kristof Provost <kp at FreeBSD.org>
AuthorDate: 2020-06-01 19:26:16 +0000
Commit:     Kristof Provost <kp at FreeBSD.org>
CommitDate: 2021-03-02 13:03:07 +0000

    bridge tests: Avoid building a switching loop
    
    Enable STP before bringing the bridges up. This avoids a switching loop,
    which has a tendency to drown out progress in userspace processes,
    especially on single-core systems.
    
    Only check that we have indeed shut down one of the looped interfaces
    
    PR:             246448
    Reviewed by:    melifaro
    Differential Revision:  https://reviews.freebsd.org/D25084
    
    (cherry picked from commit e07e002e950aa673266e3d4b30c43e1198af65e0)
---
 tests/sys/net/if_bridge_test.sh | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh
index a20eae49998f..b848a03b273d 100755
--- a/tests/sys/net/if_bridge_test.sh
+++ b/tests/sys/net/if_bridge_test.sh
@@ -72,7 +72,6 @@ stp_head()
 {
 	atf_set descr 'Spanning tree test'
 	atf_set require.user root
-	atf_set require.progs jq
 }
 
 stp_body()
@@ -87,13 +86,11 @@ stp_body()
 	vnet_mkjail a ${bridge_a} ${epair_one}a ${epair_two}a
 	vnet_mkjail b ${bridge_b} ${epair_one}b ${epair_two}b
 
-	jexec a ifconfig ${bridge_a} up
 	jexec a ifconfig ${epair_one}a up
 	jexec a ifconfig ${epair_two}a up
 	jexec a ifconfig ${bridge_a} addm ${epair_one}a
 	jexec a ifconfig ${bridge_a} addm ${epair_two}a
 
-	jexec b ifconfig ${bridge_b} up
 	jexec b ifconfig ${epair_one}b up
 	jexec b ifconfig ${epair_two}b up
 	jexec b ifconfig ${bridge_b} addm ${epair_one}b
@@ -101,23 +98,15 @@ stp_body()
 
 	jexec a ifconfig ${bridge_a} 192.0.2.1/24
 
-	# Give the interfaces some time to come up and pass some traffic
-	sleep 5
-
-	# Confirm that there's looping traffic
-	nbr=$(jexec a netstat -I ${bridge_a} --libxo json \
-		| jq ".statistics.interface[0].\"received-packets\"")
-	if [ ${nbr} -lt 100 ]
-	then
-		atf_fail "Expected bridging loop, but found very few packets."
-	fi
-
 	# Enable spanning tree
 	jexec a ifconfig ${bridge_a} stp ${epair_one}a
 	jexec a ifconfig ${bridge_a} stp ${epair_two}a
 	jexec b ifconfig ${bridge_b} stp ${epair_one}b
 	jexec b ifconfig ${bridge_b} stp ${epair_two}b
 
+	jexec b ifconfig ${bridge_b} up
+	jexec a ifconfig ${bridge_a} up
+
 	# Give STP time to do its thing
 	sleep 5
 


More information about the dev-commits-src-all mailing list