diff options
Diffstat (limited to 'test/syscalls/linux')
-rw-r--r-- | test/syscalls/linux/socket_stream_blocking.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/test/syscalls/linux/socket_stream_blocking.cc b/test/syscalls/linux/socket_stream_blocking.cc index a04f2d7d0..8b3f6a647 100644 --- a/test/syscalls/linux/socket_stream_blocking.cc +++ b/test/syscalls/linux/socket_stream_blocking.cc @@ -62,12 +62,14 @@ TEST_P(BlockingStreamSocketPairTest, BlockPartialWriteClosed) { }); // Leave time for write to become blocked. - absl::SleepFor(absl::Seconds(1.0)); + absl::SleepFor(absl::Seconds(1)); ASSERT_THAT(close(sockets->release_second_fd()), SyscallSucceeds()); } -TEST_P(BlockingStreamSocketPairTest, SendMsgTooLarge) { +// Random save may interrupt the call to sendmsg() in SendLargeSendMsg(), +// causing the write to be incomplete and the test to hang. +TEST_P(BlockingStreamSocketPairTest, SendMsgTooLarge_NoRandomSave) { auto sockets = ASSERT_NO_ERRNO_AND_VALUE(NewSocketPair()); int sndbuf; @@ -142,11 +144,15 @@ TEST_P(BlockingStreamSocketPairTest, SendTimeout) { setsockopt(sockets->first_fd(), SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)), SyscallSucceeds()); - char buf[100] = {}; + std::vector<char> buf(kPageSize); + // We don't know how much data the socketpair will buffer, so we may do an + // arbitrarily large number of writes; saving after each write causes this + // test's time to explode. + const DisableSave ds; for (;;) { int ret; ASSERT_THAT( - ret = RetryEINTR(send)(sockets->first_fd(), buf, sizeof(buf), 0), + ret = RetryEINTR(send)(sockets->first_fd(), buf.data(), buf.size(), 0), ::testing::AnyOf(SyscallSucceeds(), SyscallFailsWithErrno(EAGAIN))); if (ret == -1) { break; |