Skip to contentSkip to conversation

Handle EINTR in tests

PATCH Applied Dirk Müller 2 participants 2 messages Jul 5, 2022 io_uring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Handle EINTR in tests

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

---
 test/ce593a6c480a.c | 5 ++++-
 test/io-cancel.c    | 7 ++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
test/ce593a6c480a.c +4 -1
index 1c5669e..4c71fbc 100644
@@ -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;
test/io-cancel.c +6 -1
index d5e3ae9..13bf84f 100644
@@ -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;
 		}
Signature · 1 line
2.36.1
maintainer Applied
#1 lore raw
Quoted 4 lines · Dirk Müller

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

Applied, thanks!

[1/1] Handle EINTR in tests

      commit: fa67f6aedcfdaffc14cbf0b631253477b2565ef0

Best regards,

Signature · 1 line
Jens Axboe