From 389cc75f1016d9a058e8e1d8427a9aa21e7dfca1 Mon Sep 17 00:00:00 2001 From: Zeling Feng Date: Mon, 1 May 2023 13:40:04 -0700 Subject: [PATCH] Tune TCP syscall test Change the parameters for filling the send buffer: 1. Use a larger buffer to account for the fact that the real send buffer is larger than the size we set. 2. Use a longer sleep duration to reduce the chance of flakes. PiperOrigin-RevId: 528562364 --- test/syscalls/linux/tcp_socket.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/syscalls/linux/tcp_socket.cc b/test/syscalls/linux/tcp_socket.cc index 37b7add32..36bc57401 100644 --- a/test/syscalls/linux/tcp_socket.cc +++ b/test/syscalls/linux/tcp_socket.cc @@ -126,13 +126,13 @@ static void FillSocketBuffers(int sender, int receiver) { SyscallSucceedsWithValue(0)); // Create a large buffer that will be used for sending. - std::vector buf(1 << 16); + std::vector buf(buf_sz << 2); // Write until we receive an error. while (RetryEINTR(send)(sender, buf.data(), buf.size(), 0) != -1) { // Sleep to give linux a chance to move data from the send buffer to the // receive buffer. - usleep(10000); // 10ms. + usleep(100000); // 100ms. } // The last error should have been EWOULDBLOCK. ASSERT_EQ(errno, EWOULDBLOCK);