[LTP] [PATCH] setitimer01: rewrite using new API

Li Wang liwang@redhat.com
Mon Oct 24 04:23:26 CEST 2022


Hi Richard,

After trying that there were new problems with the below two comments.


> +static void verify_setitimer(unsigned int i)
> > +{
> > +     struct tcase *tc = &tcases[i];
> > +
> > +     si_flag = 0;
> > +     value->it_value.tv_sec = SEC1;
> > +     value->it_value.tv_usec = SEC0;
>
> Why not test usecs instead?
>

Yes, But the point we need attention here is to avoid defining
a very tiny value for USEC. Otherwise, test will sometimes get
first-timer expiration too early so that it has not had enough time
for the rest code get an execution.


> +     if (ovalue->it_value.tv_sec <= SEC1)
> > +             tst_res(TPASS, "setitimer functionality is correct");
> > +     else
> > +             tst_brk(TFAIL, "old timer value is not equal to expected
> value");
> > +
> > +     for (;;) {
>
> Could we use sigwait here instead?
>

sigwait() function suspends the calling progress which will
disturb the target process counts down the user-mode CPU time.
This led to the test hanging and never expiring the timer.


> We seem to be burning CPU cycles for no reason and if we get a spurious
> signal the test will still pass if we get the correct one afterwards.
>

And, these three signals all will terminate the process, so maybe
another resolution is to test in children and check if they exit by
the expected signal.

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


More information about the ltp mailing list