summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/net/rtnetlink.sh
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2019-06-27 17:12:42 +0200
committerDavid S. Miller <davem@davemloft.net>2019-06-29 12:18:52 -0700
commit3099c59db0f2d6b85389af5ac652569bac3f1ee8 (patch)
tree78b53307dd426075149119b88306c2337e60d539 /tools/testing/selftests/net/rtnetlink.sh
parentfc41388564ba3fcb8cf4b0ef24c3e220ab523085 (diff)
downloadlinux-stable-3099c59db0f2d6b85389af5ac652569bac3f1ee8.tar.gz
linux-stable-3099c59db0f2d6b85389af5ac652569bac3f1ee8.tar.bz2
linux-stable-3099c59db0f2d6b85389af5ac652569bac3f1ee8.zip
selftests: rtnetlink: skip ipsec offload tests if netdevsim isn't present
running the script on systems without netdevsim now prints: SKIP: ipsec_offload can't load netdevsim instead of error message & failed status. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/selftests/net/rtnetlink.sh')
-rwxr-xr-xtools/testing/selftests/net/rtnetlink.sh16
1 files changed, 10 insertions, 6 deletions
diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
index 505628884783..bdbf4b3125b6 100755
--- a/tools/testing/selftests/net/rtnetlink.sh
+++ b/tools/testing/selftests/net/rtnetlink.sh
@@ -738,13 +738,17 @@ kci_test_ipsec_offload()
sysfsd=/sys/kernel/debug/netdevsim/netdevsim0/ports/0/
sysfsf=$sysfsd/ipsec
sysfsnet=/sys/bus/netdevsim/devices/netdevsim0/net/
+ probed=false
# setup netdevsim since dummydev doesn't have offload support
- modprobe netdevsim
- check_err $?
- if [ $ret -ne 0 ]; then
- echo "FAIL: ipsec_offload can't load netdevsim"
- return 1
+ if [ ! -w /sys/bus/netdevsim/new_device ] ; then
+ modprobe -q netdevsim
+ check_err $?
+ if [ $ret -ne 0 ]; then
+ echo "SKIP: ipsec_offload can't load netdevsim"
+ return $ksft_skip
+ fi
+ probed=true
fi
echo "0" > /sys/bus/netdevsim/new_device
@@ -824,7 +828,7 @@ EOF
fi
# clean up any leftovers
- rmmod netdevsim
+ $probed && rmmod netdevsim
if [ $ret -ne 0 ]; then
echo "FAIL: ipsec_offload"