Skip to content

Commit aff56ec

Browse files
peterthejohnstongvisor-bot
authored andcommitted
Skip TCP_DEFER_ACCEPT test if we sleep for longer than timeout
FIXED: https://fxbug.dev/326254381 PiperOrigin-RevId: 615470990
1 parent d5f24ea commit aff56ec

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/syscalls/linux/socket_inet_loopback.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,7 +1571,13 @@ TEST_P(SocketInetLoopbackTest, TCPDeferAcceptTimeout) {
15711571

15721572
// Verify that there is no acceptable connection before TCP_DEFER_ACCEPT
15731573
// timeout is hit.
1574+
const auto start = absl::Now();
15741575
absl::SleepFor(absl::Seconds(kTCPDeferAccept - 1));
1576+
// It's possible that we ended up sleeping for longer than the
1577+
// TCP_DEFER_ACCEPT timeout. If this happens, skip this test.
1578+
if (absl::Now() >= start + absl::Seconds(kTCPDeferAccept)) {
1579+
GTEST_SKIP();
1580+
}
15751581
ASSERT_THAT(accept(listen_fd.get(), nullptr, nullptr),
15761582
SyscallFailsWithErrno(EWOULDBLOCK));
15771583

0 commit comments

Comments
 (0)