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 5/5] selftests: mptcp: add mptcp_lib_evts_* helpers
Date: Mon, 19 Feb 2024 13:22:04 +0100 [thread overview]
Message-ID: <418ca759-ba64-4bda-ac92-d57a674db203@kernel.org> (raw)
In-Reply-To: <1fbd9490d9c18f54b0685eb07da910749e43a0d5.1708334850.git.tanggeliang@kylinos.cn>
Hi Geliang,
On 19/02/2024 10:29, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> To avoid duplicated code in different MPTCP selftests, we can add and
> use helpers defined in mptcp_lib.sh.
>
> This patch unifies "pm_nl_ctl events" related code in userspace_pm.sh
> and mptcp_join.sh into four helpers: mptcp_lib_evts_init(), _start(),
> _kill() and _remove(). Define them in mptcp_lib.sh and use these new
> helpers in both scripts.
>
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
> .../testing/selftests/net/mptcp/mptcp_join.sh | 62 +++++++-----------
> .../testing/selftests/net/mptcp/mptcp_lib.sh | 63 +++++++++++++++++++
> .../selftests/net/mptcp/userspace_pm.sh | 31 ++-------
> 3 files changed, 92 insertions(+), 64 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> index f75d22dbb28d..d4798495a17d 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> @@ -33,10 +33,6 @@ ip_mptcp=0
> check_invert=0
> validate_checksum=false
> init=0
> -evts_ns1=""
> -evts_ns2=""
> -evts_ns1_pid=0
> -evts_ns2_pid=0
> last_test_failed=0
> last_test_skipped=0
> last_test_ignored=1
> @@ -148,8 +144,7 @@ init() {
> cin=$(mktemp)
> cinsent=$(mktemp)
> cout=$(mktemp)
> - evts_ns1=$(mktemp)
> - evts_ns2=$(mktemp)
> + mptcp_lib_evts_init
>
> trap cleanup EXIT
>
> @@ -162,7 +157,7 @@ cleanup()
> rm -f "$cin" "$cout" "$sinfail"
> rm -f "$sin" "$sout" "$cinsent" "$cinfail"
> rm -f "$tmpfile"
> - rm -rf $evts_ns1 $evts_ns2
> + mptcp_lib_evts_remove
> mptcp_lib_cleanup
> cleanup_partial
> }
Same here, I think it is best to keep these global variables declared
here and pass their names to mptcp_lib_(...) functions.
By doing that, you can keep a different name in mptcp_join.sh and
userspace_pm.sh, and reduce the modifications here below.
(...)
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2024-02-19 12:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-19 9:29 [PATCH mptcp-next 0/5] add helpers and vars in mptcp_lib.sh, part 2 Geliang Tang
2024-02-19 9:29 ` [PATCH mptcp-next 1/5] selftests: mptcp: unify namespace names to ns1/2/3/4 Geliang Tang
2024-02-19 12:21 ` Matthieu Baerts
2024-02-19 9:29 ` [PATCH mptcp-next 2/5] selftests: mptcp: add mptcp_lib_ns_* helpers Geliang Tang
2024-02-19 12:21 ` Matthieu Baerts
2024-02-19 9:29 ` [PATCH mptcp-next 3/5] selftests: mptcp: add mptcp_lib_cleanup helper Geliang Tang
2024-02-19 12:21 ` Matthieu Baerts
2024-02-19 9:29 ` [PATCH mptcp-next 4/5] selftests: mptcp: add mptcp_lib_check_output helper Geliang Tang
2024-02-19 12:21 ` Matthieu Baerts
2024-02-19 9:29 ` [PATCH mptcp-next 5/5] selftests: mptcp: add mptcp_lib_evts_* helpers Geliang Tang
2024-02-19 12:22 ` Matthieu Baerts [this message]
2024-02-19 12:21 ` [PATCH mptcp-next 0/5] add helpers and vars in mptcp_lib.sh, part 2 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=418ca759-ba64-4bda-ac92-d57a674db203@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox