[PATCH mptcp-net 1/2] selftests: mptcp: join: correctly check for no RST

Matthieu Baerts posted 2 patches 2 years, 4 months ago
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
[PATCH mptcp-net 1/2] selftests: mptcp: join: correctly check for no RST
Posted by Matthieu Baerts 2 years, 4 months ago
The commit mentioned below was more tolerant with the number of RST seen
during a test because in some uncontrollable situations, multiple RST
can be generated.

But it was not taking into account the case where no RST are expected:
this validation was then no longer reporting issues for the 0 RST case
because it is not possible to have less than 0 RST in the counter. This
patch fixes the issue by adding a specific condition.

Fixes: 6bf41020b72b ("selftests: mptcp: update and extend fastclose test-cases")
Signed-off-by: Matthieu Baerts <matttbe@kernel.org>
---
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index ae38b428e42e..01480663c102 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -1432,7 +1432,9 @@ chk_rst_nr()
 	count=$(get_counter ${ns_tx} "MPTcpExtMPRstTx")
 	if [ -z "$count" ]; then
 		print_skip
-	elif [ $count -lt $rst_tx ]; then
+	# accept more rst than expected except if we don't expect any
+	elif { [ $rst_tx -ne 0 ] && [ $count -lt $rst_tx ]; } ||
+	     { [ $rst_tx -eq 0 ] && [ $count -ne 0 ]; }; then
 		fail_test "got $count MP_RST[s] TX expected $rst_tx"
 	else
 		print_ok
@@ -1442,7 +1444,9 @@ chk_rst_nr()
 	count=$(get_counter ${ns_rx} "MPTcpExtMPRstRx")
 	if [ -z "$count" ]; then
 		print_skip
-	elif [ "$count" -lt "$rst_rx" ]; then
+	# accept more rst than expected except if we don't expect any
+	elif { [ $rst_rx -ne 0 ] && [ $count -lt $rst_rx ]; } ||
+	     { [ $rst_rx -eq 0 ] && [ $count -ne 0 ]; }; then
 		fail_test "got $count MP_RST[s] RX expected $rst_rx"
 	else
 		print_ok

-- 
2.40.1
Re: [PATCH mptcp-net 1/2] selftests: mptcp: join: correctly check for no RST
Posted by Mat Martineau 2 years, 4 months ago
On Tue, 10 Oct 2023, Matthieu Baerts wrote:

> The commit mentioned below was more tolerant with the number of RST seen
> during a test because in some uncontrollable situations, multiple RST
> can be generated.
>
> But it was not taking into account the case where no RST are expected:
> this validation was then no longer reporting issues for the 0 RST case
> because it is not possible to have less than 0 RST in the counter. This
> patch fixes the issue by adding a specific condition.
>
> Fixes: 6bf41020b72b ("selftests: mptcp: update and extend fastclose test-cases")
> Signed-off-by: Matthieu Baerts <matttbe@kernel.org>
> ---
> tools/testing/selftests/net/mptcp/mptcp_join.sh | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> index ae38b428e42e..01480663c102 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> @@ -1432,7 +1432,9 @@ chk_rst_nr()
> 	count=$(get_counter ${ns_tx} "MPTcpExtMPRstTx")
> 	if [ -z "$count" ]; then
> 		print_skip
> -	elif [ $count -lt $rst_tx ]; then
> +	# accept more rst than expected except if we don't expect any

That comment is tricky to say out loud :)

Patch 1 LGTM:

Reviewed-by: Mat Martineau <martineau@kernel.org>

> +	elif { [ $rst_tx -ne 0 ] && [ $count -lt $rst_tx ]; } ||
> +	     { [ $rst_tx -eq 0 ] && [ $count -ne 0 ]; }; then
> 		fail_test "got $count MP_RST[s] TX expected $rst_tx"
> 	else
> 		print_ok
> @@ -1442,7 +1444,9 @@ chk_rst_nr()
> 	count=$(get_counter ${ns_rx} "MPTcpExtMPRstRx")
> 	if [ -z "$count" ]; then
> 		print_skip
> -	elif [ "$count" -lt "$rst_rx" ]; then
> +	# accept more rst than expected except if we don't expect any
> +	elif { [ $rst_rx -ne 0 ] && [ $count -lt $rst_rx ]; } ||
> +	     { [ $rst_rx -eq 0 ] && [ $count -ne 0 ]; }; then
> 		fail_test "got $count MP_RST[s] RX expected $rst_rx"
> 	else
> 		print_ok
>
> -- 
> 2.40.1
>
>
>
Re: [PATCH mptcp-net 1/2] selftests: mptcp: join: correctly check for no RST
Posted by Matthieu Baerts 2 years, 4 months ago
Hi Mat,

On 11/10/2023 03:10, Mat Martineau wrote:
> On Tue, 10 Oct 2023, Matthieu Baerts wrote:
> 
>> The commit mentioned below was more tolerant with the number of RST seen
>> during a test because in some uncontrollable situations, multiple RST
>> can be generated.
>>
>> But it was not taking into account the case where no RST are expected:
>> this validation was then no longer reporting issues for the 0 RST case
>> because it is not possible to have less than 0 RST in the counter. This
>> patch fixes the issue by adding a specific condition.
>>
>> Fixes: 6bf41020b72b ("selftests: mptcp: update and extend fastclose
>> test-cases")
>> Signed-off-by: Matthieu Baerts <matttbe@kernel.org>
>> ---
>> tools/testing/selftests/net/mptcp/mptcp_join.sh | 8 ++++++--
>> 1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh
>> b/tools/testing/selftests/net/mptcp/mptcp_join.sh
>> index ae38b428e42e..01480663c102 100755
>> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
>> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
>> @@ -1432,7 +1432,9 @@ chk_rst_nr()
>>     count=$(get_counter ${ns_tx} "MPTcpExtMPRstTx")
>>     if [ -z "$count" ]; then
>>         print_skip
>> -    elif [ $count -lt $rst_tx ]; then
>> +    # accept more rst than expected except if we don't expect any
> 
> That comment is tricky to say out loud :)

:)

> Patch 1 LGTM:
> 
> Reviewed-by: Mat Martineau <martineau@kernel.org>

Thank you for the review!

This first patch (only) is now in our tree (fixes for -net):

New patches for t/upstream-net and t/upstream:
- f9a2bee98398: selftests: mptcp: join: correctly check for no RST
- Results: 7e387ea2e5df..08ccf8391935 (export-net)
- Results: f2323eb0be41..a3a484f2dee3 (export)

Tests are now in progress:

https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export-net/20231011T154102
https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20231011T154102

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net