Skip to contentSkip to conversation

mptcp: selftests: Fix timeouts and test isolation

PATCH Applied Mat Martineau 2 participants 5 messages Nov 15, 2022 – Nov 18, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover mptcp: selftests: Fix timeouts and test isolation

Patches 1 and 3 adjust test timeouts to reduce false negatives on slow machines.

Patch 2 improves test isolation by running the mptcp_sockopt test in its own net namespace.

Matthieu Baerts (2):
selftests: mptcp: run mptcp_sockopt from a new netns
selftests: mptcp: fix mibit vs mbit mix up

Paolo Abeni (1):
selftests: mptcp: gives slow test-case more time

 tools/testing/selftests/net/mptcp/mptcp_join.sh    | 6 +++---
 tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 9 +++++----
 tools/testing/selftests/net/mptcp/simult_flows.sh  | 5 +++--
 3 files changed, 11 insertions(+), 9 deletions(-)

base-commit: 9d45921ee4cb364910097e7d1b7558559c2f9fd2

Signature · 1 line
2.38.1
#1 lore raw

PATCH 1/3 selftests: mptcp: gives slow test-case more time

From: Paolo Abeni <[email protected]>

On slow or busy VM, some test-cases still fail because the data transfer completes before the endpoint manipulation actually took effect.

Address the issue by artificially increasing the runtime for the relevant test-cases.

Fixes ef360019db40 ("selftests: mptcp: signal addresses testcases")
---
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -3
index f3dd5f2a0272..2eeaf4aca644 100755
@@ -2152,7 +2152,7 @@ remove_tests()
 		pm_nl_set_limits $ns2 1 3
 		pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow
 		pm_nl_add_endpoint $ns2 10.0.4.2 flags subflow
-		run_tests $ns1 $ns2 10.0.1.1 0 -1 -2 slow
+		run_tests $ns1 $ns2 10.0.1.1 0 -1 -2 speed_10
 		chk_join_nr 3 3 3
 		chk_add_nr 1 1
 		chk_rm_nr 2 2
@@ -2165,7 +2165,7 @@ remove_tests()
 		pm_nl_add_endpoint $ns1 10.0.3.1 flags signal
 		pm_nl_add_endpoint $ns1 10.0.4.1 flags signal
 		pm_nl_set_limits $ns2 3 3
-		run_tests $ns1 $ns2 10.0.1.1 0 -3 0 slow
+		run_tests $ns1 $ns2 10.0.1.1 0 -3 0 speed_10
 		chk_join_nr 3 3 3
 		chk_add_nr 3 3
 		chk_rm_nr 3 3 invert
@@ -2178,7 +2178,7 @@ remove_tests()
 		pm_nl_add_endpoint $ns1 10.0.3.1 flags signal
 		pm_nl_add_endpoint $ns1 10.0.14.1 flags signal
 		pm_nl_set_limits $ns2 3 3
-		run_tests $ns1 $ns2 10.0.1.1 0 -3 0 slow
+		run_tests $ns1 $ns2 10.0.1.1 0 -3 0 speed_10
 		chk_join_nr 1 1 1
 		chk_add_nr 3 3
 		chk_rm_nr 3 1 invert
Signature · 1 line
2.38.1
#2 lore raw

PATCH 2/3 selftests: mptcp: run mptcp_sockopt from a new netns

In reply to Mat Martineau

From: Matthieu Baerts <[email protected]>

Not running it from a new netns causes issues if some MPTCP settings are modified, e.g. if MPTCP is disabled from the sysctl knob, if multiple addresses are available and added to the MPTCP path-manager, etc.

In these cases, the created connection will not behave as expected, e.g. unable to create an MPTCP socket, more than one subflow is seen, etc.

A new "sandbox" net namespace is now created and used to run mptcp_sockopt from this controlled environment.

Fixes ce9979129a0b ("selftests: mptcp: add mptcp getsockopt test cases")
---
 tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +5 -4
index 0879da915014..80d36f7cfee8 100755
@@ -35,8 +35,9 @@ init()
 
 	ns1="ns1-$rndh"
 	ns2="ns2-$rndh"
+	ns_sbox="ns_sbox-$rndh"
 
-	for netns in "$ns1" "$ns2";do
+	for netns in "$ns1" "$ns2" "$ns_sbox";do
 		ip netns add $netns || exit $ksft_skip
 		ip -net $netns link set lo up
 		ip netns exec $netns sysctl -q net.mptcp.enabled=1
@@ -73,7 +74,7 @@ init()
 
 cleanup()
 {
-	for netns in "$ns1" "$ns2"; do
+	for netns in "$ns1" "$ns2" "$ns_sbox"; do
 		ip netns del $netns
 	done
 	rm -f "$cin" "$cout"
@@ -243,7 +244,7 @@ do_mptcp_sockopt_tests()
 {
 	local lret=0
 
-	./mptcp_sockopt
+	ip netns exec "$ns_sbox" ./mptcp_sockopt
 	lret=$?
 
 	if [ $lret -ne 0 ]; then
@@ -252,7 +253,7 @@ do_mptcp_sockopt_tests()
 		return
 	fi
 
-	./mptcp_sockopt -6
+	ip netns exec "$ns_sbox" ./mptcp_sockopt -6
 	lret=$?
 
 	if [ $lret -ne 0 ]; then
Signature · 1 line
2.38.1
#3 lore raw

PATCH 3/3 selftests: mptcp: fix mibit vs mbit mix up

In reply to Mat Martineau

From: Matthieu Baerts <[email protected]>

The estimated time was supposing the rate was expressed in mibit (bit * 1024^2) but it is in mbit (bit * 1000^2).

This makes the threshold higher but in a more realistic way to avoid false positives reported by CI instances.

Before this patch, the thresholds were at 7561/4005ms and now they are at 7906/4178ms.

While at it, also fix a typo in the linked comment, spotted by Mat.

---
 tools/testing/selftests/net/mptcp/simult_flows.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/net/mptcp/simult_flows.sh +3 -2
index ffa13a957a36..40aeb5a71a2a 100755
@@ -247,9 +247,10 @@ run_test()
 	tc -n $ns2 qdisc add dev ns2eth1 root netem rate ${rate1}mbit $delay1
 	tc -n $ns2 qdisc add dev ns2eth2 root netem rate ${rate2}mbit $delay2
 
-	# time is measured in ms, account for transfer size, affegated link speed
+	# time is measured in ms, account for transfer size, aggregated link speed
 	# and header overhead (10%)
-	local time=$((size * 8 * 1000 * 10 / (( $rate1 + $rate2) * 1024 *1024 * 9) ))
+	#              ms    byte -> bit   10%        mbit      -> kbit -> bit  10%
+	local time=$((1000 * size  *  8  * 10 / ((rate1 + rate2) * 1000 * 1000 * 9) ))
 
 	# mptcp_connect will do some sleeps to allow the mp_join handshake
 	# completion (see mptcp_connect): 200ms on each side, add some slack
Signature · 1 line
2.38.1
#4 lore raw
In reply to Mat Martineau
This series was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:

Quoted 11 lines · On Tue, 15 Nov 2022 14:10:43 -0800 you wrote:

Patches 1 and 3 adjust test timeouts to reduce false negatives on slow machines.

Patch 2 improves test isolation by running the mptcp_sockopt test in its own net namespace.

Matthieu Baerts (2):
selftests: mptcp: run mptcp_sockopt from a new netns
selftests: mptcp: fix mibit vs mbit mix up

[...]

Here is the summary with links:
- [net,1/3] selftests: mptcp: gives slow test-case more time

    https://git.kernel.org/netdev/net/c/22b29557aef3
  - [net,2/3] selftests: mptcp: run mptcp_sockopt from a new netns
    https://git.kernel.org/netdev/net/c/7e68d31020f1
  - [net,3/3] selftests: mptcp: fix mibit vs mbit mix up
    https://git.kernel.org/netdev/net/c/3de88b95c4d4

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html