Handle EINTR in tests

On an otherwise busy machine the test suite is quite flaky. Restart
the syscalls that are aborted with EINTR.

Signed-off-by: Dirk Müller <dirk@dmllr.de>
Link: https://lore.kernel.org/r/20220705132939.7744-1-dirk@dmllr.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Dirk Müller
2022-07-05 15:29:39 +02:00
committed by Jens Axboe
parent 7e9db7fa5f
commit fa67f6aedc
2 changed files with 10 additions and 2 deletions
+4 -1
View File
@@ -111,7 +111,10 @@ int main(int argc, char *argv[])
(void*) (intptr_t) other_fd);
/* Wait on the event fd for an event to be ready */
ret = read(loop_fd, buf, 8);
do {
ret = read(loop_fd, buf, 8);
} while (ret < 0 && errno == EINTR);
if (ret < 0) {
perror("read");
return T_EXIT_FAIL;
+6 -1
View File
@@ -365,8 +365,13 @@ static int test_cancel_req_across_fork(void)
exit(0);
} else {
int wstatus;
pid_t childpid;
if (waitpid(p, &wstatus, 0) == (pid_t)-1) {
do {
childpid = waitpid(p, &wstatus, 0);
} while (childpid == (pid_t)-1 && errno == EINTR);
if (childpid == (pid_t)-1) {
perror("waitpid()");
return 1;
}