All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Li Wang <liwang@redhat.com>
Cc: ltp@lists.linux.it, Martin Doucha <martin.doucha@suse.com>
Subject: Re: [LTP] [REGRESSION] Broken tests using tst_net.sh by 893ca0abe7 (was: [PATCH 1/2] lib: multiply the timeout if detect slow kconfigs)
Date: Thu, 16 Jan 2025 13:56:50 +0100	[thread overview]
Message-ID: <20250116125650.GA692568@pevik> (raw)
In-Reply-To: <CAEemH2e+Cb8R0kS5a8FnETcMiafWeD529CO3=AtHk310vyckbg@mail.gmail.com>

> On Thu, Jan 16, 2025 at 6:42 AM Petr Vorel <pvorel@suse.cz> wrote:

> > Hi Li, Cyril, all,

> > ...
> > > +++ b/lib/tst_test.c
> > > @@ -555,9 +555,6 @@ static int multiply_runtime(int max_runtime)

> > >       parse_mul(&runtime_mul, "LTP_RUNTIME_MUL", 0.0099, 100);

> > > -     if (tst_has_slow_kconfig())
> > > -             max_runtime *= 4;
> > > -
> > >       return max_runtime * runtime_mul;
> > >  }

> > > @@ -1706,6 +1703,9 @@ unsigned int tst_multiply_timeout(unsigned int
> > timeout)
> > >       if (timeout < 1)
> > >               tst_brk(TBROK, "timeout must to be >= 1! (%d)", timeout);

> > > +     if (tst_has_slow_kconfig())
> > > +             timeout *= 4;

> > FYI this change, merged as 893ca0abe7 ("lib: multiply the timeout if
> > detect slow
> > kconfigs") caused a regression on *all* tests which use tst_net.sh.

> > First, it detects slow config on everything which uses struct tst_test,
> > which are unfortunately some tools at testcases/lib/:

> > $ git grep -l "struct tst_test" testcases/lib/*.c
> > testcases/lib/tst_device.c // not obvious reason, might be removed
> > testcases/lib/tst_get_free_pids.c // force messages to be printed from new
> > library
> > testcases/lib/tst_ns_create.c // .forks_child = 1, Needed by SAFE_CLONE
> > testcases/lib/tst_ns_exec.c  // .forks_child = 1, Needed by SAFE_CLONE
> > testcases/lib/tst_run_shell.c // not obvious reason, might be removed

> > Besides unimportant fact that slow config detection is an unnecessary
> > slowdown
> > on these tools, the problem is that it prints messages to stderr, which
> > causes
> > breakage.

> > Previously tst_ns_exec.c run just command passed by -c parameter:

> > $ ./tst_ns_exec 14536 net,mnt sh -c " cat
> > /proc/sys/net/ipv6/conf/ltp_ns_veth1/disable_ipv6"
> > 0

> > Now it prints TINFO:
> > $ ./tst_ns_exec 14536 net,mnt sh -c " cat
> > /proc/sys/net/ipv6/conf/ltp_ns_veth1/disable_ipv6"
> > tst_kconfig.c:88: TINFO: Parsing kernel config '/proc/config.gz'
> > tst_kconfig.c:667: TINFO: CONFIG_LATENCYTOP kernel option detected which
> > might slow the execution
> > 0

> > tst_rhost_run() in tst_net.sh runs binary on remote host:

> >         output=$($rcmd "$sh_cmd" $out 2>&1 || echo 'RTERR')

> > Redirect stderr to stdout (2>&1) is likely needed for some tests. But
> > tst_rhost_run() output is often parsed including therefore certain tools in
> > testcases/lib/ have to print only expected output:

> > init_ltp_netspace()
> > {
> >         ...
> >                 pid="$(ROD tst_ns_create net,mnt)"
> >         ...
> >         export LTP_NETNS="${LTP_NETNS:-tst_ns_exec $pid net,mnt}"

> > I will probably solve it by adding yet another parameter to
> > tst_rhost_run(),
> > which ignores stderr and use it for tst_ns_{create,exec}. But maybe there

Actually tst_ns_exec.c needs to be quiet to not clutter the output of the
command it runs via tst_rhost_run() for netns (via $LTP_NETNS). Therefore adding
an quiet option to tst_rhost_run() is not a solution.

> > is
> > another solution (or another problem).


> Or, another way is just to set 'tst_test->timeout == TST_UNLIMITED_TIMEOUT'
> in those testcase/lib tools.

Unfortunately this does not work. In the end I probably filter out 'TINFO:'
messages in tst_rhost_run().

It'd be safer to avoid using library for tst_ns_exec.c, but it's also used in
containers shell tests (netns_lib.sh, netns_sysfs.sh) and fs_bind tests
(fs_bind_cloneNS*.sh).

Also, tst_ns_exec.c (and tst_ns_create.c) could be for netns replaced by
'ip netns' (revert back change in 2017 3fb501e04c ("net: use LTP ns_create/ns_exec")

Maybe other tools which use tst_ns_{create,exec,ifmove}.c could be replaced by
some tools from util-linux (unshare ?). We consider having own binary as better
than external dependency, but binary needs to be simple to avoid problems when
LTP library changes.

Kind regards,
Petr

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

  parent reply	other threads:[~2025-01-16 12:57 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-22  7:22 [LTP] [PATCH 1/2] lib: multiply the timeout if detect slow kconfigs Li Wang
2024-12-22  7:22 ` [LTP] [PATCH 2/2] starvation: skip test on slow kernel Li Wang
2025-01-02 12:56   ` Petr Vorel
2025-01-02 14:31     ` Petr Vorel
2025-01-03  7:53       ` Li Wang
2025-01-02 12:43 ` [LTP] [PATCH 1/2] lib: multiply the timeout if detect slow kconfigs Petr Vorel
2025-01-03  5:00   ` Li Wang
2025-01-03  7:06     ` Petr Vorel
2025-01-03  7:33       ` Petr Vorel
2025-01-03  7:58         ` Li Wang
2025-01-03 15:48     ` [LTP] [PATCH 1/2] lib: multiply the timeout if detect slow kconfigsD Cyril Hrubis
2025-01-04  3:38       ` Li Wang
2025-01-06  9:35         ` Petr Vorel
2025-01-06 12:10         ` Cyril Hrubis
2025-01-06 12:52           ` Petr Vorel
2025-01-06 13:39             ` Cyril Hrubis
2025-01-06 15:36               ` Petr Vorel
2025-01-06 16:19                 ` Cyril Hrubis
2025-01-07  5:37                   ` Li Wang
2025-01-07  6:28                     ` Li Wang
2025-01-07 12:42                       ` Cyril Hrubis
2025-01-07 16:49                         ` Petr Vorel
2025-01-08  1:47                           ` Li Wang
2025-01-08  2:51                             ` Li Wang
2025-01-06 16:03           ` Martin Doucha
2025-01-06 16:21             ` Cyril Hrubis
2025-01-06 16:49               ` Martin Doucha
2025-01-15 22:41 ` [LTP] [REGRESSION] Broken tests using tst_net.sh by 893ca0abe7 (was: [PATCH 1/2] lib: multiply the timeout if detect slow kconfigs) Petr Vorel
2025-01-16  6:54   ` Li Wang
2025-01-16  8:35     ` Petr Vorel
2025-01-16  8:38     ` Petr Vorel
2025-01-16 12:10       ` Li Wang
2025-01-16 12:13         ` Li Wang
2025-01-16 13:13         ` Petr Vorel
2025-01-16 12:56     ` Petr Vorel [this message]
2025-01-20  9:07     ` [LTP] [REGRESSION] pidns05 timeout " Petr Vorel
2025-01-20  9:11       ` Petr Vorel
2025-01-20 10:18         ` Li Wang
2025-01-20 12:29           ` Cyril Hrubis
2025-01-20 13:03             ` 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=20250116125650.GA692568@pevik \
    --to=pvorel@suse.cz \
    --cc=liwang@redhat.com \
    --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 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.