Message ID | 20240424104049.3935572-5-jiri@resnulli.us (mailing list archive) |
---|---|
State | Accepted |
Commit | dae9dd5fd9f35f0e57599148d3655e9d473c8e24 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | selftests: virtio_net: introduce initial testing infrastructure | expand |
On 2024-04-24 12:40 +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> > Reviewed-by: Petr Machata <petrm@nvidia.com> > --- Reviewed-by: Benjamin Poirier <bpoirier@nvidia.com>
diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 2d57912d3973..3353a1745946 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -738,6 +738,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 &> /dev/null + if (( $? )); then + check_err 1 + log_test wait_for_dev "Interface $dev did not appear." + exit $EXIT_STATUS + fi +} + cmd_jq() { local cmd=$1