MPTCP Linux Development
 help / color / mirror / Atom feed
From: Geliang Tang <geliang@kernel.org>
To: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>, mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v3 4/8] selftests: mptcp: join: one line for join check
Date: Fri, 09 Aug 2024 10:10:41 +0800	[thread overview]
Message-ID: <ffcd94a0d7154a93d6405c0402b0d01a015603b9.camel@kernel.org> (raw)
In-Reply-To: <20240806-mptcp-join-tx-mib-v3-4-c3b54d2099e9@kernel.org>

On Tue, 2024-08-06 at 13:18 +0200, Matthieu Baerts (NGI0) wrote:
> Most tests are checking if the expected number of SYN/SYN+ACK/ACK
> JOINs
> have been received, each of them on one line.
> 
> More Join related tests are going to be checked soon, no need to add
> 5
> new lines per test in case of success, just one is enough. In case of
> issue, the errors will still be reported like before.
> 
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> ---
>  tools/testing/selftests/net/mptcp/mptcp_join.sh | 45
> ++++++++++++++++---------
>  1 file changed, 30 insertions(+), 15 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> index 0401ba1aaf1b..b10bcb1ac970 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> @@ -202,6 +202,22 @@ print_skip()
>  	mptcp_lib_pr_skip "${@}"
>  }
>  
> +# $1: check name; $2: rc
> +print_results()
> +{
> +	local check="${1}"
> +	local rc=${2}
> +
> +	print_check "${check}"
> +	if [ ${rc} = ${KSFT_PASS} ]; then
> +		print_ok
> +	elif [ ${rc} = ${KSFT_SKIP} ]; then
> +		print_skip
> +	else
> +		fail_test

To align error messages, it's better to pass an empty string to
fail_test to make sure an "EOL" is printed out:

		fail_test ""

001 no JOIN
      syn rx                 [FAIL] got 0 JOIN[s] syn rx expected 1
      synack rx              [FAIL] got 0 JOIN[s] synack rx expected 1
      ack rx                 [FAIL] got 0 JOIN[s] ack rx expected 1
      join Rx                syn tx                              [FAIL]
got 0 JOIN[s] syn tx expected 1
      join Tx                002 single subflow, limited by client
      join Rx                             [ OK ]
      join Tx                             [ OK ]

->

001 no JOIN
      syn rx                 [FAIL] got 0 JOIN[s] syn rx 
      synack rx              [FAIL] got 0 JOIN[s] synack rx expected 1
      ack rx                 [FAIL] got 0 JOIN[s] ack rx expected 1
      join Rx                [FAIL]
      syn tx                 [FAIL] got 0 JOIN[s] syn tx expected 1
      join Tx                [FAIL]
002 single subflow, limited by client

WDYT?

Regards,
-Geliang

> +	fi
> +}
> +
>  # [ $1: fail msg ]
>  mark_as_skipped()
>  {
> @@ -1326,6 +1342,7 @@ chk_join_nr()
>  	local rst_nr=${join_rst_nr:-0}
>  	local infi_nr=${join_infi_nr:-0}
>  	local corrupted_pkts=${join_corrupted_pkts:-0}
> +	local rc=${KSFT_PASS}
>  	local count
>  	local with_cookie
>  
> @@ -1333,43 +1350,41 @@ chk_join_nr()
>  		print_info "${corrupted_pkts} corrupted pkts"
>  	fi
>  
> -	print_check "syn"
>  	count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinSynRx")
>  	if [ -z "$count" ]; then
> -		print_skip
> +		rc=${KSFT_SKIP}
>  	elif [ "$count" != "$syn_nr" ]; then
> +		rc=${KSFT_FAIL}
> +		print_check "syn"
>  		fail_test "got $count JOIN[s] syn expected $syn_nr"
> -	else
> -		print_ok
>  	fi
>  
> -	print_check "synack"
>  	with_cookie=$(ip netns exec $ns2 sysctl -n
> net.ipv4.tcp_syncookies)
>  	count=$(mptcp_lib_get_counter ${ns2}
> "MPTcpExtMPJoinSynAckRx")
>  	if [ -z "$count" ]; then
> -		print_skip
> +		rc=${KSFT_SKIP}
>  	elif [ "$count" != "$syn_ack_nr" ]; then
>  		# simult connections exceeding the limit with cookie
> enabled could go up to
>  		# synack validation as the conn limit can be
> enforced reliably only after
>  		# the subflow creation
> -		if [ "$with_cookie" = 2 ] && [ "$count" -gt
> "$syn_ack_nr" ] && [ "$count" -le "$syn_nr" ]; then
> -			print_ok
> -		else
> +		if [ "$with_cookie" != 2 ] || [ "$count" -le
> "$syn_ack_nr" ] || [ "$count" -gt "$syn_nr" ]; then
> +			rc=${KSFT_FAIL}
> +			print_check "synack"
>  			fail_test "got $count JOIN[s] synack
> expected $syn_ack_nr"
>  		fi
> -	else
> -		print_ok
>  	fi
>  
> -	print_check "ack"
>  	count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinAckRx")
>  	if [ -z "$count" ]; then
> -		print_skip
> +		rc=${KSFT_SKIP}
>  	elif [ "$count" != "$ack_nr" ]; then
> +		rc=${KSFT_FAIL}
> +		print_check "ack"
>  		fail_test "got $count JOIN[s] ack expected $ack_nr"
> -	else
> -		print_ok
>  	fi
> +
> +	print_results "join Rx" ${rc}
> +
>  	if $validate_checksum; then
>  		chk_csum_nr $csum_ns1 $csum_ns2
>  		chk_fail_nr $fail_nr $fail_nr
> 


  reply	other threads:[~2024-08-09  2:10 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-06 11:18 [PATCH mptcp-next v3 0/8] mptcp: MIB counters for sent MP_JOIN Matthieu Baerts (NGI0)
2024-08-06 11:18 ` [PATCH mptcp-next v3 1/8] selftests: mptcp: join: no extra msg if no counter Matthieu Baerts (NGI0)
2024-08-08  2:38   ` Geliang Tang
2024-08-08 10:17     ` Matthieu Baerts
2024-08-09  2:30       ` Geliang Tang
2024-08-09 11:32         ` Matthieu Baerts
2024-08-09 11:52           ` Geliang Tang
2024-08-06 11:18 ` [PATCH mptcp-next v3 2/8] mptcp: MIB counters for sent MP_JOIN Matthieu Baerts (NGI0)
2024-08-08  2:46   ` Geliang Tang
2024-08-08 10:18     ` Matthieu Baerts
2024-08-06 11:18 ` [PATCH mptcp-next v3 3/8] selftests: mptcp: join: reduce join_nr params Matthieu Baerts (NGI0)
2024-08-08  3:28   ` Geliang Tang
2024-08-08 10:22     ` Matthieu Baerts
2024-08-09  2:32       ` Geliang Tang
2024-08-06 11:18 ` [PATCH mptcp-next v3 4/8] selftests: mptcp: join: one line for join check Matthieu Baerts (NGI0)
2024-08-09  2:10   ` Geliang Tang [this message]
2024-08-09 11:39     ` Matthieu Baerts
2024-08-06 11:18 ` [PATCH mptcp-next v3 5/8] selftests: mptcp: join: validate MPJ SYN TX MIB counters Matthieu Baerts (NGI0)
2024-08-09  2:21   ` Geliang Tang
2024-08-09 11:42     ` Matthieu Baerts
2024-08-06 11:18 ` [PATCH mptcp-next v3 6/8] selftests: mptcp: join: more explicit check name Matthieu Baerts (NGI0)
2024-08-09  2:00   ` Geliang Tang
2024-08-06 11:18 ` [PATCH mptcp-next v3 7/8] selftests: mptcp: join: specify host being checked Matthieu Baerts (NGI0)
2024-08-06 11:18 ` [PATCH mptcp-next v3 8/8] selftests: mptcp: join: mute errors when ran in the background Matthieu Baerts (NGI0)
2024-08-06 12:08 ` [PATCH mptcp-next v3 0/8] mptcp: MIB counters for sent MP_JOIN MPTCP CI

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ffcd94a0d7154a93d6405c0402b0d01a015603b9.camel@kernel.org \
    --to=geliang@kernel.org \
    --cc=matttbe@kernel.org \
    --cc=mptcp@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox