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

Cyril Hrubis chrubis@suse.cz
Tue Oct 26 09:14:12 CEST 2021


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.

> 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.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list