[LTP] [PATCH v3 22/29] fuzzy_sync: Convert to runtime

Li Wang liwang@redhat.com
Sat May 14 04:59:34 CEST 2022


On Fri, May 13, 2022 at 10:20 PM Cyril Hrubis <chrubis@suse.cz> wrote:

> Hi!
> > > > I hit a new problem while testing new pty03, that seems here
> > > > will fall into an infinite loop and test timed out finally. The
> printf
> > > > shows rem_p will be overflow I haven't figured out why.
> > > >
> > > > But with comparing with 0.9, it always gets passed on to the same
> system.
> > >
> > > That is strange, since we do:
> > >
> > >         rem_p = 1 - tst_remaining_runtime()/pair->time_exec_start;
> > >
> >
> > I guess the root cause is that 'pair->time_exec_start' has a possibility
> > to reach zero. in pty03 it has ".tcnt = 9" which made the
> > tst_fzsync_pair_reset()
> > to be re-run many times, but in that function 'pair->time_exec_start'
> will
> > be set only based on the original .max_runtime, with time elapsed the
> > remaining time tends to be zero.
>
> I guess that that the interaction of tcnt and runtime is not optimal
> here. You are right that as long as we call tst_fzsync_pair_reset() on
> each invocation of the run() function we may eventually get to state
> where the runtime is exhausted, especially on slower hardware we end up
> with division by zero and overflow.
>
> The cleanest solution would be to rewrite the test to use .test_variants =
> 9
> and setting the .max_runtime to a smaller value. That way we would have
> precisely defined runtime for each iteration. What do you think?
>

Yes, that should work, but people have to painstakingly remember
that to avoid this interaction of tcnt and runtime in test writing.

Another simple choice I can think of is to use tst_set_max_runtime()
to reset both 'timeout' and 'runtime' at the beginning of each invocation
of the run().

And maybe we should invoke it in the tst_fzsync_pair_reset directly?
I'm not very sure about fixing this in fzsync-lib or out.

--- a/testcases/kernel/pty/pty03.c
+++ b/testcases/kernel/pty/pty03.c
@@ -105,6 +105,7 @@ static void do_test(unsigned int n)

        tst_res(TINFO, "Creating PTY with %s line discipline", ldisc->name);

+       tst_set_max_runtime(test.runtime);
        tst_fzsync_pair_reset(&fzp, hangup);
        while (tst_fzsync_run_a(&fzp)) {
                ptmx = SAFE_OPEN("/dev/ptmx", O_RDONLY);


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


More information about the ltp mailing list