Skip to content

Commit 59a1497

Browse files
committed
unix: test returned fd in TestEpoll
Check the fd returned in EpollEvent to detect potential padding issues. Also, fail the test if the number of events mismatches. Updates golang/go#35479 Change-Id: I39f856ca2c336e849876a33acffb70b82aa83c3f Reviewed-on: https://go-review.googlesource.com/c/sys/+/206858 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
1 parent d32e6e3 commit 59a1497

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

unix/syscall_linux_test.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,11 @@ func TestEpoll(t *testing.T) {
693693
}
694694

695695
if n != 1 {
696-
t.Logf("EpollWait: wrong number of events: got %v, expected 1", n)
696+
t.Errorf("EpollWait: wrong number of events: got %v, expected 1", n)
697+
}
698+
699+
got := int(events[0].Fd)
700+
if got != fd {
701+
t.Errorf("EpollWait: wrong Fd in event: got %v, expected %v", got, fd)
697702
}
698703
}

0 commit comments

Comments
 (0)