Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jiri Pirko and committed by
Paolo Abeni
dae9dd5f 617198cb

+13
+13
tools/testing/selftests/net/forwarding/lib.sh
··· 738 738 sleep $WAIT_TIME 739 739 } 740 740 741 + wait_for_dev() 742 + { 743 + local dev=$1; shift 744 + local timeout=${1:-$WAIT_TIMEOUT}; shift 745 + 746 + slowwait $timeout ip link show dev $dev &> /dev/null 747 + if (( $? )); then 748 + check_err 1 749 + log_test wait_for_dev "Interface $dev did not appear." 750 + exit $EXIT_STATUS 751 + fi 752 + } 753 + 741 754 cmd_jq() 742 755 { 743 756 local cmd=$1