[PATCH mptcp-next] Squash to "selftests: mptcp: add mptcp_lib_get_counter"

Geliang Tang posted 1 patch 5 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/7cb131ce1dae4445c05b2955744c63a2d8a1c058.1699275225.git.geliang.tang@suse.com
Maintainers: Matthieu Baerts <matttbe@kernel.org>, Mat Martineau <martineau@kernel.org>, "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
tools/testing/selftests/net/mptcp/userspace_pm.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH mptcp-next] Squash to "selftests: mptcp: add mptcp_lib_get_counter"
Posted by Geliang Tang 5 months, 3 weeks ago
Please add this line into the commit log:

'''
Use this helper in test_prio() in userspace_pm.sh too instead of
open-coding.
'''

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

diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh
index f9156f544ebf..8d95ea94c019 100755
--- a/tools/testing/selftests/net/mptcp/userspace_pm.sh
+++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh
@@ -874,7 +874,7 @@ test_prio()
 
 	# Check TX
 	print_test "MP_PRIO TX"
-	count=$(ip netns exec "$ns2" nstat -as | grep MPTcpExtMPPrioTx | awk '{print $2}')
+	count=$(mptcp_lib_get_counter "$ns2" "MPTcpExtMPPrioTx")
 	[ -z "$count" ] && count=0
 	if [ $count != 1 ]; then
 		test_fail "Count != 1: ${count}"
@@ -884,7 +884,7 @@ test_prio()
 
 	# Check RX
 	print_test "MP_PRIO RX"
-	count=$(ip netns exec "$ns1" nstat -as | grep MPTcpExtMPPrioRx | awk '{print $2}')
+	count=$(mptcp_lib_get_counter "$ns1" "MPTcpExtMPPrioRx")
 	[ -z "$count" ] && count=0
 	if [ $count != 1 ]; then
 		test_fail "Count != 1: ${count}"
-- 
2.35.3
Re: [PATCH mptcp-next] Squash to "selftests: mptcp: add mptcp_lib_get_counter"
Posted by Matthieu Baerts 5 months, 3 weeks ago
Hi Geliang,

On 06/11/2023 13:55, Geliang Tang wrote:
> Please add this line into the commit log:
> 
> '''
> Use this helper in test_prio() in userspace_pm.sh too instead of
> open-coding.
> '''

Good idea!

> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
>  tools/testing/selftests/net/mptcp/userspace_pm.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh
> index f9156f544ebf..8d95ea94c019 100755
> --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh
> +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh
> @@ -874,7 +874,7 @@ test_prio()
>  
>  	# Check TX
>  	print_test "MP_PRIO TX"
> -	count=$(ip netns exec "$ns2" nstat -as | grep MPTcpExtMPPrioTx | awk '{print $2}')
> +	count=$(mptcp_lib_get_counter "$ns2" "MPTcpExtMPPrioTx")
>  	[ -z "$count" ] && count=0

mptcp_lib_get_counter() should only return an empty string if the
counter doesn't exist on the tested kernel. So if you use this helper,
it doesn't really make sense to have this check. Or keep it and skip the
test.

>  	if [ $count != 1 ]; then

So I think it would be better to follow the same style as in mptcp_join.sh:

  count=$(mptcp_lib_get_counter ...)
  if [ -z "$count" ]; then
          print_skip
  elif [ "$count" != (...) ]; then
          (...)

WDYT?

>  		test_fail "Count != 1: ${count}"
> @@ -884,7 +884,7 @@ test_prio()
>  
>  	# Check RX
>  	print_test "MP_PRIO RX"
> -	count=$(ip netns exec "$ns1" nstat -as | grep MPTcpExtMPPrioRx | awk '{print $2}')
> +	count=$(mptcp_lib_get_counter "$ns1" "MPTcpExtMPPrioRx")
>  	[ -z "$count" ] && count=0
>  	if [ $count != 1 ]; then

Same here.

>  		test_fail "Count != 1: ${count}"

Cheers,
Matt