diff options
author | Bhasker Hariharan <bhaskerh@google.com> | 2021-02-18 15:58:50 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-02-18 16:00:38 -0800 |
commit | ec7f44f36b57c8472a692cdd736ad721c5170ee2 (patch) | |
tree | bc432a0248fd3b7327c630787b15fedef768f9b3 /test/syscalls/linux | |
parent | f80a857a4f5f57908c64a22f5de0e07df722227d (diff) |
Make socketops reflect correct sndbuf value for host UDS.
Also skips a test if the setsockopt to increase send buffer did not result in an
increase. This is possible when the underlying socket is a host backed unix
domain socket as in such cases gVisor does not permit increasing SO_SNDBUF.
PiperOrigin-RevId: 358285158
Diffstat (limited to 'test/syscalls/linux')
-rw-r--r-- | test/syscalls/linux/socket_unix_seqpacket.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/test/syscalls/linux/socket_unix_seqpacket.cc b/test/syscalls/linux/socket_unix_seqpacket.cc index eb373373d..d6e7031c0 100644 --- a/test/syscalls/linux/socket_unix_seqpacket.cc +++ b/test/syscalls/linux/socket_unix_seqpacket.cc @@ -91,7 +91,20 @@ TEST_P(SeqpacketUnixSocketPairTest, IncreasedSocketSendBufUnblocksWrites) { setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &buf_size, sizeof(buf_size)), SyscallSucceeds()); - // The send should succeed again. + // Skip test if the setsockopt didn't increase the sendbuf. This happens for + // tests where the socket is a host fd where gVisor does not permit increasing + // send buffer size. + int new_buf_size = 0; + buf_size_len = sizeof(new_buf_size); + ASSERT_THAT( + getsockopt(sock, SOL_SOCKET, SO_SNDBUF, &new_buf_size, &buf_size_len), + SyscallSucceeds()); + if (IsRunningOnGvisor() && (new_buf_size <= buf_size)) { + GTEST_SKIP() << "Skipping test new send buffer size " << new_buf_size + << " is the same as the value before setsockopt, " + << " socket is probably a host backed socket." << std ::endl; + } + // send should succeed again. ASSERT_THAT(RetryEINTR(send)(sock, buf.data(), buf.size(), 0), SyscallSucceeds()); } |