diff options
author | Ian Gudger <igudger@google.com> | 2019-01-14 13:06:16 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-01-14 13:07:29 -0800 |
commit | 003eedea1c66d3ff07b28accb46bbe9abfa8c89c (patch) | |
tree | a1a2d49882c73720c6f7af4e58af09670e48b3c7 /test | |
parent | 36f5468e7a917f0997689927a9dfb70841e174f4 (diff) |
Deflake RecvLessThanBufferWaitAll.
PiperOrigin-RevId: 229238781
Change-Id: Ib5a1e46293583efcb09e255fcd400c3fcc53ef1b
Diffstat (limited to 'test')
-rw-r--r-- | test/syscalls/linux/socket_stream_blocking.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/test/syscalls/linux/socket_stream_blocking.cc b/test/syscalls/linux/socket_stream_blocking.cc index 6cfadc9da..a04f2d7d0 100644 --- a/test/syscalls/linux/socket_stream_blocking.cc +++ b/test/syscalls/linux/socket_stream_blocking.cc @@ -98,7 +98,10 @@ TEST_P(BlockingStreamSocketPairTest, RecvLessThanBuffer) { SyscallSucceedsWithValue(sizeof(sent_data))); } -TEST_P(BlockingStreamSocketPairTest, RecvLessThanBufferWaitAll) { +// Test that MSG_WAITALL causes recv to block until all requested data is +// received. Random save can interrupt blocking and cause received data to be +// returned, even if the amount received is less than the full requested amount. +TEST_P(BlockingStreamSocketPairTest, RecvLessThanBufferWaitAll_NoRandomSave) { auto sockets = ASSERT_NO_ERRNO_AND_VALUE(NewSocketPair()); char sent_data[100]; @@ -112,6 +115,10 @@ TEST_P(BlockingStreamSocketPairTest, RecvLessThanBufferWaitAll) { const ScopedThread t([&]() { absl::SleepFor(kDuration); + + // Don't let saving after the write interrupt the blocking recv. + const DisableSave ds; + ASSERT_THAT(write(sockets->first_fd(), sent_data, sizeof(sent_data)), SyscallSucceedsWithValue(sizeof(sent_data))); }); |