From: Geliang Tang <geliang.tang@suse.com>
To: Matthieu Baerts <matthieu.baerts@tessares.net>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v2 1/4] selftests: mptcp: set all env vars as local ones
Date: Fri, 30 Jun 2023 16:59:28 +0800 [thread overview]
Message-ID: <20230630085928.GA12853@bogon> (raw)
In-Reply-To: <ee5e8149-7c4f-31e5-d5cd-d17e30f8ba43@tessares.net>
On Fri, Jun 30, 2023 at 10:42:47AM +0200, Matthieu Baerts wrote:
> Hi Geliang,
>
> On 30/06/2023 04:42, Geliang Tang wrote:
> > It would be better to move the declaration of all the env variables to
> > do_transfer(), run_tests(), or pm_nl_set_endpoint() as local variables,
> > instead of exporting them globally at the beginning of the file.
> >
> > Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> > ---
> > tools/testing/selftests/net/mptcp/mptcp_join.sh | 17 +++++++++++------
> > 1 file changed, 11 insertions(+), 6 deletions(-)
> >
> > diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> > index e6c9d5451c5b..ad0717cb0d7e 100755
> > --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> > +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> > @@ -49,11 +49,11 @@ TEST_COUNT=0
> > TEST_NAME=""
> > nr_blank=40
> >
> > -export FAILING_LINKS=""
> > -export test_linkfail=0
> > -export addr_nr_ns1=0
> > -export addr_nr_ns2=0
> > -export sflags=""
> > +FAILING_LINKS=""
> > +test_linkfail=0
> > +addr_nr_ns1=0
> > +addr_nr_ns2=0
> > +sflags=""
>
> Ah yes, you still need to make sure they are not already set before
> using them later and that's why you set their default value here, right?
>
> But then, I see you are setting the default values twice: here and in
> the different functions where you declared the local variables. To avoid
> that, I would suggest to either:
>
> - "unset" the variables here and keep the default values below
> - declare the default value only here at the top of the file and in the
> different functions, only do:
>
> local XXX=${XXX}
>
> I *think* it might be clearer to do the unset (+ a comment) and keep the
> rest as it is:
>
> > diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> > index b89077510080..9fc5a78c6063 100755
> > --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> > +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> > @@ -49,14 +49,15 @@ TEST_COUNT=0
> > TEST_NAME=""
> > nr_blank=40
> >
> > -FAILING_LINKS=""
> > -test_linkfail=0
> > -addr_nr_ns1=0
> > -addr_nr_ns2=0
> > -sflags=""
> > -fastclose=""
> > -fullmesh=""
> > -speed="fast"
> > +# These var are used only in some tests, make sure they are not already set
> > +unset FAILING_LINKS
> > +unset test_linkfail
> > +unset addr_nr_ns1
> > +unset addr_nr_ns2
> > +unset sflags
> > +unset fastclose
> > +unset fullmesh
> > +unset speed
> >
> > # generated using "nfbpf_compile '(ip && (ip[54] & 0xf0) == 0x30) ||
> > # (ip6 && (ip6[74] & 0xf0) == 0x30)'"
>
> WDYT?
>
> I can do the modifications when applying the patches if it is easier.
Sure, I agree. Please modify it for me, thanks very much.
-Geliang
>
> Cheers,
> Matt
> --
> Tessares | Belgium | Hybrid Access Solutions
> www.tessares.net
next prev parent reply other threads:[~2023-06-30 8:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-30 2:42 [PATCH mptcp-next v2 0/4] update userspace pm mptcp_info fields part 3 Geliang Tang
2023-06-30 2:42 ` [PATCH mptcp-next v2 1/4] selftests: mptcp: set all env vars as local ones Geliang Tang
2023-06-30 8:42 ` Matthieu Baerts
2023-06-30 8:59 ` Geliang Tang [this message]
2023-06-30 2:42 ` [PATCH mptcp-next v2 2/4] selftests: mptcp: add fastclose env var Geliang Tang
2023-06-30 2:42 ` [PATCH mptcp-next v2 3/4] selftests: mptcp: add fullmesh " Geliang Tang
2023-06-30 2:42 ` [PATCH mptcp-next v2 4/4] selftests: mptcp: add speed " Geliang Tang
2023-06-30 4:30 ` selftests: mptcp: add speed env var: Tests Results MPTCP CI
2023-06-30 10:25 ` MPTCP CI
2023-06-30 9:03 ` [PATCH mptcp-next v2 0/4] update userspace pm mptcp_info fields part 3 Matthieu Baerts
2023-06-30 9:24 ` 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=20230630085928.GA12853@bogon \
--to=geliang.tang@suse.com \
--cc=matthieu.baerts@tessares.net \
--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 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.