[LTP] [PATCH v2 2/2] setitimer01: rewrite using new API

Li Wang liwang@redhat.com
Mon Oct 24 10:41:50 CEST 2022


Richard Palethorpe <rpalethorpe@suse.de> wrote:

> -/*
> > - * setup() - performs all the ONE TIME setup for this test.
> > - */
> > -void setup(void)
> > -{
> > +             set_setitimer_value(USEC2, USEC2);
> > +             TST_EXP_PASS(sys_setitimer(tc->which, value, ovalue));
> >
> > -     tst_sig(NOFORK, DEF_HANDLER, cleanup);
> > +             if (ovalue->it_value.tv_sec != 0 ||
> ovalue->it_value.tv_usec >= USEC2)
> > +                     tst_brk(TFAIL, "old timer value is not within
> > the expected range");
>
> Maybe we could split testing the return value and ovalue from testing
> the signal is delivered?
>
> When testing the return value and ovalue; a very long timeout can be
> used (which is never hit). When testing the signal a very short one can
> be used.
>
> This way, the test is not racing with the signal and the loop below
> won't be executed much.
>

Very good point. Also, I plan to add the 'it_interval' check to
verify the periodic timer, which will make the functionality test
more complete.

This will be achieved in a separate patch.


>
> In any case LGTM
>
> Reviewed-by: Richard Palethorpe <rpalethorpe@suse.com>
>

Thanks for the review.

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


More information about the ltp mailing list