netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthieu Baerts <matthieu.baerts@tessares.net>
To: mptcp@lists.linux.dev, Mat Martineau <martineau@kernel.org>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,  Shuah Khan <shuah@kernel.org>,
	Florian Westphal <fw@strlen.de>,
	 Davide Caratti <dcaratti@redhat.com>,
	Christoph Paasch <cpaasch@apple.com>,
	 Geliang Tang <geliangtang@gmail.com>,
	Geliang Tang <geliang.tang@suse.com>
Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
	 linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
	 Matthieu Baerts <matthieu.baerts@tessares.net>,
	stable@vger.kernel.org
Subject: [PATCH net 16/17] selftests: mptcp: join: uniform listener tests
Date: Sat, 10 Jun 2023 18:11:51 +0200	[thread overview]
Message-ID: <20230609-upstream-net-20230610-mptcp-selftests-support-old-kernels-part-3-v1-16-2896fe2ee8a3@tessares.net> (raw)
In-Reply-To: <20230609-upstream-net-20230610-mptcp-selftests-support-old-kernels-part-3-v1-0-2896fe2ee8a3@tessares.net>

The alignment was different from the other tests because tabs were used
instead of spaces.

While at it, also use 'echo' instead of 'printf' to print the result to
keep the same style as done in the other sub-tests. And, even if it
should be better with, also remove 'stdbuf' and sed's '--unbuffered'
option because they are not used in the other subtests and they are not
available when using a minimal environment with busybox.

Link: https://github.com/multipath-tcp/mptcp_net-next/issues/368
Fixes: 178d023208eb ("selftests: mptcp: listener test for in-kernel PM")
Cc: stable@vger.kernel.org
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 30 ++++++++++++-------------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 0c22efeba675..281581d3c8eb 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -2765,43 +2765,41 @@ verify_listener_events()
 	local family
 	local saddr
 	local sport
+	local name
 
 	if [ $e_type = $LISTENER_CREATED ]; then
-		stdbuf -o0 -e0 printf "\t\t\t\t\t CREATE_LISTENER %s:%s"\
-			$e_saddr $e_sport
+		name="LISTENER_CREATED"
 	elif [ $e_type = $LISTENER_CLOSED ]; then
-		stdbuf -o0 -e0 printf "\t\t\t\t\t CLOSE_LISTENER %s:%s "\
-			$e_saddr $e_sport
+		name="LISTENER_CLOSED"
+	else
+		name="$e_type"
 	fi
 
+	printf "%-${nr_blank}s %s %s:%s " " " "$name" "$e_saddr" "$e_sport"
+
 	if ! mptcp_lib_kallsyms_has "mptcp_event_pm_listener$"; then
 		printf "[skip]: event not supported\n"
 		return
 	fi
 
-	type=$(grep "type:$e_type," $evt |
-	       sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q')
-	family=$(grep "type:$e_type," $evt |
-		 sed --unbuffered -n 's/.*\(family:\)\([[:digit:]]*\).*$/\2/p;q')
-	sport=$(grep "type:$e_type," $evt |
-		sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q')
+	type=$(grep "type:$e_type," $evt | sed -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q')
+	family=$(grep "type:$e_type," $evt | sed -n 's/.*\(family:\)\([[:digit:]]*\).*$/\2/p;q')
+	sport=$(grep "type:$e_type," $evt | sed -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q')
 	if [ $family ] && [ $family = $AF_INET6 ]; then
-		saddr=$(grep "type:$e_type," $evt |
-			sed --unbuffered -n 's/.*\(saddr6:\)\([0-9a-f:.]*\).*$/\2/p;q')
+		saddr=$(grep "type:$e_type," $evt | sed -n 's/.*\(saddr6:\)\([0-9a-f:.]*\).*$/\2/p;q')
 	else
-		saddr=$(grep "type:$e_type," $evt |
-			sed --unbuffered -n 's/.*\(saddr4:\)\([0-9.]*\).*$/\2/p;q')
+		saddr=$(grep "type:$e_type," $evt | sed -n 's/.*\(saddr4:\)\([0-9.]*\).*$/\2/p;q')
 	fi
 
 	if [ $type ] && [ $type = $e_type ] &&
 	   [ $family ] && [ $family = $e_family ] &&
 	   [ $saddr ] && [ $saddr = $e_saddr ] &&
 	   [ $sport ] && [ $sport = $e_sport ]; then
-		stdbuf -o0 -e0 printf "[ ok ]\n"
+		echo "[ ok ]"
 		return 0
 	fi
 	fail_test
-	stdbuf -o0 -e0 printf "[fail]\n"
+	echo "[fail]"
 }
 
 add_addr_ports_tests()

-- 
2.40.1


  parent reply	other threads:[~2023-06-10 16:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-10 16:11 [PATCH net 00/17] selftests: mptcp: skip tests not supported by old kernels (part 3) Matthieu Baerts
2023-06-10 16:11 ` [PATCH net 01/17] selftests: mptcp: lib: skip if not below kernel version Matthieu Baerts
2023-06-13  0:00   ` patchwork-bot+netdevbpf
2023-06-10 16:11 ` [PATCH net 02/17] selftests: mptcp: join: use 'iptables-legacy' if available Matthieu Baerts
2023-06-10 16:11 ` [PATCH net 03/17] selftests: mptcp: join: helpers to skip tests Matthieu Baerts
2023-06-10 16:11 ` [PATCH net 04/17] selftests: mptcp: join: skip check if MIB counter not supported Matthieu Baerts
2023-06-10 16:11 ` [PATCH net 05/17] selftests: mptcp: join: skip test if iptables/tc cmds fail Matthieu Baerts
2023-06-10 16:11 ` [PATCH net 06/17] selftests: mptcp: join: support local endpoint being tracked or not Matthieu Baerts
2023-06-10 16:11 ` [PATCH net 07/17] selftests: mptcp: join: skip Fastclose tests if not supported Matthieu Baerts
2023-06-10 16:11 ` [PATCH net 08/17] selftests: mptcp: join: support RM_ADDR for used endpoints or not Matthieu Baerts
2023-06-10 16:11 ` [PATCH net 09/17] selftests: mptcp: join: skip implicit tests if not supported Matthieu Baerts
2023-06-10 16:11 ` [PATCH net 10/17] selftests: mptcp: join: skip backup if set flag on ID " Matthieu Baerts
2023-06-10 16:11 ` [PATCH net 11/17] selftests: mptcp: join: skip fullmesh flag tests if " Matthieu Baerts
2023-06-10 16:11 ` [PATCH net 12/17] selftests: mptcp: join: skip userspace PM " Matthieu Baerts
2023-06-10 16:11 ` [PATCH net 13/17] selftests: mptcp: join: skip fail " Matthieu Baerts
2023-06-10 16:11 ` [PATCH net 14/17] selftests: mptcp: join: skip MPC backups " Matthieu Baerts
2023-06-10 16:11 ` [PATCH net 15/17] selftests: mptcp: join: skip PM listener " Matthieu Baerts
2023-06-10 16:11 ` Matthieu Baerts [this message]
2023-06-10 16:11 ` [PATCH net 17/17] selftests: mptcp: join: skip mixed " Matthieu Baerts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230609-upstream-net-20230610-mptcp-selftests-support-old-kernels-part-3-v1-16-2896fe2ee8a3@tessares.net \
    --to=matthieu.baerts@tessares.net \
    --cc=bpf@vger.kernel.org \
    --cc=cpaasch@apple.com \
    --cc=davem@davemloft.net \
    --cc=dcaratti@redhat.com \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=geliang.tang@suse.com \
    --cc=geliangtang@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martineau@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).