From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 9F5AB38582B7; Thu, 1 Feb 2024 12:45:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9F5AB38582B7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1706791529; bh=k0Hr87TLmmaZb+ziQtncb21T6CattHuxHG2d6xBd3fg=; h=From:To:Subject:Date:From; b=QWDLRmZDqiGSVAHq6pDA/dyXXgSEZAfX7nvm7EP3GI4jlHFoZLMlz1W12KmWBv4En +Odlgh5O/B6EyqQEjcRhlkLW1uATcnrgKDi+Z8FN0vW2n/yGDO4chDEHBCcS16QnOy AodiCxcLRFGKatrPwnILYmKmXEJioIVmVSNreIXY= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc] misc: tst-poll: Proper synchronize with child before sending the signal X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/master X-Git-Oldrev: 9c61303ebbdc6e727c89591bff3229c9fbfa438b X-Git-Newrev: 26d01172f5c3f3b912ecf21ebb911eb5351bba4d Message-Id: <20240201124529.9F5AB38582B7@sourceware.org> Date: Thu, 1 Feb 2024 12:45:29 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=26d01172f5c3f3b912ecf21ebb911eb5351bba4d commit 26d01172f5c3f3b912ecf21ebb911eb5351bba4d Author: Adhemerval Zanella 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 #include #include -#include +#include #include #include @@ -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);