diff options
author | Zhaozhong Ni <nzz@google.com> | 2018-12-20 09:51:26 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-12-20 09:52:27 -0800 |
commit | 25d62850ce8a420600194009a7257148c43cc5f8 (patch) | |
tree | ba0ac7b134be5fd6400b8559edee91189773bf85 | |
parent | 86c9bd254749ebf65270aa60f728d9c847ac02d4 (diff) |
test: deflake socket_inet_loopback.
PiperOrigin-RevId: 226350590
Change-Id: Idff080705f644f8f78ce92b53c77eecc37e002e7
-rw-r--r-- | test/syscalls/linux/socket_inet_loopback.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/syscalls/linux/socket_inet_loopback.cc b/test/syscalls/linux/socket_inet_loopback.cc index 7bdbd7797..17a46e149 100644 --- a/test/syscalls/linux/socket_inet_loopback.cc +++ b/test/syscalls/linux/socket_inet_loopback.cc @@ -185,7 +185,12 @@ TEST_P(SocketInetLoopbackTest, TCP) { SyscallSucceeds()); // Accept the connection. - ASSERT_NO_ERRNO_AND_VALUE(Accept(listen_fd.get(), nullptr, nullptr)); + // + // We have to assign a name to the accepted socket, as unamed temporary + // objects are destructed upon full evaluation of the expression it is in, + // potentially causing the connecting socket to fail to shutdown properly. + auto accepted = + ASSERT_NO_ERRNO_AND_VALUE(Accept(listen_fd.get(), nullptr, nullptr)); ASSERT_THAT(shutdown(listen_fd.get(), SHUT_RDWR), SyscallSucceeds()); |