From: Geliang Tang <geliang@kernel.org>
To: Matthieu Baerts <matttbe@kernel.org>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v3 2/2] selftests: mptcp: rm subflow with v4/v4mapped addr
Date: Wed, 14 Feb 2024 19:47:10 +0800 [thread overview]
Message-ID: <ZcyoPhQU4N8twwsu@t480> (raw)
In-Reply-To: <2f1a2240-b213-47b5-bd4b-4bd398bae475@kernel.org>
Hi Matt,
On Wed, Feb 14, 2024 at 11:18:04AM +0100, Matthieu Baerts wrote:
> Hi Geliang,
>
> On 07/02/2024 02:55, Geliang Tang wrote:
> > From: Geliang Tang <tanggeliang@kylinos.cn>
> >
> > Now both a v4 address and a v4-mapped address are supported when
> > destroying a userspace pm subflow, this patch adds a second subflow
> > to "userspace pm add & remove address" test, and two subflows could
> > be removed two different ways, one with the v4mapped and one with v4.
>
> Thank you for validating this.
>
> > diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> > index 3a2abae5993e..69001d2a8dab 100644
> > --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> > +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> > @@ -213,9 +213,12 @@ mptcp_lib_get_info_value() {
> > grep "${2}" | sed -n 's/.*\('"${1}"':\)\([0-9a-f:.]*\).*$/\2/p;q'
> > }
> >
> > -# $1: info name ; $2: evts_ns ; $3: event type
> > +# $1: info name ; $2: evts_ns ; $3: event type; $4: addr
> > mptcp_lib_evts_get_info() {
> > - mptcp_lib_get_info_value "${1}" "^type:${3:-1}," < "${2}"
> > + local addr=${4:-""}
> > +
> > + cat "${2}" | grep "${addr}" |
> > + mptcp_lib_get_info_value "${1}" "^type:${3:-1},"
>
> When modifying shell scripts, please make sure 'shellcheck' is happy
> with the modifications you did.
Sure, I'll use shellcheck to check my script modifications next time.
>
> > $ shellcheck -x mptcp_lib.sh
> >
> > In mptcp_lib.sh line 220:
> > cat "${2}" | grep "${addr}" |
> > ^----^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
> >
> > For more information:
> > https://www.shellcheck.net/wiki/SC2002 -- Useless cat. Consider 'cmd < file...
>
> I then did this modification when applying the patch:
Thanks a lot.
-Geliang
>
> > diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> > index 69001d2a8dab..3777d66fc56d 100644
> > --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> > +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> > @@ -213,12 +213,9 @@ mptcp_lib_get_info_value() {
> > grep "${2}" | sed -n 's/.*\('"${1}"':\)\([0-9a-f:.]*\).*$/\2/p;q'
> > }
> >
> > -# $1: info name ; $2: evts_ns ; $3: event type; $4: addr
> > +# $1: info name ; $2: evts_ns ; [$3: event type; [$4: addr]]
> > mptcp_lib_evts_get_info() {
> > - local addr=${4:-""}
> > -
> > - cat "${2}" | grep "${addr}" |
> > - mptcp_lib_get_info_value "${1}" "^type:${3:-1},"
> > + grep "${4:-}" "${2}" | mptcp_lib_get_info_value "${1}" "^type:${3:-1},"
> > }
> >
> > # $1: PID
>
> Note that it is not strictly needed to add ':-' in '${4:-}' (we don't
> use 'set -u'), but it clearly shows the argument is optional.
>
> I also edited the comment above the declaration of the function to
> reflect that.
>
> About 'shellcheck', please note that for the moment, not all scripts are
> shellcheck compliant, only 'mptcp_join.sh', 'mptcp_lib.sh' and
> 'userspace_pm.sh'. For the others, it would be great if at the least the
> new code is shellcheck compliant. I don't think it is needed to modify
> the existing ones, they are not often modified and they work. (Except
> maybe if there are some other big modifications needed.)
>
> Also, some checks can be ignored with '# shellcheck disable=XXXX'
> directive if needed:
>
> https://www.shellcheck.net/wiki/Ignore
>
> Cheers,
> Matt
> --
> Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2024-02-14 11:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-07 1:55 [PATCH mptcp-next v3 0/2] fixes for "map v4 address to v6" Geliang Tang
2024-02-07 1:55 ` [PATCH mptcp-next v3 1/2] mptcp: map v4 address to v6 when destroying subflow Geliang Tang
2024-02-07 1:55 ` [PATCH mptcp-next v3 2/2] selftests: mptcp: rm subflow with v4/v4mapped addr Geliang Tang
2024-02-07 2:49 ` selftests: mptcp: rm subflow with v4/v4mapped addr: Tests Results MPTCP CI
2024-02-07 3:11 ` MPTCP CI
2024-02-14 2:36 ` MPTCP CI
2024-02-14 2:55 ` MPTCP CI
2024-02-14 10:18 ` [PATCH mptcp-next v3 2/2] selftests: mptcp: rm subflow with v4/v4mapped addr Matthieu Baerts
2024-02-14 11:47 ` Geliang Tang [this message]
2024-02-14 1:44 ` [PATCH mptcp-next v3 0/2] fixes for "map v4 address to v6" Mat Martineau
2024-02-14 10:28 ` 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=ZcyoPhQU4N8twwsu@t480 \
--to=geliang@kernel.org \
--cc=matttbe@kernel.org \
--cc=mptcp@lists.linux.dev \
/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