On Thu, 2024-02-01 at 13:16 +0200, Ido Schimmel wrote: > On Thu, Feb 01, 2024 at 10:34:52AM +0100, Paolo Abeni wrote: > > What about adding an helper alike wait_local_port_listen(), checking > > for bridge link status in short intervals, to likely reduce the overall > > wait time? > > What about the below? > > diff --git a/tools/testing/selftests/net/test_bridge_backup_port.sh b/tools/testing/selftests/net/test_bridge_backup_port.sh > index 70a7d87ba2d2..1b3f89e2b86e 100755 > --- a/tools/testing/selftests/net/test_bridge_backup_port.sh > +++ b/tools/testing/selftests/net/test_bridge_backup_port.sh > @@ -124,6 +124,16 @@ tc_check_packets() > [[ $pkts == $count ]] > } > > +bridge_link_check() > +{ > + local ns=$1; shift > + local dev=$1; shift > + local state=$1; shift > + > + bridge -n $ns -d -j link show dev $dev | \ > + jq -e ".[][\"state\"] == \"$state\"" &> /dev/null > +} I was wondering more about a sleeping loop, something alike: wait_bridge_link() { for i in $(seq 10); do if bridge_link_check $1 $2 $3; then break fi sleep 0.1 done } but no strong preference Cheers, Paolo