diff options
author | Jiri Pirko <jiri@nvidia.com> | 2024-04-24 13:40:48 +0300 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2024-04-26 14:26:53 +0300 |
commit | dae9dd5fd9f35f0e57599148d3655e9d473c8e24 (patch) | |
tree | a5cadbc5adcde65d656569159ef151e442c22fbe /tools/testing/selftests/net/forwarding | |
parent | 617198cbc69d94c6b5130a97e51598428398a7d0 (diff) | |
download | linux-dae9dd5fd9f35f0e57599148d3655e9d473c8e24.tar.xz |
selftests: forwarding: add wait_for_dev() helper
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>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'tools/testing/selftests/net/forwarding')
-rw-r--r-- | tools/testing/selftests/net/forwarding/lib.sh | 13 |
1 files changed, 13 insertions, 0 deletions
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 |