[PATCH mptcp-next] Squash to "selftests: mptcp: move stats info in case of errors to lib.sh"

Geliang Tang posted 1 patch 1 week, 4 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/ff9a10bb4359ec77fc0b7499f44b388d737abe0f.1736477907.git.tanggeliang@kylinos.cn
tools/testing/selftests/net/mptcp/mptcp_connect.sh | 3 +--
tools/testing/selftests/net/mptcp/mptcp_join.sh    | 3 +--
tools/testing/selftests/net/mptcp/mptcp_lib.sh     | 6 ++----
tools/testing/selftests/net/mptcp/simult_flows.sh  | 3 +--
4 files changed, 5 insertions(+), 10 deletions(-)
[PATCH mptcp-next] Squash to "selftests: mptcp: move stats info in case of errors to lib.sh"
Posted by Geliang Tang 1 week, 4 days ago
From: Geliang Tang <tanggeliang@kylinos.cn>

Drop the last two arguments "lstat" and "cstat" of mptcp_lib_pr_err_stats.

Based-on: <20250108-slft-mptcp-conn-misc-impr-v1-0-bdfbdba48a1f@kernel.org>

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

diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
index 5e3c56253274..d3bf0ec25bfa 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
@@ -444,8 +444,7 @@ do_transfer()
 	printf "(duration %05sms) " "${duration}"
 	if [ ${rets} -ne 0 ] || [ ${retc} -ne 0 ]; then
 		mptcp_lib_pr_fail "client exit code $retc, server $rets"
-		mptcp_lib_pr_err_stats "${listener_ns}" "${connector_ns}" "${port}" \
-			"/tmp/${listener_ns}.out" "/tmp/${connector_ns}.out"
+		mptcp_lib_pr_err_stats "${listener_ns}" "${connector_ns}" "${port}"
 
 		echo
 		cat "$capout"
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 13a3b68181ee..6365555568ec 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -1039,8 +1039,7 @@ do_transfer()
 
 	if [ ${rets} -ne 0 ] || [ ${retc} -ne 0 ]; then
 		fail_test "client exit code $retc, server $rets"
-		mptcp_lib_pr_err_stats "${listener_ns}" "${connector_ns}" "${port}" \
-			"/tmp/${listener_ns}.out" "/tmp/${connector_ns}.out"
+		mptcp_lib_pr_err_stats "${listener_ns}" "${connector_ns}" "${port}"
 		return 1
 	fi
 
diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
index 1f797d5f5156..633e7d776c3d 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
@@ -112,18 +112,16 @@ mptcp_lib_pr_err_stats() {
 	local lns="${1}"
 	local cns="${2}"
 	local port="${3}"
-	local lstat="${4:-}"
-	local cstat="${5:-}"
 
 	echo -en "${MPTCP_LIB_COLOR_RED}"
 	{
 		printf "\nnetns %s (listener) socket stat for %d:\n" "${lns}" "${port}"
 		ip netns exec "${lns}" ss -Menitam -o "sport = :${port}"
-		[ -s "${lstat}" ] && cat "${lstat}"
+		cat /tmp/"${lns}".out
 
 		printf "\nnetns %s (connector) socket stat for %d:\n" "${cns}" "${port}"
 		ip netns exec "${cns}" ss -Menitam -o "dport = :${port}"
-		[ "${lstat}" != "${cstat}" ] && [ -s "${cstat}" ] && cat "${cstat}"
+		[ "${lns}" != "${cns}" ] && cat /tmp/"${cns}".out
 	} 1>&2
 	echo -en "${MPTCP_LIB_COLOR_RESET}"
 }
diff --git a/tools/testing/selftests/net/mptcp/simult_flows.sh b/tools/testing/selftests/net/mptcp/simult_flows.sh
index 9c2a415976cb..f60a27b913d0 100755
--- a/tools/testing/selftests/net/mptcp/simult_flows.sh
+++ b/tools/testing/selftests/net/mptcp/simult_flows.sh
@@ -204,8 +204,7 @@ do_transfer()
 	fi
 
 	mptcp_lib_pr_fail "client exit code $retc, server $rets"
-	mptcp_lib_pr_err_stats "${ns3}" "${ns1}" "${port}" \
-		"/tmp/${ns3}.out" "/tmp/${ns1}.out"
+	mptcp_lib_pr_err_stats "${ns3}" "${ns1}" "${port}"
 	ls -l $sin $cout
 	ls -l $cin $sout
 
-- 
2.45.2
Re: [PATCH mptcp-next] Squash to "selftests: mptcp: move stats info in case of errors to lib.sh"
Posted by Matthieu Baerts 1 week, 4 days ago
Hi Geliang,

10 Jan 2025 04:02:53 Geliang Tang <geliang@kernel.org>:

> Drop the last two arguments "lstat" and "cstat" of mptcp_lib_pr_err_stats.

I think it might be better to keep these arguments, not to have the lib assuming the files will be located there, e.g. just in case we move them elsewhere later, to be clear that when reading the code in the tests that these files will be used there, etc. no?

Cheers,
Matt
Re: [PATCH mptcp-next] Squash to "selftests: mptcp: move stats info in case of errors to lib.sh"
Posted by Matthieu Baerts 1 week, 4 days ago
Hi Geliang,

On 10/01/2025 08:41, Matthieu Baerts wrote:
> Hi Geliang,
> 
> 10 Jan 2025 04:02:53 Geliang Tang <geliang@kernel.org>:
> 
>> Drop the last two arguments "lstat" and "cstat" of mptcp_lib_pr_err_stats.
> 
> I think it might be better to keep these arguments, not to have the lib assuming the files will be located there, e.g. just in case we move them elsewhere later, to be clear that when reading the code in the tests that these files will be used there, etc. no?

Note that, with your previous patch (sockopt: save nstat infos), the 4
and 5 parameters can no longer be optional, and I can remove the size
checks ('[ -s <file> ]'). I can do that when applying the patches.


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