2020-09-16 20:58:26

by Matthieu Baerts

[permalink] [raw]
Subject: [PATCH net-next] selftests: mptcp: interpret \n as a new line

In case of errors, this message was printed:

(...)
# read: Resource temporarily unavailable
# client exit code 0, server 3
# \nnetns ns1-0-BJlt5D socket stat for 10003:
(...)

Obviously, the idea was to add a new line before the socket stat and not
print "\nnetns".

Fixes: b08fbf241064 ("selftests: add test-cases for MPTCP MP_JOIN")
Fixes: 048d19d444be ("mptcp: add basic kselftest for mptcp")
Signed-off-by: Matthieu Baerts <[email protected]>
---

Notes:
This commit improves the output in selftests in case of errors, mostly
seen when modifying MPTCP code. The selftests behaviour is not changed.
That's why this patch is proposed only for net-next.

tools/testing/selftests/net/mptcp/mptcp_connect.sh | 4 ++--
tools/testing/selftests/net/mptcp/mptcp_join.sh | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
index e4df9ba64824..2cfd87d94db8 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
@@ -443,9 +443,9 @@ do_transfer()
duration=$(printf "(duration %05sms)" $duration)
if [ ${rets} -ne 0 ] || [ ${retc} -ne 0 ]; then
echo "$duration [ FAIL ] client exit code $retc, server $rets" 1>&2
- echo "\nnetns ${listener_ns} socket stat for $port:" 1>&2
+ echo -e "\nnetns ${listener_ns} socket stat for ${port}:" 1>&2
ip netns exec ${listener_ns} ss -nita 1>&2 -o "sport = :$port"
- echo "\nnetns ${connector_ns} socket stat for $port:" 1>&2
+ echo -e "\nnetns ${connector_ns} socket stat for ${port}:" 1>&2
ip netns exec ${connector_ns} ss -nita 1>&2 -o "dport = :$port"

cat "$capout"
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index f39c1129ce5f..c2943e4dfcfe 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -176,9 +176,9 @@ do_transfer()

if [ ${rets} -ne 0 ] || [ ${retc} -ne 0 ]; then
echo " client exit code $retc, server $rets" 1>&2
- echo "\nnetns ${listener_ns} socket stat for $port:" 1>&2
+ echo -e "\nnetns ${listener_ns} socket stat for ${port}:" 1>&2
ip netns exec ${listener_ns} ss -nita 1>&2 -o "sport = :$port"
- echo "\nnetns ${connector_ns} socket stat for $port:" 1>&2
+ echo -e "\nnetns ${connector_ns} socket stat for ${port}:" 1>&2
ip netns exec ${connector_ns} ss -nita 1>&2 -o "dport = :$port"

cat "$capout"
--
2.27.0


2020-09-17 08:36:31

by Paolo Abeni

[permalink] [raw]
Subject: Re: [PATCH net-next] selftests: mptcp: interpret \n as a new line

On Wed, 2020-09-16 at 15:13 +0200, Matthieu Baerts wrote:
> In case of errors, this message was printed:
>
> (...)
> # read: Resource temporarily unavailable
> # client exit code 0, server 3
> # \nnetns ns1-0-BJlt5D socket stat for 10003:
> (...)
>
> Obviously, the idea was to add a new line before the socket stat and not
> print "\nnetns".
>
> Fixes: b08fbf241064 ("selftests: add test-cases for MPTCP MP_JOIN")
> Fixes: 048d19d444be ("mptcp: add basic kselftest for mptcp")
> Signed-off-by: Matthieu Baerts <[email protected]>

Acked-by: Paolo Abeni <[email protected]>

2020-09-17 23:29:09

by David Miller

[permalink] [raw]
Subject: Re: [PATCH net-next] selftests: mptcp: interpret \n as a new line

From: Matthieu Baerts <[email protected]>
Date: Wed, 16 Sep 2020 15:13:51 +0200

> In case of errors, this message was printed:
>
> (...)
> # read: Resource temporarily unavailable
> # client exit code 0, server 3
> # \nnetns ns1-0-BJlt5D socket stat for 10003:
> (...)
>
> Obviously, the idea was to add a new line before the socket stat and not
> print "\nnetns".
>
> Fixes: b08fbf241064 ("selftests: add test-cases for MPTCP MP_JOIN")
> Fixes: 048d19d444be ("mptcp: add basic kselftest for mptcp")
> Signed-off-by: Matthieu Baerts <[email protected]>

Applied.