aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/net/forwarding/devlink_lib.sh
diff options
context:
space:
mode:
authorPetr Machata <petrm@nvidia.com>2021-06-08 15:44:10 +0300
committerDavid S. Miller <davem@davemloft.net>2021-06-08 14:39:07 -0700
commit0521a262f043ea521790ed2976141086c75d2f74 (patch)
tree617ff1d9bb07066ff734a9e443c77bf75738fec7 /tools/testing/selftests/net/forwarding/devlink_lib.sh
parentselftests: Clean forgotten resources as part of cleanup() (diff)
downloadlinux-dev-0521a262f043ea521790ed2976141086c75d2f74.tar.xz
linux-dev-0521a262f043ea521790ed2976141086c75d2f74.zip
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>
Diffstat (limited to '')
-rw-r--r--tools/testing/selftests/net/forwarding/devlink_lib.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/net/forwarding/devlink_lib.sh b/tools/testing/selftests/net/forwarding/devlink_lib.sh
index c19e001f138b..39fb9b8e7b58 100644
--- a/tools/testing/selftests/net/forwarding/devlink_lib.sh
+++ b/tools/testing/selftests/net/forwarding/devlink_lib.sh
@@ -18,7 +18,7 @@ if [[ ! -v DEVLINK_DEV ]]; then
DEVLINK_VIDDID=$(lspci -s $(echo $DEVLINK_DEV | cut -d"/" -f2) \
-n | cut -d" " -f3)
-else
+elif [[ ! -z "$DEVLINK_DEV" ]]; then
devlink dev show $DEVLINK_DEV &> /dev/null
if [ $? -ne 0 ]; then
echo "SKIP: devlink device \"$DEVLINK_DEV\" not found"