[PATCH mptcp-next v3 07/29] selftests: mptcp: display simult in extra_msg

Geliang Tang posted 29 patches 2 years, 4 months ago
Maintainers: Matthieu Baerts <matthieu.baerts@tessares.net>, 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>, Florian Westphal <fw@strlen.de>, Kishen Maloor <kishen.maloor@intel.com>
There is a newer version of this series
[PATCH mptcp-next v3 07/29] selftests: mptcp: display simult in extra_msg
Posted by Geliang Tang 2 years, 4 months ago
Just like displaying "invert" after "Info: ", "simult" should be
displayed too when rm_subflow_nr dosen't match the expect value in
chk_rm_nr():

      syn                                 [ ok ]
      synack                              [ ok ]
      ack                                 [ ok ]
      add                                 [ ok ]
      echo                                [ ok ]
      rm                                  [ ok ]
      rmsf                                [ ok ] 3 in [2:4]
      Info: invert simult

      syn                                 [ ok ]
      synack                              [ ok ]
      ack                                 [ ok ]
      add                                 [ ok ]
      echo                                [ ok ]
      rm                                  [ ok ]
      rmsf                                [ ok ]
      Info: invert

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

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index ee1f89a872b3..d02e53be8b31 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -1766,7 +1766,9 @@ chk_rm_nr()
 		# in case of simult flush, the subflow removal count on each side is
 		# unreliable
 		count=$((count + cnt))
-		[ "$count" != "$rm_subflow_nr" ] && suffix="$count in [$rm_subflow_nr:$((rm_subflow_nr*2))]"
+		[ "$count" != "$rm_subflow_nr" ] && \
+			suffix="$count in [$rm_subflow_nr:$((rm_subflow_nr*2))]" && \
+			extra_msg="$extra_msg simult"
 		if [ $count -ge "$rm_subflow_nr" ] && \
 		   [ "$count" -le "$((rm_subflow_nr *2 ))" ]; then
 			print_ok "$suffix"
-- 
2.35.3
Re: [PATCH mptcp-next v3 07/29] selftests: mptcp: display simult in extra_msg
Posted by Matthieu Baerts 2 years, 4 months ago
Hi Geliang,

On 25/09/2023 10:41, Geliang Tang wrote:
> Just like displaying "invert" after "Info: ", "simult" should be
> displayed too when rm_subflow_nr dosen't match the expect value in
> chk_rm_nr():
> 
>       syn                                 [ ok ]
>       synack                              [ ok ]
>       ack                                 [ ok ]
>       add                                 [ ok ]
>       echo                                [ ok ]
>       rm                                  [ ok ]
>       rmsf                                [ ok ] 3 in [2:4]
>       Info: invert simult
> 
>       syn                                 [ ok ]
>       synack                              [ ok ]
>       ack                                 [ ok ]
>       add                                 [ ok ]
>       echo                                [ ok ]
>       rm                                  [ ok ]
>       rmsf                                [ ok ]
>       Info: invert
> 
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
>  tools/testing/selftests/net/mptcp/mptcp_join.sh | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> index ee1f89a872b3..d02e53be8b31 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> @@ -1766,7 +1766,9 @@ chk_rm_nr()
>  		# in case of simult flush, the subflow removal count on each side is
>  		# unreliable
>  		count=$((count + cnt))
> -		[ "$count" != "$rm_subflow_nr" ] && suffix="$count in [$rm_subflow_nr:$((rm_subflow_nr*2))]"
> +		[ "$count" != "$rm_subflow_nr" ] && \
> +			suffix="$count in [$rm_subflow_nr:$((rm_subflow_nr*2))]" && \
> +			extra_msg="$extra_msg simult"

Good idea!

I think it would be clearer to use an explicit "if":

  if [ "$count" != "$rm_subflow_nr" ]; then
      (...)

I can do the modification when applying the patch if needed.

Cheers,
Matt

>  		if [ $count -ge "$rm_subflow_nr" ] && \
>  		   [ "$count" -le "$((rm_subflow_nr *2 ))" ]; then
>  			print_ok "$suffix"

-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net