summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Pirko <jiri@nvidia.com>2024-04-24 12:40:48 +0200
committerPaolo Abeni <pabeni@redhat.com>2024-04-26 13:26:53 +0200
commitdae9dd5fd9f35f0e57599148d3655e9d473c8e24 (patch)
treea5cadbc5adcde65d656569159ef151e442c22fbe
parent617198cbc69d94c6b5130a97e51598428398a7d0 (diff)
downloadlinux-stable-dae9dd5fd9f35f0e57599148d3655e9d473c8e24.tar.gz
linux-stable-dae9dd5fd9f35f0e57599148d3655e9d473c8e24.tar.bz2
linux-stable-dae9dd5fd9f35f0e57599148d3655e9d473c8e24.zip
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>
-rw-r--r--tools/testing/selftests/net/forwarding/lib.sh13
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