[PATCH mptcp-next 4/4] selftests: mptcp: join: print title at the end of reset

Geliang Tang posted 4 patches 4 months, 3 weeks ago
[PATCH mptcp-next 4/4] selftests: mptcp: join: print title at the end of reset
Posted by Geliang Tang 4 months, 3 weeks ago
From: Geliang Tang <tanggeliang@kylinos.cn>

init or init_partial may fail sometimes, in that case, titles shouldn't
be printed out.

For example, these errors occur when invalid name is set to setup_ns:

    001 no JOIN
    Failed to setup namespace 'ns_temp': invalid name

"001 no JOIN" shouldn't be printed out in this case. So the patch moves
mptcp_lib_print_title from the front of init to the end of reset().

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 2b66c5fa71eb..d20a053eee8f 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -269,8 +269,6 @@ reset()
 		return 1
 	fi
 
-	mptcp_lib_print_title "${TEST_NAME}"
-
 	if [ "${init}" != "1" ]; then
 		init
 	else
@@ -279,6 +277,8 @@ reset()
 
 	init_partial
 
+	mptcp_lib_print_title "${TEST_NAME}"
+
 	return 0
 }
 
-- 
2.43.0
Re: [PATCH mptcp-next 4/4] selftests: mptcp: join: print title at the end of reset
Posted by Matthieu Baerts 4 months, 3 weeks ago
On 25/05/2024 15:01, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> init or init_partial may fail sometimes, in that case, titles shouldn't
> be printed out.
> 
> For example, these errors occur when invalid name is set to setup_ns:
> 
>     001 no JOIN
>     Failed to setup namespace 'ns_temp': invalid name
> 
> "001 no JOIN" shouldn't be printed out in this case.

Why? For me, it sounds better to print the title before creating the
netns: each subtest creates a new netns, that's part of the test, it is
important to know which one had an issue. Imagine there is an error later:

  001 no JOIN
        syn                                 [ OK ]
        synack                              [ OK ]
        ack                                 [ OK ]
  002 single subflow, limited by client
  mount --make-shared /run/netns failed: Operation not permitted
  Failed to create namespace ns0

Here, it is clear the issue is when creating a new netns with the 2nd
test, that's not linked to the first one, no?

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.