[PATCH] tst: Provide test for select
H.J. Lu
hjl.tools@gmail.com
Wed Mar 24 22:30:31 GMT 2021
On Wed, Mar 24, 2021 at 2:43 PM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
>
>
> On 24/03/2021 18:35, Samuel Thibault wrote:
> > H.J. Lu via Libc-alpha, le mer. 24 mars 2021 14:21:54 -0700, a ecrit:
> >> On Wed, Mar 24, 2021 at 2:14 PM Adhemerval Zanella
> >> <adhemerval.zanella@linaro.org> wrote:
> >>>
> >>>
> >>>
> >>> On 24/03/2021 17:13, H.J. Lu wrote:
> >>>> On Wed, Mar 24, 2021 at 12:47 PM Adhemerval Zanella
> >>>> <adhemerval.zanella@linaro.org> wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>> On 24/03/2021 16:17, H.J. Lu wrote:
> >>>>>> On Mon, Mar 22, 2021 at 4:33 AM Lukasz Majewski <lukma@denx.de> wrote:
> >>>>>>>
> >>>>>>> Dear Community,
> >>>>>>>
> >>>>>>>> This change adds new test to assess select()'s timeout related
> >>>>>>>> functionality (the rdfs set provides valid fd - stderr - but during
> >>>>>>>> normal program operation there is no data to be read, so one just
> >>>>>>>> waits for timeout).
> >>>>>>>>
> >>>>>>>> To be more specific - two use cases are checked:
> >>>>>>>> - if select() times out immediately when passed struct timeval has
> >>>>>>>> zero values of tv_usec and tv_sec.
> >>>>>>>> - if select() times out after timeout specified in passed argument
> >>>>>>>
> >>>>>>> Do you have any comments regarding this patch?
> >>>>>>>
> >>>>>>
> >>>>>> This test failed on machines with more than 40 cores:
> >>>>>>
> >>>>>> tst-select.c:54: 1616610088.851713938s not after 1616610089.851712804s
> >>>>>> (difference 0.999998866s)
> >>>>>> error: 1 test failures
> >>>>>>
> >>>>>> I was doing 3 "makec -j28 check" in parallel.
> >>>>>
> >>>>> I think the nanosecond precision of time accounting is triggering the
> >>>>> failure, since select only support timeval (the error indicates that
> >>>>> the nanosecond precision is what is triggering it).
> >>>>>
> >>>>> Maybe if we ignore the nanosecond precision:
> >>>>>
> >>>>> diff --git a/misc/tst-select.c b/misc/tst-select.c
> >>>>> index 7c310256c5..4b1791ac8a 100644
> >>>>> --- a/misc/tst-select.c
> >>>>> +++ b/misc/tst-select.c
> >>>>> @@ -45,6 +45,8 @@ test_select_timeout (bool zero_tmo)
> >>>>> to.tv_sec = timeout;
> >>>>> ts = xclock_now (CLOCK_REALTIME);
> >>>>> ts = timespec_add (ts, (struct timespec) { timeout, 0 });
> >>>>> + /* Ignore nanosecond precision since select only support microsecond. */
> >>>>> + ts.tv_nsec = (ts.tv_nsec * 1000) / 1000;
> >>>>
> >>>> How does it work? It looks like a NOP to me.
> >>>
> >>> The idea is to clear the nanosecond precision from the xclock_now call.
> >
> > It should rather be
> >
> > ts.tv_nsec = (ts.tv_nsec / 1000) * 1000;
> >
> > shouldn't it?
>
> Indeed, thanks for spotting it. Could you check if this helps the tests H.J?
The test failed with "nohup make check" since select returned immediately.
--
H.J.
More information about the Libc-alpha
mailing list