selftests: add netdevsim devlink dev info test

Add test to verify netdevsim driver name returned by devlink dev info.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jiri Pirko 2019-10-07 10:27:09 +02:00 committed by David S. Miller
parent 8e23cc0319
commit 62ede55fe6

View File

@ -4,7 +4,7 @@
lib_dir=$(dirname $0)/../../../net/forwarding
ALL_TESTS="fw_flash_test params_test regions_test reload_test \
netns_reload_test resource_test"
netns_reload_test resource_test dev_info_test"
NUM_NETIFS=0
source $lib_dir/lib.sh
@ -284,6 +284,25 @@ resource_test()
log_test "resource test"
}
info_get()
{
local name=$1
cmd_jq "devlink dev info $DL_HANDLE -j" ".[][][\"$name\"]" "-e"
}
dev_info_test()
{
RET=0
driver=$(info_get "driver")
check_err $? "Failed to get driver name"
[ "$driver" == "netdevsim" ]
check_err $? "Unexpected driver name $driver"
log_test "dev_info test"
}
setup_prepare()
{
modprobe netdevsim