summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJiri Pirko <jiri@nvidia.com>2024-04-24 13:40:47 +0300
committerPaolo Abeni <pabeni@redhat.com>2024-04-26 14:26:53 +0300
commit617198cbc69d94c6b5130a97e51598428398a7d0 (patch)
treeaecc7d3d39c9ae5c131e27d2579dda89c69cd31c /tools
parent41ad836e393aa834039de48c84305dfe7d6aceef (diff)
downloadlinux-617198cbc69d94c6b5130a97e51598428398a7d0.tar.xz
selftests: forwarding: add check_driver() helper
Add a helper to be used to check if the netdevice is backed by specified driver. Signed-off-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Benjamin Poirier <bpoirier@nvidia.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/net/forwarding/lib.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index 9d6802c6c023..2d57912d3973 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -283,6 +283,18 @@ if [[ "$(id -u)" -ne 0 ]]; then
exit $ksft_skip
fi
+check_driver()
+{
+ local dev=$1; shift
+ local expected=$1; shift
+ local driver_name=`driver_name_get $dev`
+
+ if [[ $driver_name != $expected ]]; then
+ echo "SKIP: expected driver $expected for $dev, got $driver_name instead"
+ exit $ksft_skip
+ fi
+}
+
if [[ "$CHECK_TC" = "yes" ]]; then
check_tc_version
fi