From 60e4fec168d6be92d049743038f1a223765c47f0 Mon Sep 17 00:00:00 2001 From: Nayana Bidari Date: Wed, 7 Jun 2023 12:53:55 -0700 Subject: [PATCH] Set send bufer size in the test BlockingPartialWriteClosed. Fix the flaky test BlockingPartialWriteClosed by setting the send buffer size to disable auto-tuning. Before: http://sponge2/d5557791-88e3-491c-b3d8-733fcf4ca526 After: http://sponge2/4ee46189-c50a-4f49-a03c-7ed70d5dcf76 PiperOrigin-RevId: 538567854 --- test/syscalls/linux/socket_stream_blocking.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/syscalls/linux/socket_stream_blocking.cc b/test/syscalls/linux/socket_stream_blocking.cc index e168f79ff..7ea484e89 100644 --- a/test/syscalls/linux/socket_stream_blocking.cc +++ b/test/syscalls/linux/socket_stream_blocking.cc @@ -39,6 +39,13 @@ TEST_P(BlockingStreamSocketPairTest, BlockPartialWriteClosed) { auto sockets = ASSERT_NO_ERRNO_AND_VALUE(NewSocketPair()); + // Set the send buffer size which will disable auto tuning and will block the + // partial write while sending the data more than the send buffer size. + constexpr int kSndBufSz = INT_MAX; + ASSERT_THAT(setsockopt(sockets->first_fd(), SOL_SOCKET, SO_SNDBUF, &kSndBufSz, + sizeof(kSndBufSz)), + SyscallSucceeds()); + int buffer_size; socklen_t length = sizeof(buffer_size); ASSERT_THAT(getsockopt(sockets->first_fd(), SOL_SOCKET, SO_SNDBUF,