netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] selftests: Add torture tests to nexthop tests
@ 2020-05-28  0:03 David Ahern
  2020-05-28  8:53 ` Nikolay Aleksandrov
  2020-05-28 18:00 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: David Ahern @ 2020-05-28  0:03 UTC (permalink / raw)
  To: netdev, kuba, davem; +Cc: David Ahern

Add Nik's torture tests as a new set to stress the replace and cleanup
paths.

Torture test created by Nikolay Aleksandrov and then I adapted to
selftest and added IPv6 version.

Signed-off-by: David Ahern <dsahern@kernel.org>
---
 tools/testing/selftests/net/fib_nexthops.sh | 115 +++++++++++++++++++-
 1 file changed, 113 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/net/fib_nexthops.sh b/tools/testing/selftests/net/fib_nexthops.sh
index 1e2f61262e4e..dee567f7576a 100755
--- a/tools/testing/selftests/net/fib_nexthops.sh
+++ b/tools/testing/selftests/net/fib_nexthops.sh
@@ -19,8 +19,8 @@ ret=0
 ksft_skip=4
 
 # all tests in this script. Can be overridden with -t option
-IPV4_TESTS="ipv4_fcnal ipv4_grp_fcnal ipv4_withv6_fcnal ipv4_fcnal_runtime ipv4_large_grp ipv4_compat_mode ipv4_fdb_grp_fcnal"
-IPV6_TESTS="ipv6_fcnal ipv6_grp_fcnal ipv6_fcnal_runtime ipv6_large_grp ipv6_compat_mode ipv6_fdb_grp_fcnal"
+IPV4_TESTS="ipv4_fcnal ipv4_grp_fcnal ipv4_withv6_fcnal ipv4_fcnal_runtime ipv4_large_grp ipv4_compat_mode ipv4_fdb_grp_fcnal ipv4_torture"
+IPV6_TESTS="ipv6_fcnal ipv6_grp_fcnal ipv6_fcnal_runtime ipv6_large_grp ipv6_compat_mode ipv6_fdb_grp_fcnal ipv6_torture"
 
 ALL_TESTS="basic ${IPV4_TESTS} ${IPV6_TESTS}"
 TESTS="${ALL_TESTS}"
@@ -767,6 +767,62 @@ ipv6_large_grp()
 	$IP nexthop flush >/dev/null 2>&1
 }
 
+ipv6_del_add_loop1()
+{
+	while :; do
+		$IP nexthop del id 100
+		$IP nexthop add id 100 via 2001:db8:91::2 dev veth1
+	done >/dev/null 2>&1
+}
+
+ipv6_grp_replace_loop()
+{
+	while :; do
+		$IP nexthop replace id 102 group 100/101
+	done >/dev/null 2>&1
+}
+
+ipv6_torture()
+{
+	local pid1
+	local pid2
+	local pid3
+	local pid4
+	local pid5
+
+	echo
+	echo "IPv6 runtime torture"
+	echo "--------------------"
+	if [ ! -x "$(command -v mausezahn)" ]; then
+		echo "SKIP: Could not run test; need mausezahn tool"
+		return
+	fi
+
+	run_cmd "$IP nexthop add id 100 via 2001:db8:91::2 dev veth1"
+	run_cmd "$IP nexthop add id 101 via 2001:db8:92::2 dev veth3"
+	run_cmd "$IP nexthop add id 102 group 100/101"
+	run_cmd "$IP route add 2001:db8:101::1 nhid 102"
+	run_cmd "$IP route add 2001:db8:101::2 nhid 102"
+
+	ipv6_del_add_loop1 &
+	pid1=$!
+	ipv6_grp_replace_loop &
+	pid2=$!
+	ip netns exec me ping -f 2001:db8:101::1 >/dev/null 2>&1 &
+	pid3=$!
+	ip netns exec me ping -f 2001:db8:101::2 >/dev/null 2>&1 &
+	pid4=$!
+	ip netns exec me mausezahn veth1 -B 2001:db8:101::2 -A 2001:db8:91::1 -c 0 -t tcp "dp=1-1023, flags=syn" >/dev/null 2>&1 &
+	pid5=$!
+
+	sleep 300
+	kill -9 $pid1 $pid2 $pid3 $pid4 $pid5
+
+	# if we did not crash, success
+	log_test 0 0 "IPv6 torture test"
+}
+
+
 ipv4_fcnal()
 {
 	local rc
@@ -1313,6 +1369,61 @@ ipv4_compat_mode()
 	sysctl_nexthop_compat_mode_set 1 "IPv4"
 }
 
+ipv4_del_add_loop1()
+{
+	while :; do
+		$IP nexthop del id 100
+		$IP nexthop add id 100 via 172.16.1.2 dev veth1
+	done >/dev/null 2>&1
+}
+
+ipv4_grp_replace_loop()
+{
+	while :; do
+		$IP nexthop replace id 102 group 100/101
+	done >/dev/null 2>&1
+}
+
+ipv4_torture()
+{
+	local pid1
+	local pid2
+	local pid3
+	local pid4
+	local pid5
+
+	echo
+	echo "IPv4 runtime torture"
+	echo "--------------------"
+	if [ ! -x "$(command -v mausezahn)" ]; then
+		echo "SKIP: Could not run test; need mausezahn tool"
+		return
+	fi
+
+	run_cmd "$IP nexthop add id 100 via 172.16.1.2 dev veth1"
+	run_cmd "$IP nexthop add id 101 via 172.16.2.2 dev veth3"
+	run_cmd "$IP nexthop add id 102 group 100/101"
+	run_cmd "$IP route add 172.16.101.1 nhid 102"
+	run_cmd "$IP route add 172.16.101.2 nhid 102"
+
+	ipv4_del_add_loop1 &
+	pid1=$!
+	ipv4_grp_replace_loop &
+	pid2=$!
+	ip netns exec me ping -f 172.16.101.1 >/dev/null 2>&1 &
+	pid3=$!
+	ip netns exec me ping -f 172.16.101.2 >/dev/null 2>&1 &
+	pid4=$!
+	ip netns exec me mausezahn veth1 -B 172.16.101.2 -A 172.16.1.1 -c 0 -t tcp "dp=1-1023, flags=syn" >/dev/null 2>&1 &
+	pid5=$!
+
+	sleep 300
+	kill -9 $pid1 $pid2 $pid3 $pid4 $pid5
+
+	# if we did not crash, success
+	log_test 0 0 "IPv4 torture test"
+}
+
 basic()
 {
 	echo
-- 
2.17.1


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

* Re: [PATCH net-next] selftests: Add torture tests to nexthop tests
  2020-05-28  0:03 [PATCH net-next] selftests: Add torture tests to nexthop tests David Ahern
@ 2020-05-28  8:53 ` Nikolay Aleksandrov
  2020-05-28 18:00 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Aleksandrov @ 2020-05-28  8:53 UTC (permalink / raw)
  To: David Ahern, netdev, kuba, davem

On 28/05/2020 03:03, David Ahern wrote:
> Add Nik's torture tests as a new set to stress the replace and cleanup
> paths.
> 
> Torture test created by Nikolay Aleksandrov and then I adapted to
> selftest and added IPv6 version.
> 
> Signed-off-by: David Ahern <dsahern@kernel.org>
> ---
>  tools/testing/selftests/net/fib_nexthops.sh | 115 +++++++++++++++++++-
>  1 file changed, 113 insertions(+), 2 deletions(-)
> 

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>

> diff --git a/tools/testing/selftests/net/fib_nexthops.sh b/tools/testing/selftests/net/fib_nexthops.sh
> index 1e2f61262e4e..dee567f7576a 100755
> --- a/tools/testing/selftests/net/fib_nexthops.sh
> +++ b/tools/testing/selftests/net/fib_nexthops.sh
> @@ -19,8 +19,8 @@ ret=0
>  ksft_skip=4
>  
>  # all tests in this script. Can be overridden with -t option
> -IPV4_TESTS="ipv4_fcnal ipv4_grp_fcnal ipv4_withv6_fcnal ipv4_fcnal_runtime ipv4_large_grp ipv4_compat_mode ipv4_fdb_grp_fcnal"
> -IPV6_TESTS="ipv6_fcnal ipv6_grp_fcnal ipv6_fcnal_runtime ipv6_large_grp ipv6_compat_mode ipv6_fdb_grp_fcnal"
> +IPV4_TESTS="ipv4_fcnal ipv4_grp_fcnal ipv4_withv6_fcnal ipv4_fcnal_runtime ipv4_large_grp ipv4_compat_mode ipv4_fdb_grp_fcnal ipv4_torture"
> +IPV6_TESTS="ipv6_fcnal ipv6_grp_fcnal ipv6_fcnal_runtime ipv6_large_grp ipv6_compat_mode ipv6_fdb_grp_fcnal ipv6_torture"
>  
>  ALL_TESTS="basic ${IPV4_TESTS} ${IPV6_TESTS}"
>  TESTS="${ALL_TESTS}"
> @@ -767,6 +767,62 @@ ipv6_large_grp()
>  	$IP nexthop flush >/dev/null 2>&1
>  }
>  
> +ipv6_del_add_loop1()
> +{
> +	while :; do
> +		$IP nexthop del id 100
> +		$IP nexthop add id 100 via 2001:db8:91::2 dev veth1
> +	done >/dev/null 2>&1
> +}
> +
> +ipv6_grp_replace_loop()
> +{
> +	while :; do
> +		$IP nexthop replace id 102 group 100/101
> +	done >/dev/null 2>&1
> +}
> +
> +ipv6_torture()
> +{
> +	local pid1
> +	local pid2
> +	local pid3
> +	local pid4
> +	local pid5
> +
> +	echo
> +	echo "IPv6 runtime torture"
> +	echo "--------------------"
> +	if [ ! -x "$(command -v mausezahn)" ]; then
> +		echo "SKIP: Could not run test; need mausezahn tool"
> +		return
> +	fi
> +
> +	run_cmd "$IP nexthop add id 100 via 2001:db8:91::2 dev veth1"
> +	run_cmd "$IP nexthop add id 101 via 2001:db8:92::2 dev veth3"
> +	run_cmd "$IP nexthop add id 102 group 100/101"
> +	run_cmd "$IP route add 2001:db8:101::1 nhid 102"
> +	run_cmd "$IP route add 2001:db8:101::2 nhid 102"
> +
> +	ipv6_del_add_loop1 &
> +	pid1=$!
> +	ipv6_grp_replace_loop &
> +	pid2=$!
> +	ip netns exec me ping -f 2001:db8:101::1 >/dev/null 2>&1 &
> +	pid3=$!
> +	ip netns exec me ping -f 2001:db8:101::2 >/dev/null 2>&1 &
> +	pid4=$!
> +	ip netns exec me mausezahn veth1 -B 2001:db8:101::2 -A 2001:db8:91::1 -c 0 -t tcp "dp=1-1023, flags=syn" >/dev/null 2>&1 &
> +	pid5=$!
> +
> +	sleep 300
> +	kill -9 $pid1 $pid2 $pid3 $pid4 $pid5
> +
> +	# if we did not crash, success
> +	log_test 0 0 "IPv6 torture test"
> +}
> +
> +
>  ipv4_fcnal()
>  {
>  	local rc
> @@ -1313,6 +1369,61 @@ ipv4_compat_mode()
>  	sysctl_nexthop_compat_mode_set 1 "IPv4"
>  }
>  
> +ipv4_del_add_loop1()
> +{
> +	while :; do
> +		$IP nexthop del id 100
> +		$IP nexthop add id 100 via 172.16.1.2 dev veth1
> +	done >/dev/null 2>&1
> +}
> +
> +ipv4_grp_replace_loop()
> +{
> +	while :; do
> +		$IP nexthop replace id 102 group 100/101
> +	done >/dev/null 2>&1
> +}
> +
> +ipv4_torture()
> +{
> +	local pid1
> +	local pid2
> +	local pid3
> +	local pid4
> +	local pid5
> +
> +	echo
> +	echo "IPv4 runtime torture"
> +	echo "--------------------"
> +	if [ ! -x "$(command -v mausezahn)" ]; then
> +		echo "SKIP: Could not run test; need mausezahn tool"
> +		return
> +	fi
> +
> +	run_cmd "$IP nexthop add id 100 via 172.16.1.2 dev veth1"
> +	run_cmd "$IP nexthop add id 101 via 172.16.2.2 dev veth3"
> +	run_cmd "$IP nexthop add id 102 group 100/101"
> +	run_cmd "$IP route add 172.16.101.1 nhid 102"
> +	run_cmd "$IP route add 172.16.101.2 nhid 102"
> +
> +	ipv4_del_add_loop1 &
> +	pid1=$!
> +	ipv4_grp_replace_loop &
> +	pid2=$!
> +	ip netns exec me ping -f 172.16.101.1 >/dev/null 2>&1 &
> +	pid3=$!
> +	ip netns exec me ping -f 172.16.101.2 >/dev/null 2>&1 &
> +	pid4=$!
> +	ip netns exec me mausezahn veth1 -B 172.16.101.2 -A 172.16.1.1 -c 0 -t tcp "dp=1-1023, flags=syn" >/dev/null 2>&1 &
> +	pid5=$!
> +
> +	sleep 300
> +	kill -9 $pid1 $pid2 $pid3 $pid4 $pid5
> +
> +	# if we did not crash, success
> +	log_test 0 0 "IPv4 torture test"
> +}
> +
>  basic()
>  {
>  	echo
> 


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

* Re: [PATCH net-next] selftests: Add torture tests to nexthop tests
  2020-05-28  0:03 [PATCH net-next] selftests: Add torture tests to nexthop tests David Ahern
  2020-05-28  8:53 ` Nikolay Aleksandrov
@ 2020-05-28 18:00 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-05-28 18:00 UTC (permalink / raw)
  To: dsahern; +Cc: netdev, kuba

From: David Ahern <dsahern@kernel.org>
Date: Wed, 27 May 2020 18:03:44 -0600

> Add Nik's torture tests as a new set to stress the replace and cleanup
> paths.
> 
> Torture test created by Nikolay Aleksandrov and then I adapted to
> selftest and added IPv6 version.
> 
> Signed-off-by: David Ahern <dsahern@kernel.org>

Applied, thanks David.

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

end of thread, other threads:[~2020-05-28 18:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-28  0:03 [PATCH net-next] selftests: Add torture tests to nexthop tests David Ahern
2020-05-28  8:53 ` Nikolay Aleksandrov
2020-05-28 18:00 ` 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).