[PATCH mptcp-next v2 6/7] selftests: mptcp: add ss mptcp support checks

Geliang Tang posted 7 patches 1 year, 11 months ago
There is a newer version of this series
[PATCH mptcp-next v2 6/7] selftests: mptcp: add ss mptcp support checks
Posted by Geliang Tang 1 year, 11 months ago
From: Geliang Tang <tanggeliang@kylinos.cn>

Commands 'ss -M' are used in scripts mptcp_connect.sh, mptcp_join.sh,
and mptcp_sockopt.sh to display only MPTCP sockets. So it must be checked
if ss tool supports MPTCP in these script.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 tools/testing/selftests/net/mptcp/mptcp_connect.sh | 5 +++++
 tools/testing/selftests/net/mptcp/mptcp_join.sh    | 5 +++++
 tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 5 +++++
 3 files changed, 15 insertions(+)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
index 7898d62fce0b..eb811d257cab 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
@@ -154,6 +154,11 @@ if [ $? -ne 0 ];then
 	exit $ksft_skip
 fi
 
+if ! ss -h | grep -q MPTCP; then
+	echo "SKIP: ss tool does not support MPTCP"
+	exit $ksft_skip
+fi
+
 sin=$(mktemp)
 sout=$(mktemp)
 cin=$(mktemp)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 9b35a16a7c8b..34a8d5ab185c 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -159,6 +159,11 @@ check_tools()
 		exit $ksft_skip
 	fi
 
+	if ! ss -h | grep -q MPTCP; then
+		echo "SKIP: ss tool does not support MPTCP"
+		exit $ksft_skip
+	fi
+
 	if ! iptables -V &> /dev/null; then
 		echo "SKIP: Could not run all tests without iptables tool"
 		exit $ksft_skip
diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh
index 722b0872f00d..988042912c7a 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh
@@ -94,6 +94,11 @@ if [ $? -ne 0 ];then
 	exit $ksft_skip
 fi
 
+if ! ss -h | grep -q MPTCP; then
+	echo "SKIP: ss tool does not support MPTCP"
+	exit $ksft_skip
+fi
+
 if ! iptables -V &> /dev/null; then
 	echo "SKIP: Could not run all tests without iptables tool"
 	exit $ksft_skip
-- 
2.40.1
Re: [PATCH mptcp-next v2 6/7] selftests: mptcp: add ss mptcp support checks
Posted by Matthieu Baerts 1 year, 11 months ago
Hi Geliang,

On 16/02/2024 10:50, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> Commands 'ss -M' are used in scripts mptcp_connect.sh, mptcp_join.sh,
> and mptcp_sockopt.sh to display only MPTCP sockets. So it must be checked
> if ss tool supports MPTCP in these script.

I think you missed my comment from v1: 'ss' is used in mptcp_connect.sh
and mptcp_sockopt.sh, but only in case of errors, to get more info. They
are not strictly needed to run the tests, no?

I think it would be better not to skip the two selftests *entirely* if
'ss' doesn't support MPTCP.

For 'mptcp_join.sh', it is different, because 'ss' with MPTCP support is
needed for some tests, since:

 Fixes: e274f7154008 ("selftests: mptcp: add subflow limits test-cases")

(Even there, it is mandatory just for one subtest... In fact, I wonder
if we should not use 'chk_subflows_total' instead, it doesn't require
'ss -M' support.)

So in other words, I think we should only modify 'mptcp_join.sh', no?

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