Skip to contentSkip to conversation

selftests: devlink_lib: add check for devlink device existence

PATCH Applied Jiri Pirko 2 participants 2 messages May 27, 2021

Subsystems (4)
lore
Share & tools
lore

Jiri Pirko

author
#0 lore raw

PATCH 1/1 selftests: devlink_lib: add check for devlink device existence

From: Jiri Pirko <[email protected]>

If user passes devlink handle over DEVLINK_DEV variable, check if the device exists.

---
 tools/testing/selftests/net/forwarding/devlink_lib.sh | 6 ++++++
 1 file changed, 6 insertions(+)
tools/testing/selftests/net/forwarding/devlink_lib.sh +6 -0
index 9c12c4fd3afc..c19e001f138b 100644
@@ -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
 
 ##############################################################################
Signature · 1 line
2.31.1
#1 lore raw
This patch was applied to netdev/net-next.git (refs/heads/master):

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

Quoted 8 lines · On Thu, 27 May 2021 12:55:15 +0200 you wrote:

From: Jiri Pirko <[email protected]>

If user passes devlink handle over DEVLINK_DEV variable, check if the device exists.

[...]

Here is the summary with links:
- [net-next] selftests: devlink_lib: add check for devlink device existence

    https://git.kernel.org/netdev/net-next/c/557c4d2f780c

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html