[PATCH mptcp-next] selftests: mptcp: update output info of chk_rm_nr

Geliang Tang posted 1 patch 2 years, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/ea86b05ef31336262889bbb02a0da28e40f86907.1644979837.git.geliang.tang@suse.com
Maintainers: Matthieu Baerts <matthieu.baerts@tessares.net>, Shuah Khan <shuah@kernel.org>, "David S. Miller" <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>, Mat Martineau <mathew.j.martineau@linux.intel.com>
tools/testing/selftests/net/mptcp/mptcp_join.sh | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
[PATCH mptcp-next] selftests: mptcp: update output info of chk_rm_nr
Posted by Geliang Tang 2 years, 2 months ago
This patch updated the output info of chk_rm_nr. Renamed 'sf' to 'rmsf',
which means 'remove subflow'. Added the display of whether the inverted
namespaces has been used to check the mib counters.

The new output looks like this:

 002 remove multiple subflows          syn[ ok ] - synack[ ok ] - ack[ ok ]
                                       rm [ ok ] - rmsf  [ ok ]
 003 remove single address             syn[ ok ] - synack[ ok ] - ack[ ok ]
                                       add[ ok ] - echo  [ ok ]
                                       rm [ ok ] - rmsf  [ ok ]   invert

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

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index c664565aa8b1..37b3d00b2dcb 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -1242,15 +1242,14 @@ chk_rm_nr()
 	local invert=${3:-""}
 	local count
 	local dump_stats
-	local addr_ns
-	local subflow_ns
+	local addr_ns=$ns1
+	local subflow_ns=$ns2
+	local extra_msg=""
 
-	if [ -z $invert ]; then
-		addr_ns=$ns1
-		subflow_ns=$ns2
-	elif [ $invert = "invert" ]; then
+	if [[ $invert = "invert" ]]; then
 		addr_ns=$ns2
 		subflow_ns=$ns1
+		extra_msg="   invert"
 	fi
 
 	printf "%-${nr_blank}s %s" " " "rm "
@@ -1264,7 +1263,7 @@ chk_rm_nr()
 		echo -n "[ ok ]"
 	fi
 
-	echo -n " - sf    "
+	echo -n " - rmsf  "
 	count=`ip netns exec $subflow_ns nstat -as | grep MPTcpExtRmSubflow | awk '{print $2}'`
 	[ -z "$count" ] && count=0
 	if [ "$count" != "$rm_subflow_nr" ]; then
@@ -1272,9 +1271,11 @@ chk_rm_nr()
 		ret=1
 		dump_stats=1
 	else
-		echo "[ ok ]"
+		echo -n "[ ok ]"
 	fi
 
+	echo "$extra_msg"
+
 	[ "${dump_stats}" = 1 ] && dump_stats
 }
 
-- 
2.34.1


Re: [PATCH mptcp-next] selftests: mptcp: update output info of chk_rm_nr
Posted by Mat Martineau 2 years, 2 months ago
On Wed, 16 Feb 2022, Geliang Tang wrote:

> This patch updated the output info of chk_rm_nr. Renamed 'sf' to 'rmsf',
> which means 'remove subflow'. Added the display of whether the inverted
> namespaces has been used to check the mib counters.
>
> The new output looks like this:
>
> 002 remove multiple subflows          syn[ ok ] - synack[ ok ] - ack[ ok ]
>                                       rm [ ok ] - rmsf  [ ok ]
> 003 remove single address             syn[ ok ] - synack[ ok ] - ack[ ok ]
>                                       add[ ok ] - echo  [ ok ]
>                                       rm [ ok ] - rmsf  [ ok ]   invert
>
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
> tools/testing/selftests/net/mptcp/mptcp_join.sh | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> index c664565aa8b1..37b3d00b2dcb 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> @@ -1242,15 +1242,14 @@ chk_rm_nr()
> 	local invert=${3:-""}
> 	local count
> 	local dump_stats
> -	local addr_ns
> -	local subflow_ns
> +	local addr_ns=$ns1
> +	local subflow_ns=$ns2
> +	local extra_msg=""
>
> -	if [ -z $invert ]; then
> -		addr_ns=$ns1
> -		subflow_ns=$ns2
> -	elif [ $invert = "invert" ]; then
> +	if [[ $invert = "invert" ]]; then
> 		addr_ns=$ns2
> 		subflow_ns=$ns1
> +		extra_msg="   invert"
> 	fi
>
> 	printf "%-${nr_blank}s %s" " " "rm "
> @@ -1264,7 +1263,7 @@ chk_rm_nr()
> 		echo -n "[ ok ]"
> 	fi
>
> -	echo -n " - sf    "
> +	echo -n " - rmsf  "
> 	count=`ip netns exec $subflow_ns nstat -as | grep MPTcpExtRmSubflow | awk '{print $2}'`
> 	[ -z "$count" ] && count=0
> 	if [ "$count" != "$rm_subflow_nr" ]; then
> @@ -1272,9 +1271,11 @@ chk_rm_nr()
> 		ret=1
> 		dump_stats=1
> 	else
> -		echo "[ ok ]"
> +		echo -n "[ ok ]"
> 	fi
>
> +	echo "$extra_msg"

If the 'if' statement above went down the [fail] path, this will output 
either an extra empty line or "   invert" on its own line. But the output 
formatting gets messy with failures anyway so it's not a big deal (also 
happens in chk_rst_nr()), and it's still clear where the failure was.

Reviewed by: Mat Martineau <mathew.j.martineau@linux.intel.com>

> +
> 	[ "${dump_stats}" = 1 ] && dump_stats
> }
>
> -- 
> 2.34.1
>
>
>

--
Mat Martineau
Intel