[LTP] [PATCH 6/6] lib: Add tst_set_runtime() & remove tst_set_timeout()

Li Wang liwang@redhat.com
Tue Oct 26 09:44:30 CEST 2021


On Tue, Oct 26, 2021 at 3:13 PM Cyril Hrubis <chrubis@suse.cz> wrote:

> Hi!
> > > Rarely there is a need to set the test runtime dynamically, the only
> > > tests in LTP that does this are the timer tests that can get two
> > > parameters, number of iterations and sleep time, and the test runtime
> is
> > > close to the multiplication of these two.
> > >
> > > It's still cleaner to set the runtime and let the test library figure
> > > out the timeout in this case.
> > >
> >
> > If so, should we consider to hinden the .timeout in struct tst_test
> > to prevent users from changing it?
>
> If we decide to apply this patchset that would be logical end result.
> There are only a few .timeout = foo left in the codebase after this
> patchset that either disable timeout for the few unpredictable cases or
> shorten it to make the test timeout faster if it gets stuck. We can deal
> with these by making the .max_runtime accept -1 and by shortening the
> default timeout considerably.
>

Yes, that should be great.

After a quick reviewing the whole patchset, I feel that .timeout is
redundant since .max_runtime can do more thing to totally replace
it by the end.

----------------

Btw, it looks weird to simply double the runtime by plus MAX(10u, runtime)
in the runtime_to_timeout, I guess you probably just wanna another
10sec for some reclaiming work.

And the .max_runtime is also maximal time per test iteration,
but from the output below misleading me to think it is for the
whole test time.

See:

# LTP_TIMEOUT_MUL=1 ./pty03
tst_test.c:1376: TINFO: Test max runtime 360s
tst_test.c:1371: TINFO: Timeout per run is 0h 12m 00s
....



>
> > IIRC, we currently have ".timeout == -1" to disable test timed
> > out in unsure situation, e.g some OOM tests. But in this patch,
> > I saw you remove that, but not handle it in tst_set_runtime.
>
> Ah, right, I've removed the timeout == -1 handling by mistake. I wanted
> to keep it working after this patchset as well until a follow up
> patchset deals with the rest of the tests that set the .timeout.
>

Sound good.

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20211026/c16e0328/attachment-0001.htm>


More information about the ltp mailing list