public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: Martin Doucha <martin.doucha@suse.com>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v3 1/3] tst_net.sh: Fix for disabled IPv6
Date: Tue, 10 May 2022 15:06:56 +0200	[thread overview]
Message-ID: <YnpjcH4i33YxyeFJ@pevik> (raw)
In-Reply-To: <YnpXGnJyjjZhxuRN@yuki>

Hi Cyril,

...
> > +# detect IPv6 support on lhost for tests which don't use test links
> > +tst_net_detect_ipv6
> > +
> >  [ -n "$TST_NET_SKIP_VARIABLE_INIT" ] && return 0

> >  # Management Link
> > @@ -970,8 +1007,13 @@ IPV6_RHOST="${IPV6_RHOST:-fd00:1:1:1::1/64}"
> >  if [ -z "$_tst_net_parse_variables" ]; then
> >  	eval $(tst_net_ip_prefix $IPV4_LHOST || echo "exit $?")
> >  	eval $(tst_net_ip_prefix -r $IPV4_RHOST || echo "exit $?")
> > -	eval $(tst_net_ip_prefix $IPV6_LHOST || echo "exit $?")
> > -	eval $(tst_net_ip_prefix -r $IPV6_RHOST || echo "exit $?")
> > +
> > +	tst_net_detect_ipv6 rhost
> > +
> > +	if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then
> > +		eval $(tst_net_ip_prefix $IPV6_LHOST || echo "exit $?")
> > +		eval $(tst_net_ip_prefix -r $IPV6_RHOST || echo "exit $?")
> > +	fi

> If I'm looking right at this piece of code we do run the
> tst_net_detect_ipv6 twice once for lhost and once for rhost when the
> script is sourced and we only set the TST_NET_IPV6_ENABLED when the
> check succeeds, right?

Yes.

FYI 2 tests run only first run for lhost - these which use
TST_NET_SKIP_VARIABLE_INIT=1:
* lib/newlib_tests/shell/net/tst_ipaddr_un.sh (which does not need this feature
  as test runs for both IPv4 and IPv6 and does not need IPv6 functionality)
* and with this patchset also for testcases/kernel/containers/netns/netns_lib.sh
  netns tests require IPv6 only for lhost, thus that's enough for
  TST_NET_SKIP_VARIABLE_INIT=1

> Shouldn't we also unset it when the check fails because otherwise the
> check for rhost is basically no-op as long as the lhost supports ipv6?

Hm, that's right. Patch below would will fix it.
Anyway I'm not much happy with tst_net_detect_ipv6 setting global variable
$TST_NET_IPV6_ENABLED. But I wanted to stay compatible with the rest of
tst_net.sh, which becomes more an more messy (rewriting/deleting old tests
will allow cleanup code for TST_USE_LEGACY_API=1). Anyway, feel free to suggest
something better.

Kind regards,
Petr

diff --git testcases/lib/tst_net.sh testcases/lib/tst_net.sh
index 29d80df89..48dd6e8eb 100644
--- testcases/lib/tst_net.sh
+++ testcases/lib/tst_net.sh
@@ -1008,7 +1008,7 @@ if [ -z "$_tst_net_parse_variables" ]; then
        eval $(tst_net_ip_prefix $IPV4_LHOST || echo "exit $?")
        eval $(tst_net_ip_prefix -r $IPV4_RHOST || echo "exit $?")

-       tst_net_detect_ipv6 rhost
+       [ "$TST_NET_IPV6_ENABLED" = 1 ] && tst_net_detect_ipv6 rhost

        if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then
                eval $(tst_net_ip_prefix $IPV6_LHOST || echo "exit $?")



-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2022-05-10 13:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10  6:51 [LTP] [PATCH v3 0/3] shell: Fixes for disabled IPv6 Petr Vorel
2022-05-10  6:51 ` [LTP] [PATCH v3 1/3] tst_net.sh: Fix " Petr Vorel
2022-05-10 12:14   ` Cyril Hrubis
2022-05-10 13:06     ` Petr Vorel [this message]
2022-05-10 13:21       ` Cyril Hrubis
2022-05-10 14:04         ` Petr Vorel
2022-05-10  6:51 ` [LTP] [PATCH v3 2/3] netns: Rewrite to use tst_net.sh Petr Vorel
2022-05-10 13:08   ` Cyril Hrubis
2022-05-10 14:00     ` Petr Vorel
2022-05-10  6:51 ` [LTP] [PATCH v3 3/3] netns: Rename netns_helper.sh -> netns_lib.sh Petr Vorel

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=YnpjcH4i33YxyeFJ@pevik \
    --to=pvorel@suse.cz \
    --cc=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=martin.doucha@suse.com \
    /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