mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-06 09:07:16 -04:00
unix: don't fail TestPoll on EINTR from Poll
Occassionaly TestPoll fails on some builders due to Poll getting
interrupted:
--- FAIL: TestPoll (0.00s)
syscall_unix_test.go:516: Poll: unexpected error: interrupted system call
FAIL
FAIL golang.org/x/sys/unix 0.956s
Fix this by retrying Poll in case of EINTR, same as CL 207861 did in
TestSelect.
Change-Id: I78ada14d7409e6cde852d76abd5a9a1b1bb645d2
Reviewed-on: https://go-review.googlesource.com/c/sys/+/298189
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
This commit is contained in:
committed by
Tobias Klauser
parent
8fe3ee5dd7
commit
88b6017d06
+15
-10
@@ -509,16 +509,21 @@ func TestPoll(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
fds := []unix.PollFd{{Fd: int32(f.Fd()), Events: unix.POLLIN}}
|
for {
|
||||||
n, err := unix.Poll(fds, timeout)
|
fds := []unix.PollFd{{Fd: int32(f.Fd()), Events: unix.POLLIN}}
|
||||||
ok <- true
|
n, err := unix.Poll(fds, timeout)
|
||||||
if err != nil {
|
ok <- true
|
||||||
t.Errorf("Poll: unexpected error: %v", err)
|
if err == unix.EINTR {
|
||||||
return
|
t.Logf("Poll interrupted")
|
||||||
}
|
continue
|
||||||
if n != 0 {
|
} else if err != nil {
|
||||||
t.Errorf("Poll: wrong number of events: got %v, expected %v", n, 0)
|
t.Errorf("Poll: unexpected error: %v", err)
|
||||||
return
|
return
|
||||||
|
}
|
||||||
|
if n != 0 {
|
||||||
|
t.Errorf("Poll: wrong number of events: got %v, expected %v", n, 0)
|
||||||
|
}
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user