Netdev List
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Ido Schimmel <idosch@nvidia.com>
Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
	 davem@davemloft.net, kuba@kernel.org, edumazet@google.com,
	shuah@kernel.org,  razor@blackwall.org
Subject: Re: [PATCH net-next] selftests: net: Fix bridge backup port test flakiness
Date: Thu, 01 Feb 2024 13:31:49 +0100	[thread overview]
Message-ID: <5dfcfc03f62f80a498b9281e31f9e40ae1e35a34.camel@redhat.com> (raw)
In-Reply-To: <Zbt9dxyJHszL4Aoy@shredder>

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


      reply	other threads:[~2024-02-01 12:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-01  8:05 [PATCH net-next] selftests: net: Fix bridge backup port test flakiness Ido Schimmel
2024-02-01  9:34 ` Paolo Abeni
2024-02-01 11:16   ` Ido Schimmel
2024-02-01 12:31     ` Paolo Abeni [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5dfcfc03f62f80a498b9281e31f9e40ae1e35a34.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=razor@blackwall.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox