[PATCH mptcp-next v5 03/12] selftests: mptcp: connect: fix misaligned OK/FAIL

Geliang Tang posted 12 patches 1 year, 11 months ago
There is a newer version of this series
[PATCH mptcp-next v5 03/12] selftests: mptcp: connect: fix misaligned OK/FAIL
Posted by Geliang Tang 1 year, 11 months ago
From: Geliang Tang <tanggeliang@kylinos.cn>

The first [ OK ] and [FAIL] in the output of mptcp_connect.sh misalign
with the others:

New MPTCP socket can be blocked via sysctl		[ OK ]
INFO: validating network environment with pings
INFO: Using loss of 0.85% delay 16 ms reorder 95% 70% with delay 4ms on
ns1 MPTCP -> ns1 (10.0.1.1:10000      ) MPTCP	(duration   184ms) [ OK ]
ns1 MPTCP -> ns1 (10.0.1.1:10001      ) TCP  	(duration    50ms) [ OK ]
ns1 TCP   -> ns1 (10.0.1.1:10002      ) MPTCP	(duration    55ms) [ OK ]

This patch fixes them.

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

diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
index ab3bb3b17522..72be905bab1f 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
@@ -254,7 +254,7 @@ check_mptcp_disabled()
 
 	# net.mptcp.enabled should be enabled by default
 	if [ "$(ip netns exec ${disabled_ns} sysctl net.mptcp.enabled | awk '{ print $3 }')" -ne 1 ]; then
-		echo -e "net.mptcp.enabled sysctl is not 1 by default\t\t[FAIL]"
+		echo -e "net.mptcp.enabled sysctl is not 1 by default\t\t\t   [FAIL]"
 		mptcp_lib_result_fail "net.mptcp.enabled sysctl is not 1 by default"
 		ret=1
 		return 1
@@ -267,13 +267,13 @@ check_mptcp_disabled()
 	mptcp_lib_ns_exit "${disabled_ns}"
 
 	if [ ${err} -eq 0 ]; then
-		echo -e "New MPTCP socket cannot be blocked via sysctl\t\t[FAIL]"
+		echo -e "New MPTCP socket cannot be blocked via sysctl\t\t\t   [FAIL]"
 		mptcp_lib_result_fail "New MPTCP socket cannot be blocked via sysctl"
 		ret=1
 		return 1
 	fi
 
-	echo -e "New MPTCP socket can be blocked via sysctl\t\t[ OK ]"
+	echo -e "New MPTCP socket can be blocked via sysctl\t\t\t   [ OK ]"
 	mptcp_lib_result_pass "New MPTCP socket can be blocked via sysctl"
 	return 0
 }
-- 
2.40.1
Re: [PATCH mptcp-next v5 03/12] selftests: mptcp: connect: fix misaligned OK/FAIL
Posted by Matthieu Baerts 1 year, 11 months ago
Hi Geliang,

On 26/02/2024 10:43, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> The first [ OK ] and [FAIL] in the output of mptcp_connect.sh misalign
> with the others:
> 
> New MPTCP socket can be blocked via sysctl		[ OK ]
> INFO: validating network environment with pings
> INFO: Using loss of 0.85% delay 16 ms reorder 95% 70% with delay 4ms on
> ns1 MPTCP -> ns1 (10.0.1.1:10000      ) MPTCP	(duration   184ms) [ OK ]
> ns1 MPTCP -> ns1 (10.0.1.1:10001      ) TCP  	(duration    50ms) [ OK ]
> ns1 TCP   -> ns1 (10.0.1.1:10002      ) MPTCP	(duration    55ms) [ OK ]
> 
> This patch fixes them.
> 
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
>  tools/testing/selftests/net/mptcp/mptcp_connect.sh | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
> index ab3bb3b17522..72be905bab1f 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
> @@ -254,7 +254,7 @@ check_mptcp_disabled()
>  
>  	# net.mptcp.enabled should be enabled by default
>  	if [ "$(ip netns exec ${disabled_ns} sysctl net.mptcp.enabled | awk '{ print $3 }')" -ne 1 ]; then
> -		echo -e "net.mptcp.enabled sysctl is not 1 by default\t\t[FAIL]"
> +		echo -e "net.mptcp.enabled sysctl is not 1 by default\t\t\t   [FAIL]"

Best to use one new helper using 'printf %-XXXs', instead of playing
with tabs and spaces.

That will also help to add colours later, with just:

  mptcp_lib_print_success/fail/warn

>  		mptcp_lib_result_fail "net.mptcp.enabled sysctl is not 1 by default"
>  		ret=1
>  		return 1
> @@ -267,13 +267,13 @@ check_mptcp_disabled()
>  	mptcp_lib_ns_exit "${disabled_ns}"
>  
>  	if [ ${err} -eq 0 ]; then
> -		echo -e "New MPTCP socket cannot be blocked via sysctl\t\t[FAIL]"
> +		echo -e "New MPTCP socket cannot be blocked via sysctl\t\t\t   [FAIL]"
>  		mptcp_lib_result_fail "New MPTCP socket cannot be blocked via sysctl"
>  		ret=1
>  		return 1
>  	fi
>  
> -	echo -e "New MPTCP socket can be blocked via sysctl\t\t[ OK ]"
> +	echo -e "New MPTCP socket can be blocked via sysctl\t\t\t   [ OK ]"
>  	mptcp_lib_result_pass "New MPTCP socket can be blocked via sysctl"
>  	return 0
>  }

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.
Re: [PATCH mptcp-next v5 03/12] selftests: mptcp: connect: fix misaligned OK/FAIL
Posted by Geliang Tang 1 year, 11 months ago
On Mon, 2024-02-26 at 13:40 +0100, Matthieu Baerts wrote:
> Hi Geliang,
> 
> On 26/02/2024 10:43, Geliang Tang wrote:
> > From: Geliang Tang <tanggeliang@kylinos.cn>
> > 
> > The first [ OK ] and [FAIL] in the output of mptcp_connect.sh
> > misalign
> > with the others:
> > 
> > New MPTCP socket can be blocked via sysctl		[ OK ]
> > INFO: validating network environment with pings
> > INFO: Using loss of 0.85% delay 16 ms reorder 95% 70% with delay
> > 4ms on
> > ns1 MPTCP -> ns1 (10.0.1.1:10000      ) MPTCP	(duration   184ms)
> > [ OK ]
> > ns1 MPTCP -> ns1 (10.0.1.1:10001      ) TCP  	(duration    50ms)
> > [ OK ]
> > ns1 TCP   -> ns1 (10.0.1.1:10002      ) MPTCP	(duration    55ms)
> > [ OK ]
> > 
> > This patch fixes them.
> > 
> > Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> > ---
> >  tools/testing/selftests/net/mptcp/mptcp_connect.sh | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh
> > b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
> > index ab3bb3b17522..72be905bab1f 100755
> > --- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh
> > +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
> > @@ -254,7 +254,7 @@ check_mptcp_disabled()
> >  
> >  	# net.mptcp.enabled should be enabled by default
> >  	if [ "$(ip netns exec ${disabled_ns} sysctl
> > net.mptcp.enabled | awk '{ print $3 }')" -ne 1 ]; then
> > -		echo -e "net.mptcp.enabled sysctl is not 1 by
> > default\t\t[FAIL]"
> > +		echo -e "net.mptcp.enabled sysctl is not 1 by
> > default\t\t\t   [FAIL]"
> 
> Best to use one new helper using 'printf %-XXXs', instead of playing
> with tabs and spaces.

Updated.

> 
> That will also help to add colours later, with just:
> 
>   mptcp_lib_print_success/fail/warn

Updated.

> 
> >  		mptcp_lib_result_fail "net.mptcp.enabled sysctl is
> > not 1 by default"
> >  		ret=1
> >  		return 1
> > @@ -267,13 +267,13 @@ check_mptcp_disabled()
> >  	mptcp_lib_ns_exit "${disabled_ns}"
> >  
> >  	if [ ${err} -eq 0 ]; then
> > -		echo -e "New MPTCP socket cannot be blocked via
> > sysctl\t\t[FAIL]"
> > +		echo -e "New MPTCP socket cannot be blocked via
> > sysctl\t\t\t   [FAIL]"
> >  		mptcp_lib_result_fail "New MPTCP socket cannot be
> > blocked via sysctl"
> >  		ret=1
> >  		return 1
> >  	fi
> >  
> > -	echo -e "New MPTCP socket can be blocked via sysctl\t\t[
> > OK ]"
> > +	echo -e "New MPTCP socket can be blocked via
> > sysctl\t\t\t   [ OK ]"
> >  	mptcp_lib_result_pass "New MPTCP socket can be blocked via
> > sysctl"
> >  	return 0
> >  }
> 
> Cheers,
> Matt