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 01/10] selftests: mptcp: export ip_mptcp to mptcp_lib
Date: Wed, 13 Mar 2024 19:47:07 +0100 [thread overview]
Message-ID: <252586c0-53bd-4588-8dee-3378099ed4a1@kernel.org> (raw)
In-Reply-To: <79aa9c522bcbd104823284a9ea42a91bbbd1f9e2.1710121590.git.tanggeliang@kylinos.cn>
Hi Geliang,
On 11/03/2024 02:48, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> This patch exports ip_mptcp into mptcp_lib.sh as a public variable,
> named mptcp_lib_ip_mptcp. Add a helper mptcp_lib_set_ip_mptcp() to set
> it, and a helper mptcp_lib_is_ip_mptcp() to test whether it is set. Use
> these two helpers in mptcp_join.sh.
>
> This patch is prepared for coming commits.
(...)
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> index d529b4b37af8..d84f2f4986a7 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> @@ -23,6 +23,7 @@ MPTCP_LIB_SUBTESTS=()
> MPTCP_LIB_SUBTESTS_DUPLICATED=0
> MPTCP_LIB_TEST_COUNTER=0
> MPTCP_LIB_TEST_FORMAT="%02u %-50s"
> +mptcp_lib_ip_mptcp=0
Please use capital letters for these global variables, like the other
ones here above.
> # only if supported (or forced) and not disabled, see no-color.org
> if { [ -t 1 ] || [ "${SELFTESTS_MPTCP_LIB_COLOR_FORCE:-}" = "1" ]; } &&
> @@ -505,3 +506,15 @@ mptcp_lib_verify_listener_events() {
> mptcp_lib_check_expected "type" "family" "saddr" "sport" || rc="${?}"
> return "${rc}"
> }
> +
> +mptcp_lib_set_ip_mptcp() {
> + : "${mptcp_lib_ip_mptcp:?}"
I don't think you need that, the variable is declared in the same file.
(and you are going to modify it anyway, no "read")
> + mptcp_lib_ip_mptcp=1
> +}
> +
> +mptcp_lib_is_ip_mptcp() {
> + : "${mptcp_lib_ip_mptcp:?}"
Same here, not needed I think.
> +
> + [ ${mptcp_lib_ip_mptcp} -eq 1 ]
detail: because global variables could be modified elsewhere, I usually
find it safer to use double quotes, and compare strings:
[ "${MPTCP_LIB_IP_MPTCP}" = "1" ]
But on the other hand, this global variable is not supposed to be
modified elsewhere... So up to you.
> +}
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2024-03-13 18:47 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-11 1:48 [PATCH mptcp-next 00/10] add helpers and vars in mptcp_lib.sh, final Geliang Tang
2024-03-11 1:48 ` [PATCH mptcp-next 01/10] selftests: mptcp: export ip_mptcp to mptcp_lib Geliang Tang
2024-03-13 18:47 ` Matthieu Baerts [this message]
2024-03-11 1:48 ` [PATCH mptcp-next 02/10] selftests: mptcp: get support for limits Geliang Tang
2024-03-13 18:47 ` Matthieu Baerts
2024-03-11 1:48 ` [PATCH mptcp-next 03/10] selftests: mptcp: id support for show_endpoints Geliang Tang
2024-03-13 18:47 ` Matthieu Baerts
2024-03-11 1:48 ` [PATCH mptcp-next 04/10] selftests: mptcp: addr support for change_endpoint Geliang Tang
2024-03-13 18:48 ` Matthieu Baerts
2024-03-11 1:48 ` [PATCH mptcp-next 05/10] selftests: mptcp: netlink: fix positions of newline Geliang Tang
2024-03-11 1:48 ` [PATCH mptcp-next 06/10] selftests: mptcp: netlink: add outputs for ip_mptcp Geliang Tang
2024-03-13 18:49 ` Matthieu Baerts
2024-03-11 1:48 ` [PATCH mptcp-next 07/10] selftests: mptcp: add endpoint_ops API helper Geliang Tang
2024-03-13 18:50 ` Matthieu Baerts
2024-03-11 1:48 ` [PATCH mptcp-next 08/10] selftests: mptcp: use mptcp_lib_endpoint_ops Geliang Tang
2024-03-11 1:48 ` [PATCH mptcp-next 09/10] selftests: mptcp: add ip_mptcp option for more scripts Geliang Tang
2024-03-11 1:48 ` [PATCH mptcp-next 10/10] selftests: mptcp: netlink: drop disable=SC2086 Geliang Tang
2024-03-11 2:06 ` selftests: mptcp: netlink: drop disable=SC2086: Build Failure MPTCP CI
2024-03-11 2:44 ` selftests: mptcp: netlink: drop disable=SC2086: Tests Results MPTCP CI
2024-03-13 15:18 ` [PATCH mptcp-next 10/10] selftests: mptcp: netlink: drop disable=SC2086 MPTCP CI
2024-03-13 18:46 ` [PATCH mptcp-next 00/10] add helpers and vars in mptcp_lib.sh, final Matthieu Baerts
2024-03-16 3:56 ` Geliang Tang
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=252586c0-53bd-4588-8dee-3378099ed4a1@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.