From: Benjamin Poirier <benjamin.poirier@gmail.com>
To: Jiri Pirko <jiri@resnulli.us>
Cc: netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com,
davem@davemloft.net, edumazet@google.com, parav@nvidia.com,
mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com,
shuah@kernel.org, petrm@nvidia.com, liuhangbin@gmail.com,
vladimir.oltean@nxp.com, idosch@nvidia.com,
virtualization@lists.linux.dev
Subject: Re: [patch net-next v2 5/6] selftests: forwarding: add wait_for_dev() helper
Date: Mon, 15 Apr 2024 17:39:42 -0400 [thread overview]
Message-ID: <Zh2enn9ArVKDrdIy@f4> (raw)
In-Reply-To: <20240415162530.3594670-6-jiri@resnulli.us>
On 2024-04-15 18:25 +0200, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@nvidia.com>
>
> The existing setup_wait*() helper family check the status of the
> interface to be up. Introduce wait_for_dev() to wait for the netdevice
> to appear, for example after test script does manual device bind.
>
> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
> ---
> v1->v2:
> - reworked wait_for_dev() helper to use slowwait() helper
> ---
> tools/testing/selftests/net/forwarding/lib.sh | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
> index 254698c6ba56..e85b361dc85d 100644
> --- a/tools/testing/selftests/net/forwarding/lib.sh
> +++ b/tools/testing/selftests/net/forwarding/lib.sh
> @@ -746,6 +746,19 @@ setup_wait()
> sleep $WAIT_TIME
> }
>
> +wait_for_dev()
> +{
> + local dev=$1; shift
> + local timeout=${1:-$WAIT_TIMEOUT}; shift
> +
> + slowwait $timeout ip link show dev $dev up &> /dev/null
Sorry, I just noticed that this includes the "up" flag. I was confused
for a while until I realized that `ip` returns success even if the
interface is not up:
# ip link set dev eth1 down
# ip link show dev eth1 up
# echo $?
0
So wait_for_dev() really does just wait for the device to appear, not
for it to be up. If you agree, please remove the 'up' keyword to avoid
confusion.
next prev parent reply other threads:[~2024-04-15 21:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-15 16:25 [patch net-next v2 0/6] selftests: virtio_net: introduce initial testing infrastructure Jiri Pirko
2024-04-15 16:25 ` [patch net-next v2 1/6] virtio: add debugfs infrastructure to allow to debug virtio features Jiri Pirko
2024-04-16 3:52 ` Jason Wang
2024-04-16 9:37 ` Jiri Pirko
2024-04-17 4:37 ` Jason Wang
2024-04-17 7:22 ` Jiri Pirko
2024-04-18 0:59 ` Jason Wang
2024-04-18 8:28 ` Jiri Pirko
2024-04-15 16:25 ` [patch net-next v2 2/6] selftests: forwarding: move couple of initial check to the beginning Jiri Pirko
2024-04-15 16:25 ` [patch net-next v2 3/6] selftests: forwarding: add ability to assemble NETIFS array by driver name Jiri Pirko
2024-04-15 16:25 ` [patch net-next v2 4/6] selftests: forwarding: add check_driver() helper Jiri Pirko
2024-04-15 16:25 ` [patch net-next v2 5/6] selftests: forwarding: add wait_for_dev() helper Jiri Pirko
2024-04-15 21:39 ` Benjamin Poirier [this message]
2024-04-16 9:34 ` Jiri Pirko
2024-04-15 16:25 ` [patch net-next v2 6/6] selftests: virtio_net: add initial tests Jiri Pirko
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=Zh2enn9ArVKDrdIy@f4 \
--to=benjamin.poirier@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=idosch@nvidia.com \
--cc=jasowang@redhat.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=liuhangbin@gmail.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=parav@nvidia.com \
--cc=petrm@nvidia.com \
--cc=shuah@kernel.org \
--cc=virtualization@lists.linux.dev \
--cc=vladimir.oltean@nxp.com \
--cc=xuanzhuo@linux.alibaba.com \
/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;
as well as URLs for NNTP newsgroup(s).