Skip to content

Commit 3cf1e67

Browse files
tklausergopherbot
authored andcommitted
unix: don't fail TestPpoll on EINTR
TestPpoll sometimes fails builders due to Ppoll getting interrupted and returning EINTR: --- FAIL: TestPpoll (0.00s) syscall_linux_test.go:299: Ppoll: unexpected error: interrupted system call Fix this by retrying Ppoll in case of EINTR, same as CL 298189 in TestPoll. Fixes golang/go#66324 Change-Id: I8ce4e2c00fe3b7a078cd75b4b15bb076d3a87fb2 Reviewed-on: https://go-review.googlesource.com/c/sys/+/627395 Reviewed-by: Cherry Mui <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Auto-Submit: Tobias Klauser <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent d2cea70 commit 3cf1e67

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

Diff for: unix/syscall_linux_test.go

+15-9
Original file line numberDiff line numberDiff line change
@@ -337,15 +337,21 @@ func TestPpoll(t *testing.T) {
337337

338338
fds := []unix.PollFd{{Fd: int32(f.Fd()), Events: unix.POLLIN}}
339339
timeoutTs := unix.NsecToTimespec(int64(timeout))
340-
n, err := unix.Ppoll(fds, &timeoutTs, nil)
341-
ok <- true
342-
if err != nil {
343-
t.Errorf("Ppoll: unexpected error: %v", err)
344-
return
345-
}
346-
if n != 0 {
347-
t.Errorf("Ppoll: wrong number of events: got %v, expected %v", n, 0)
348-
return
340+
for {
341+
n, err := unix.Ppoll(fds, &timeoutTs, nil)
342+
ok <- true
343+
if err == unix.EINTR {
344+
t.Log("Ppoll interrupted")
345+
continue
346+
} else if err != nil {
347+
t.Errorf("Ppoll: unexpected error: %v", err)
348+
return
349+
}
350+
if n != 0 {
351+
t.Errorf("Ppoll: wrong number of events: got %v, expected %v", n, 0)
352+
return
353+
}
354+
break
349355
}
350356
}
351357

0 commit comments

Comments
 (0)