All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthieu Baerts <matttbe@kernel.org>
To: Geliang Tang <geliang@kernel.org>, mptcp@lists.linux.dev
Cc: Geliang Tang <tanggeliang@kylinos.cn>
Subject: Re: [PATCH mptcp-next v2 4/4] selftests: mptcp: use wait_local_port_listen helper
Date: Thu, 23 May 2024 11:24:45 +0200	[thread overview]
Message-ID: <15c6c1f3-471a-4650-85c2-2233fe216f2e@kernel.org> (raw)
In-Reply-To: <97fa6e63c052859546163fad4ff96a78ce95415a.1716451525.git.tanggeliang@kylinos.cn>

Hi Geliang,

On 23/05/2024 10:09, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> This patch includes net_helper.sh into mptcp_lib.sh, uses the helper
> wait_local_port_listen() defined in it to implement the similar mptcp
> helper. This can drop some duplicate code.
> 
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
>  tools/testing/selftests/net/mptcp/mptcp_lib.sh | 16 ++--------------
>  1 file changed, 2 insertions(+), 14 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> index bd7d78e4aa83..e039c88a64ed 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh

(...)

> @@ -337,20 +338,7 @@ mptcp_lib_check_transfer() {
>  
>  # $1: ns, $2: port
>  mptcp_lib_wait_local_port_listen() {
> -	local listener_ns="${1}"
> -	local port="${2}"
> -
> -	local port_hex
> -	port_hex="$(printf "%04X" "${port}")"
> -
> -	local _
> -	for _ in $(seq 10); do
> -		ip netns exec "${listener_ns}" cat /proc/net/tcp* | \
> -			awk "BEGIN {rc=1} {if (\$2 ~ /:${port_hex}\$/ && \$4 ~ /0A/) \
> -			     {rc=0; exit}} END {exit rc}" &&
> -			break
> -		sleep 0.1
> -	done
> +	wait_local_port_listen "${@}" "tcp"

That's a shame people who duplicated the code didn't do that for us (or
at least they could have mentioned where the code was coming from)...

Anyway, good you saw that, and good idea to use it.

>  }
>  
>  mptcp_lib_check_output() {

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


  reply	other threads:[~2024-05-23  9:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-23  8:08 [PATCH mptcp-next v2 0/4] use helpers in lib.sh and net_helpers.sh Geliang Tang
2024-05-23  8:08 ` [PATCH mptcp-next v2 1/4] selftests: mptcp: rename ns to ns1 in diag.sh Geliang Tang
2024-05-23  9:14   ` Matthieu Baerts
2024-05-23  8:08 ` [PATCH mptcp-next v2 2/4] selftests: mptcp: use setup_ns helper in lib.sh Geliang Tang
2024-05-23  9:18   ` Matthieu Baerts
2024-05-23  9:26     ` Geliang Tang
2024-05-23  9:34       ` Matthieu Baerts
2024-05-23  8:08 ` [PATCH mptcp-next v2 3/4] selftests: mptcp: use cleanup_all_ns " Geliang Tang
2024-05-23  8:39   ` Geliang Tang
2024-05-23  9:22   ` Matthieu Baerts
2024-05-23  8:09 ` [PATCH mptcp-next v2 4/4] selftests: mptcp: use wait_local_port_listen helper Geliang Tang
2024-05-23  9:24   ` Matthieu Baerts [this message]
2024-05-23  8:58 ` [PATCH mptcp-next v2 0/4] use helpers in lib.sh and net_helpers.sh MPTCP CI
2024-05-23  9:13 ` 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=15c6c1f3-471a-4650-85c2-2233fe216f2e@kernel.org \
    --to=matttbe@kernel.org \
    --cc=geliang@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=tanggeliang@kylinos.cn \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.