summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJiri Pirko <jiri@nvidia.com>2021-05-27 12:55:15 +0200
committerJakub Kicinski <kuba@kernel.org>2021-05-27 14:49:07 -0700
commit557c4d2f780ce73ffad8dfe4d03a27dc9e13dfde (patch)
tree83b9f92d83c4b291fdda2497e73d027270cf0771 /tools
parentb14b27fffa2e3dd0b4af052fa19b94e34c33130a (diff)
selftests: devlink_lib: add check for devlink device existence
If user passes devlink handle over DEVLINK_DEV variable, check if the device exists. Signed-off-by: Jiri Pirko <jiri@nvidia.com> Link: https://lore.kernel.org/r/20210527105515.790330-1-jiri@resnulli.us Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/net/forwarding/devlink_lib.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/forwarding/devlink_lib.sh b/tools/testing/selftests/net/forwarding/devlink_lib.sh
index 9c12c4fd3afc..c19e001f138b 100644
--- a/tools/testing/selftests/net/forwarding/devlink_lib.sh
+++ b/tools/testing/selftests/net/forwarding/devlink_lib.sh
@@ -18,6 +18,12 @@ if [[ ! -v DEVLINK_DEV ]]; then
DEVLINK_VIDDID=$(lspci -s $(echo $DEVLINK_DEV | cut -d"/" -f2) \
-n | cut -d" " -f3)
+else
+ devlink dev show $DEVLINK_DEV &> /dev/null
+ if [ $? -ne 0 ]; then
+ echo "SKIP: devlink device \"$DEVLINK_DEV\" not found"
+ exit 1
+ fi
fi
##############################################################################