netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] selftests: rtnetlink: skip ipsec offload tests if netdevsim isn't present
@ 2019-06-27 15:12 Florian Westphal
  2019-06-29 19:19 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2019-06-27 15:12 UTC (permalink / raw)
  To: netdev; +Cc: Florian Westphal

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>
---
 Feel free to apply to -next, its not a bug fix per se.

 tools/testing/selftests/net/rtnetlink.sh | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
index b25c9fe019d2..a7a443bdbdd9 100755
--- a/tools/testing/selftests/net/rtnetlink.sh
+++ b/tools/testing/selftests/net/rtnetlink.sh
@@ -699,13 +699,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
@@ -785,7 +789,7 @@ EOF
 	fi
 
 	# clean up any leftovers
-	rmmod netdevsim
+	$probed && rmmod netdevsim
 
 	if [ $ret -ne 0 ]; then
 		echo "FAIL: ipsec_offload"
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] selftests: rtnetlink: skip ipsec offload tests if netdevsim isn't present
  2019-06-27 15:12 [PATCH net] selftests: rtnetlink: skip ipsec offload tests if netdevsim isn't present Florian Westphal
@ 2019-06-29 19:19 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-06-29 19:19 UTC (permalink / raw)
  To: fw; +Cc: netdev

From: Florian Westphal <fw@strlen.de>
Date: Thu, 27 Jun 2019 17:12:42 +0200

> 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>
> ---
>  Feel free to apply to -next, its not a bug fix per se.

Applied to net-next, thank you.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-29 19:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-27 15:12 [PATCH net] selftests: rtnetlink: skip ipsec offload tests if netdevsim isn't present Florian Westphal
2019-06-29 19:19 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).