[PATCH mptcp-next v3 01/12] Squash to "selftests: mptcp: Add tests for userspace PM type"

Matthieu Baerts posted 12 patches 3 years, 11 months ago
Maintainers: "David S. Miller" <davem@davemloft.net>, Mat Martineau <mathew.j.martineau@linux.intel.com>, Shuah Khan <shuah@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Matthieu Baerts <matthieu.baerts@tessares.net>
There is a newer version of this series
[PATCH mptcp-next v3 01/12] Squash to "selftests: mptcp: Add tests for userspace PM type"
Posted by Matthieu Baerts 3 years, 11 months ago
Commit 34aa6e3bccd8 ("selftests: mptcp: add ip mptcp wrappers") has been
applied in net-next before this other patch.

It is then needed to do the same modifications in the userspace tests as
well.

While at it, a new helper has been added to avoid long 'ip netns exec'
commands as suggested by Paolo.

Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---

Notes:
    to be squashed in "selftests: mptcp: Add tests for userspace PM type"

 .../testing/selftests/net/mptcp/mptcp_join.sh | 57 +++++++++++--------
 1 file changed, 32 insertions(+), 25 deletions(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index ef57a28cf722..e2d56a5bcaf4 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -1448,6 +1448,13 @@ wait_attempt_fail()
 	return 1
 }
 
+set_userspace_pm()
+{
+	local ns=$1
+
+	ip netns exec $ns sysctl -q net.mptcp.pm_type=1
+}
+
 subflows_tests()
 {
 	reset
@@ -2468,59 +2475,59 @@ userspace_tests()
 {
 	# userspace pm type prevents add_addr
 	reset
-	ip netns exec $ns1 sysctl -q net.mptcp.pm_type=1
-	ip netns exec $ns1 ./pm_nl_ctl limits 0 2
-	ip netns exec $ns2 ./pm_nl_ctl limits 0 2
-	ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
+	set_userspace_pm $ns1
+	pm_nl_set_limits $ns1 0 2
+	pm_nl_set_limits $ns2 0 2
+	pm_nl_add_endpoint $ns1 10.0.2.1 flags signal
 	run_tests $ns1 $ns2 10.0.1.1
 	chk_join_nr "userspace pm type prevents add_addr" 0 0 0
 	chk_add_nr 0 0
 
 	# userspace pm type echoes add_addr
 	reset
-	ip netns exec $ns2 sysctl -q net.mptcp.pm_type=1
-	ip netns exec $ns1 ./pm_nl_ctl limits 0 2
-	ip netns exec $ns2 ./pm_nl_ctl limits 0 2
-	ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
+	set_userspace_pm $ns2
+	pm_nl_set_limits $ns1 0 2
+	pm_nl_set_limits $ns2 0 2
+	pm_nl_add_endpoint $ns1 10.0.2.1 flags signal
 	run_tests $ns1 $ns2 10.0.1.1
 	chk_join_nr "userspace pm type echoes add_addr" 0 0 0
 	chk_add_nr 1 1
 
 	# userspace pm type rejects join
 	reset
-	ip netns exec $ns1 sysctl -q net.mptcp.pm_type=1
-	ip netns exec $ns1 ./pm_nl_ctl limits 1 1
-	ip netns exec $ns2 ./pm_nl_ctl limits 1 1
-	ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
+	set_userspace_pm $ns1
+	pm_nl_set_limits $ns1 1 1
+	pm_nl_set_limits $ns2 1 1
+	pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow
 	run_tests $ns1 $ns2 10.0.1.1
 	chk_join_nr "userspace pm type rejects join" 1 1 0
 
 	# userspace pm type does not send join
 	reset
-	ip netns exec $ns2 sysctl -q net.mptcp.pm_type=1
-	ip netns exec $ns1 ./pm_nl_ctl limits 1 1
-	ip netns exec $ns2 ./pm_nl_ctl limits 1 1
-	ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
+	set_userspace_pm $ns2
+	pm_nl_set_limits $ns1 1 1
+	pm_nl_set_limits $ns2 1 1
+	pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow
 	run_tests $ns1 $ns2 10.0.1.1
 	chk_join_nr "userspace pm type does not send join" 0 0 0
 
 	# userspace pm type prevents mp_prio
 	reset
-	ip netns exec $ns1 sysctl -q net.mptcp.pm_type=1
-	ip netns exec $ns1 ./pm_nl_ctl limits 1 1
-	ip netns exec $ns2 ./pm_nl_ctl limits 1 1
-	ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
+	set_userspace_pm $ns1
+	pm_nl_set_limits $ns1 1 1
+	pm_nl_set_limits $ns2 1 1
+	pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow
 	run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow backup
 	chk_join_nr "userspace pm type prevents mp_prio" 1 1 0
 	chk_prio_nr 0 0
 
 	# userspace pm type prevents rm_addr
 	reset
-	ip netns exec $ns1 sysctl -q net.mptcp.pm_type=1
-	ip netns exec $ns2 sysctl -q net.mptcp.pm_type=1
-	ip netns exec $ns1 ./pm_nl_ctl limits 0 1
-	ip netns exec $ns2 ./pm_nl_ctl limits 0 1
-	ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
+	set_userspace_pm $ns1
+	set_userspace_pm $ns2
+	pm_nl_set_limits $ns1 0 1
+	pm_nl_set_limits $ns2 0 1
+	pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow
 	run_tests $ns1 $ns2 10.0.1.1 0 0 -1 slow
 	chk_join_nr "userspace pm type prevents rm_addr" 0 0 0
 	chk_rm_nr 0 0
-- 
2.34.1


Re: [PATCH mptcp-next v3 01/12] Squash to "selftests: mptcp: Add tests for userspace PM type"
Posted by Geliang Tang 3 years, 11 months ago
Matthieu Baerts <matthieu.baerts@tessares.net> 于2022年2月24日周四 21:56写道:
>
> Commit 34aa6e3bccd8 ("selftests: mptcp: add ip mptcp wrappers") has been
> applied in net-next before this other patch.
>
> It is then needed to do the same modifications in the userspace tests as
> well.
>
> While at it, a new helper has been added to avoid long 'ip netns exec'
> commands as suggested by Paolo.
>
> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>

Acked-by: Geliang Tang <geliang.tang@suse.com>

> ---
>
> Notes:
>     to be squashed in "selftests: mptcp: Add tests for userspace PM type"
>
>  .../testing/selftests/net/mptcp/mptcp_join.sh | 57 +++++++++++--------
>  1 file changed, 32 insertions(+), 25 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> index ef57a28cf722..e2d56a5bcaf4 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> @@ -1448,6 +1448,13 @@ wait_attempt_fail()
>         return 1
>  }
>
> +set_userspace_pm()
> +{
> +       local ns=$1
> +
> +       ip netns exec $ns sysctl -q net.mptcp.pm_type=1
> +}
> +
>  subflows_tests()
>  {
>         reset
> @@ -2468,59 +2475,59 @@ userspace_tests()
>  {
>         # userspace pm type prevents add_addr
>         reset
> -       ip netns exec $ns1 sysctl -q net.mptcp.pm_type=1
> -       ip netns exec $ns1 ./pm_nl_ctl limits 0 2
> -       ip netns exec $ns2 ./pm_nl_ctl limits 0 2
> -       ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
> +       set_userspace_pm $ns1
> +       pm_nl_set_limits $ns1 0 2
> +       pm_nl_set_limits $ns2 0 2
> +       pm_nl_add_endpoint $ns1 10.0.2.1 flags signal
>         run_tests $ns1 $ns2 10.0.1.1
>         chk_join_nr "userspace pm type prevents add_addr" 0 0 0
>         chk_add_nr 0 0
>
>         # userspace pm type echoes add_addr
>         reset
> -       ip netns exec $ns2 sysctl -q net.mptcp.pm_type=1
> -       ip netns exec $ns1 ./pm_nl_ctl limits 0 2
> -       ip netns exec $ns2 ./pm_nl_ctl limits 0 2
> -       ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
> +       set_userspace_pm $ns2
> +       pm_nl_set_limits $ns1 0 2
> +       pm_nl_set_limits $ns2 0 2
> +       pm_nl_add_endpoint $ns1 10.0.2.1 flags signal
>         run_tests $ns1 $ns2 10.0.1.1
>         chk_join_nr "userspace pm type echoes add_addr" 0 0 0
>         chk_add_nr 1 1
>
>         # userspace pm type rejects join
>         reset
> -       ip netns exec $ns1 sysctl -q net.mptcp.pm_type=1
> -       ip netns exec $ns1 ./pm_nl_ctl limits 1 1
> -       ip netns exec $ns2 ./pm_nl_ctl limits 1 1
> -       ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
> +       set_userspace_pm $ns1
> +       pm_nl_set_limits $ns1 1 1
> +       pm_nl_set_limits $ns2 1 1
> +       pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow
>         run_tests $ns1 $ns2 10.0.1.1
>         chk_join_nr "userspace pm type rejects join" 1 1 0
>
>         # userspace pm type does not send join
>         reset
> -       ip netns exec $ns2 sysctl -q net.mptcp.pm_type=1
> -       ip netns exec $ns1 ./pm_nl_ctl limits 1 1
> -       ip netns exec $ns2 ./pm_nl_ctl limits 1 1
> -       ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
> +       set_userspace_pm $ns2
> +       pm_nl_set_limits $ns1 1 1
> +       pm_nl_set_limits $ns2 1 1
> +       pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow
>         run_tests $ns1 $ns2 10.0.1.1
>         chk_join_nr "userspace pm type does not send join" 0 0 0
>
>         # userspace pm type prevents mp_prio
>         reset
> -       ip netns exec $ns1 sysctl -q net.mptcp.pm_type=1
> -       ip netns exec $ns1 ./pm_nl_ctl limits 1 1
> -       ip netns exec $ns2 ./pm_nl_ctl limits 1 1
> -       ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
> +       set_userspace_pm $ns1
> +       pm_nl_set_limits $ns1 1 1
> +       pm_nl_set_limits $ns2 1 1
> +       pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow
>         run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow backup
>         chk_join_nr "userspace pm type prevents mp_prio" 1 1 0
>         chk_prio_nr 0 0
>
>         # userspace pm type prevents rm_addr
>         reset
> -       ip netns exec $ns1 sysctl -q net.mptcp.pm_type=1
> -       ip netns exec $ns2 sysctl -q net.mptcp.pm_type=1
> -       ip netns exec $ns1 ./pm_nl_ctl limits 0 1
> -       ip netns exec $ns2 ./pm_nl_ctl limits 0 1
> -       ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
> +       set_userspace_pm $ns1
> +       set_userspace_pm $ns2
> +       pm_nl_set_limits $ns1 0 1
> +       pm_nl_set_limits $ns2 0 1
> +       pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow
>         run_tests $ns1 $ns2 10.0.1.1 0 0 -1 slow
>         chk_join_nr "userspace pm type prevents rm_addr" 0 0 0
>         chk_rm_nr 0 0
> --
> 2.34.1
>
>