public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] misc: tst-poll: Proper synchronize with child before sending the signal
Date: Thu,  1 Feb 2024 12:45:29 +0000 (GMT)	[thread overview]
Message-ID: <20240201124529.9F5AB38582B7@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=26d01172f5c3f3b912ecf21ebb911eb5351bba4d

commit 26d01172f5c3f3b912ecf21ebb911eb5351bba4d
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Jan 26 08:23:41 2024 -0300

    misc: tst-poll: Proper synchronize with child before sending the signal
    
    When running the testsuite in parallel, for instance running make -j
    $(nproc) check, occasionally tst-epoll fails with a timeout.  It happens
    because it sometimes takes a bit more than 10ms for the process to get
    cloned and blocked by the syscall.  In that case the signal is
    sent to early, and the test fails with a timeout.
    
    Checked on x86_64-linux-gnu.

Diff:
---
 sysdeps/unix/sysv/linux/tst-epoll.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/tst-epoll.c b/sysdeps/unix/sysv/linux/tst-epoll.c
index 3b38beae6e..545f506faa 100644
--- a/sysdeps/unix/sysv/linux/tst-epoll.c
+++ b/sysdeps/unix/sysv/linux/tst-epoll.c
@@ -22,7 +22,7 @@
 #include <support/support.h>
 #include <support/xsignal.h>
 #include <support/xunistd.h>
-#include <support/xtime.h>
+#include <support/process_state.h>
 #include <stdlib.h>
 #include <sys/epoll.h>
 
@@ -97,8 +97,8 @@ test_epoll_basic (epoll_wait_check_t epoll_wait_check)
   xclose (fds[0][0]);
   xclose (fds[1][1]);
 
-  /* Wait some time so child is blocked on the syscall.  */
-  nanosleep (&(struct timespec) {0, 10000000}, NULL);
+  /* Wait until child is blocked on epoll_wait.  */
+  support_process_state_wait (p, support_process_state_sleeping);
   TEST_COMPARE (kill (p, SIGUSR1), 0);
 
   int e = epoll_wait_check (efd, &event, 1, 500000000, &ss);

                 reply	other threads:[~2024-02-01 12:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240201124529.9F5AB38582B7@sourceware.org \
    --to=azanella@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /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).