public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: "H.J. Lu" <hjl.tools@gmail.com>, Lukasz Majewski <lukma@denx.de>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH] tst: Provide test for select
Date: Wed, 24 Mar 2021 16:47:26 -0300	[thread overview]
Message-ID: <39ac5960-73ef-f838-4409-20384c83b59d@linaro.org> (raw)
In-Reply-To: <CAMe9rOpMU4QO9fkSkmW0-G462h9syb7hXs0fPSN0FfaBZm7i-Q@mail.gmail.com>



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;

   /* Wait for timeout.  */
   int ret = select (fds + 1, &rfds, NULL, NULL, &to);

  reply	other threads:[~2021-03-24 19:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-14 16:46 Lukasz Majewski
2021-03-14 19:17 ` DJ Delorie
2021-03-15  9:50   ` Lukasz Majewski
2021-03-15 17:11     ` DJ Delorie
2021-03-22 11:32 ` Lukasz Majewski
2021-03-24 19:17   ` H.J. Lu
2021-03-24 19:47     ` Adhemerval Zanella [this message]
2021-03-24 20:13       ` H.J. Lu
2021-03-24 21:14         ` Adhemerval Zanella
2021-03-24 21:21           ` H.J. Lu
2021-03-24 21:24             ` Adhemerval Zanella
2021-03-24 21:35             ` Samuel Thibault
2021-03-24 21:43               ` Adhemerval Zanella
2021-03-24 22:30                 ` H.J. Lu
2021-03-25 11:35                   ` Adhemerval Zanella
2021-03-25 12:20                     ` Andreas Schwab
2021-03-25 12:48                       ` Adhemerval Zanella
2021-03-25 13:22                         ` H.J. Lu
2021-03-25 13:31                           ` Adhemerval Zanella
2021-03-22 19:23 ` Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=39ac5960-73ef-f838-4409-20384c83b59d@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=hjl.tools@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=lukma@denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).