[LTP] [PATCH 5/7] tst_test.sh: Introduce tst_set_timeout(timeout)

Cyril Hrubis chrubis@suse.cz
Tue Mar 2 11:04:59 CET 2021


Hi!
> > +tst_set_timeout()
> > +{
> > +       TST_TIMEOUT="$1"
> >
> 
> Not sure if we should check "$1" is valid again before using it.
> 
> I guess in most scenarios, the function is invoked by tests, so
> just needs to guarantee $1 > $TST_TIMEOUT, otherwise, it
> looks meaningless to reset TST_TIMEOUT?
> (especially to avoid people set a smaller value by a typo)

I can image where it may make sense to set the timeout smaller than
default dynamically. If we had a test that consists of many iterations
whose number depends on the actuall system we run on (the same as the
supported filesystem) but if the iterations are rather quick we may end
up in a situation where we run only one iteration and we will attempt to
set a timeout smaller than default in the setup() which wouldn't be
wrong.

Hence I would check that the value is greater than zero here instead.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list