selftests: devlink_lib: Fix bouncing of netdevsim DEVLINK_DEV
authorPetr Machata <petrm@nvidia.com>
Tue, 8 Jun 2021 12:44:10 +0000 (15:44 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 8 Jun 2021 21:39:07 +0000 (14:39 -0700)
commit0521a262f043ea521790ed2976141086c75d2f74
tree617ff1d9bb07066ff734a9e443c77bf75738fec7
parente67dfb8d15deb33c425d0b0ee22f2e5eef54c162
selftests: devlink_lib: Fix bouncing of netdevsim DEVLINK_DEV

In the commit referenced below, a check was added to devlink_lib that
asserts the existence of a devlink device referenced by $DEVLINK_DEV.
Unfortunately, several netdevsim tests point DEVLINK_DEV at a device that
does not exist at the time that devlink_lib is sourced. Thus these tests
spuriously fail.

Fix this by introducing an override. By setting DEVLINK_DEV to an empty
string, the user declares their intention to handle DEVLINK_DEV management
on their own.

In all netdevsim tests that use devlink_lib and set DEVLINK_DEV, set
instead an empty DEVLINK_DEV just before sourcing devlink_lib, and set it
to the correct value right afterwards.

Fixes: 557c4d2f780c ("selftests: devlink_lib: add check for devlink device existence")
Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/drivers/net/netdevsim/devlink_trap.sh
tools/testing/selftests/drivers/net/netdevsim/fib.sh
tools/testing/selftests/drivers/net/netdevsim/nexthop.sh
tools/testing/selftests/drivers/net/netdevsim/psample.sh
tools/testing/selftests/net/forwarding/devlink_lib.sh