[LTP] [PATCH] lsmod01.sh: retry test couple times to lower false positives

Li Wang
2019-10-24T04:47:03Z

On Thu, Oct 24, 2019 at 2:28 AM Petr Vorel <pvorel@suse.cz> wrote:

> Hi Jan,
>
> > > > - tst_res TPASS "'lsmod' passed."
> > > > +lsmod_test()
> > > > +{
> > > > + for i in $(seq 1 5); do
> > > > + if lsmod_matches_proc_modules; then
> > > > + tst_res TPASS "'lsmod' passed."
> > > > + return
> > > > + fi
> > > > + tst_res TINFO "Trying again"
> > > > + sleep 1
> > > > + done
> > > This is similar pattern to TST_RETRY_FUNC()/TST_RETRY_FN_EXP_BACKOFF()
> > > (for both shell and C). I wonder if we also have use for TPASS/TFAIL
> > > instead of just TBROK and specifying number of tries instead of time
> to be
> > > setup.
>
> > I think TFAIL fits more here, it's outcome of what we are testing.
> > TBROK in my mind is failure unrelated to subject of test.
> I express myself wrong. Sure, I meant to have TPASS/TFAIL,
> just to use some helper function instead of writing the wrapper in the
> test.
>
> > But functionally TST_RETRY_FUNC should work too.
>
> > > C and shell usage is a bit different, so maybe
> > > TST_RETRY_FUNC()/TST_RETRY_FN_EXP_BACKOFF() doesn't make much sense
> for shell
>
> > I see it used in mkswap01.sh and numa01.sh.
> Sorry, I searched just TST_RETRY_FN_EXP_BACKOFF.
> Correct, TST_RETRY_FUNC is used there.
>
> > I wonder if we need to TBROK in TST_RETRY_FUNC(). We could just return
> > what the FUNC returns and let the test decide.
> > TST_RETRY_FUNC_BRK() could be a wrapper that TBROKs on timeout.
> That could work (apart from the fact it diverges the functionality from C).
> + there could be the third one, which TPASS/TFAIL (instead of
> nothing/TBROK).
>
> But this should be based on TST_RETRY_FN_EXP_BACKOFF (TST_RETRY_FUNC is
> reusing
> TST_RETRY_FN_EXP_BACKOFF) + add also TST_RETRY_FUNC wrappers.
>
> Do we need similar functionality in C?
>

Not sure, but we could collect the requirement for the EXP_BACKOFF series
macro. I'm also thinking about to extend the functionality for more
situations.

e.g http://lists.linux.it/pipermail/ltp/2019-October/013896.html

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