[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210527105515.790330-1-jiri@resnulli.us>
Date: Thu, 27 May 2021 12:55:15 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, kuba@...nel.org, mlxsw@...dia.com
Subject: [patch net-next] selftests: devlink_lib: add check for devlink device existence
From: Jiri Pirko <jiri@...dia.com>
If user passes devlink handle over DEVLINK_DEV variable, check if the
device exists.
Signed-off-by: Jiri Pirko <jiri@...dia.com>
---
tools/testing/selftests/net/forwarding/devlink_lib.sh | 6 ++++++
1 file changed, 6 insertions(+)
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
##############################################################################
--
2.31.1
Powered by blists - more mailing lists