[PATCH mptcp-next v5 7/7] selftests: mptcp: check userspace mptcp_info

Geliang Tang posted 7 patches 1 year, 2 months ago
Maintainers: Matthieu Baerts <matthieu.baerts@tessares.net>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Shuah Khan <shuah@kernel.org>
There is a newer version of this series
[PATCH mptcp-next v5 7/7] selftests: mptcp: check userspace mptcp_info
Posted by Geliang Tang 1 year, 2 months ago
This patch invokes chk_mptcp_info() to check mptcp_info of userspace PM.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 506120401abe..8ca5accd5c82 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -842,8 +842,11 @@ do_transfer()
 				tk=$(grep "type:1," "$evts_ns1" |
 				     sed -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q')
 				ip netns exec ${listener_ns} ./pm_nl_ctl ann $addr token $tk id $id
+				chk_mptcp_info subflows_1
 				sleep 1
 				ip netns exec ${listener_ns} ./pm_nl_ctl rem token $tk id $id
+				sleep 1
+				chk_mptcp_info subflows_0
 			fi
 
 			counter=$((counter + 1))
@@ -906,11 +909,14 @@ do_transfer()
 				dp=$(sed -n 's/.*\(dport:\)\([[:digit:]]*\).*$/\2/p;q' "$evts_ns2")
 				ip netns exec ${connector_ns} ./pm_nl_ctl csf lip $addr lid $id \
 									rip $da rport $dp token $tk
+				chk_mptcp_info subflows_1
 				sleep 1
 				sp=$(grep "type:10" "$evts_ns2" |
 				     sed -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q')
 				ip netns exec ${connector_ns} ./pm_nl_ctl dsf lip $addr lport $sp \
 									rip $da rport $dp token $tk
+				sleep 1
+				chk_mptcp_info subflows_0
 			fi
 			counter=$((counter + 1))
 			add_nr_ns2=$((add_nr_ns2 - 1))
@@ -3148,6 +3154,10 @@ endpoint_tests()
 		pm_nl_add_endpoint $ns2 10.0.2.2 flags signal
 		pm_nl_check_endpoint 0 "modif is allowed" \
 			$ns2 10.0.2.2 id 1 flags signal
+
+		chk_mptcp_info subflows_1
+		pm_nl_del_endpoint $ns2 1 10.0.2.2
+		chk_mptcp_info subflows_0
 		kill_tests_wait
 	fi
 
-- 
2.35.3
Re: [PATCH mptcp-next v5 7/7] selftests: mptcp: check userspace mptcp_info
Posted by Matthieu Baerts 1 year, 2 months ago
Hi Geliang,

On 14/03/2023 08:31, Geliang Tang wrote:
> This patch invokes chk_mptcp_info() to check mptcp_info of userspace PM.
> 
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
>  tools/testing/selftests/net/mptcp/mptcp_join.sh | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> index 506120401abe..8ca5accd5c82 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> @@ -842,8 +842,11 @@ do_transfer()
>  				tk=$(grep "type:1," "$evts_ns1" |
>  				     sed -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q')
>  				ip netns exec ${listener_ns} ./pm_nl_ctl ann $addr token $tk id $id
> +				chk_mptcp_info subflows_1

Will this not print message before displaying the title of the test?

>  				sleep 1
>  				ip netns exec ${listener_ns} ./pm_nl_ctl rem token $tk id $id
> +				sleep 1

I'm not a big fan of using a sleep here, it is a source of random timing
issues I guess.

Could it possible to wait for an event to stop waiting when this happens
but also with a possible higher limit in case the host running the test
is slow/busy.

Maybe you can use wait_rm_addr?

> +				chk_mptcp_info subflows_0
>  			fi
>  
>  			counter=$((counter + 1))
> @@ -906,11 +909,14 @@ do_transfer()
>  				dp=$(sed -n 's/.*\(dport:\)\([[:digit:]]*\).*$/\2/p;q' "$evts_ns2")
>  				ip netns exec ${connector_ns} ./pm_nl_ctl csf lip $addr lid $id \
>  									rip $da rport $dp token $tk
> +				chk_mptcp_info subflows_1

Same here for the print message before the title? (or maybe enough to
check in endpoint_tests()?)

>  				sleep 1
>  				sp=$(grep "type:10" "$evts_ns2" |
>  				     sed -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q')
>  				ip netns exec ${connector_ns} ./pm_nl_ctl dsf lip $addr lport $sp \
>  									rip $da rport $dp token $tk
> +				sleep 1

Same here with the sleep. Maybe a "wait_xxx" function?

> +				chk_mptcp_info subflows_0
>  			fi
>  			counter=$((counter + 1))
>  			add_nr_ns2=$((add_nr_ns2 - 1))
> @@ -3148,6 +3154,10 @@ endpoint_tests()
>  		pm_nl_add_endpoint $ns2 10.0.2.2 flags signal
>  		pm_nl_check_endpoint 0 "modif is allowed" \
>  			$ns2 10.0.2.2 id 1 flags signal
> +
> +		chk_mptcp_info subflows_1
> +		pm_nl_del_endpoint $ns2 1 10.0.2.2

Just to be sure: here, the userspace client will send the Netlink
message and wait for the kernel to do the action before stopping, right?
In other words, just after this line, the counter have been updated, no
need to wait?

> +		chk_mptcp_info subflows_0
>  		kill_tests_wait
>  	fi
>  

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
Re: [PATCH mptcp-next v5 7/7] selftests: mptcp: check userspace mptcp_info
Posted by Geliang Tang 1 year, 2 months ago
Geliang Tang <geliang.tang@suse.com> 于2023年3月14日周二 15:31写道:
>
> This patch invokes chk_mptcp_info() to check mptcp_info of userspace PM.
>
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
>  tools/testing/selftests/net/mptcp/mptcp_join.sh | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> index 506120401abe..8ca5accd5c82 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> @@ -842,8 +842,11 @@ do_transfer()
>                                 tk=$(grep "type:1," "$evts_ns1" |
>                                      sed -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q')
>                                 ip netns exec ${listener_ns} ./pm_nl_ctl ann $addr token $tk id $id
> +                               chk_mptcp_info subflows_1
>                                 sleep 1
>                                 ip netns exec ${listener_ns} ./pm_nl_ctl rem token $tk id $id
> +                               sleep 1
> +                               chk_mptcp_info subflows_0
>                         fi
>
>                         counter=$((counter + 1))
> @@ -906,11 +909,14 @@ do_transfer()
>                                 dp=$(sed -n 's/.*\(dport:\)\([[:digit:]]*\).*$/\2/p;q' "$evts_ns2")
>                                 ip netns exec ${connector_ns} ./pm_nl_ctl csf lip $addr lid $id \
>                                                                         rip $da rport $dp token $tk
> +                               chk_mptcp_info subflows_1
>                                 sleep 1
>                                 sp=$(grep "type:10" "$evts_ns2" |
>                                      sed -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q')
>                                 ip netns exec ${connector_ns} ./pm_nl_ctl dsf lip $addr lport $sp \
>                                                                         rip $da rport $dp token $tk
> +                               sleep 1
> +                               chk_mptcp_info subflows_0
>                         fi
>                         counter=$((counter + 1))
>                         add_nr_ns2=$((add_nr_ns2 - 1))
> @@ -3148,6 +3154,10 @@ endpoint_tests()
>                 pm_nl_add_endpoint $ns2 10.0.2.2 flags signal
>                 pm_nl_check_endpoint 0 "modif is allowed" \
>                         $ns2 10.0.2.2 id 1 flags signal
> +
> +               chk_mptcp_info subflows_1
> +               pm_nl_del_endpoint $ns2 1 10.0.2.2
> +               chk_mptcp_info subflows_0

These lines should be squashed to "selftests: mptcp: add mptcp_info tests".

-Geliang

>                 kill_tests_wait
>         fi
>
> --
> 2.35.3
>
>