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>
diff --git a/unix/syscall_linux_test.go b/unix/syscall_linux_test.go
index d3161d6..2feb5a1 100644
--- a/unix/syscall_linux_test.go
+++ b/unix/syscall_linux_test.go
@@ -693,6 +693,11 @@
 	}
 
 	if n != 1 {
-		t.Logf("EpollWait: wrong number of events: got %v, expected 1", n)
+		t.Errorf("EpollWait: wrong number of events: got %v, expected 1", n)
+	}
+
+	got := int(events[0].Fd)
+	if got != fd {
+		t.Errorf("EpollWait: wrong Fd in event: got %v, expected %v", got, fd)
 	}
 }