public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Wei Gao <wegao@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v1] tst_net.sh: Add more tst_require_cmds check
Date: Sun, 22 Jan 2023 22:58:01 +0100	[thread overview]
Message-ID: <Y82xaekaeDtdzK00@pevik> (raw)
In-Reply-To: <Y8p0jyFVMXe8Y3w9@aa>

Hi Wei,

...
> > But even if "ip ns_create ns_exec ns_ifmove" are needed to be checked to fix
> > tst_rhost_run (not yet convinced), why to check them each time tst_rhost_run is
> > called? It should be checked before first tst_rhost_run call to avoid useless
> > repeating.

> tst_rhost_run already be called everywhere so if you need check before call
> tst_rhost_run, means lot of place/cases maybe need review and update. 

No, the check would be on single place at tst_net.sh.

> Furthermore, check each time in tst_rhost_run can make this function more robust, the 
> old code also do tst_require_cmds if go ssh logic in line 211 for example.

Well, repeated check for ssh is not ideal either (how likely is that ssh will
disappear during testing?), but it's a single command which is used here.
And it's definitely less awkward than checking "ip ns_create ns_exec ns_ifmove"
which aren't used there. tst_net.sh needs cleanup, not more unneeded code.

We could document the reason to make this check more obvious, but the code is
wrong, because for netns (the default) running "tst_net_detect_ipv6 rhost"
before init_ltp_netspace does not make sense, because interfaces aren't defined
(probably error code is not detected, I need to recheck that).

It's actually enough for netns to test IPv6 support only on localhost (it will
be the same on rhost), I'll send a patch to fix that.

Kind regards,
Petr

>  205         sh_cmd="$pre_cmd $cmd $post_cmd"
>  206
>  207         if [ -n "${TST_USE_NETNS:-}" ]; then
>  208                 use="NETNS"
>  209                 rcmd="$LTP_NETNS sh -c"
>  210         else
>  211                 tst_require_cmds ssh
>  212                 use="SSH"
>  213                 rcmd="ssh -nq $user@$RHOST"
>  214         fi

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

  reply	other threads:[~2023-01-22 21:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-17  4:01 [LTP] [PATCH v1] tst_net.sh: Add more tst_require_cmds check Wei Gao via ltp
2023-01-17  8:33 ` Petr Vorel
2023-01-17  8:48   ` Wei Gao via ltp
2023-01-20  8:38     ` Petr Vorel
2023-01-20 11:01       ` Wei Gao via ltp
2023-01-22 21:58         ` Petr Vorel [this message]
2023-01-26 22:04           ` 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=Y82xaekaeDtdzK00@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=wegao@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