diff options
author | Mark Salyzyn <salyzyn@google.com> | 2016-11-04 19:51:07 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-11-04 19:51:07 +0000 |
commit | d32e7f4703d329104941828d5280f4f05438a489 (patch) | |
tree | b022f36982d4e26822d51033d3045a8b32e8b4ad /libcutils | |
parent | dbd8df7b642cbc36a36d6bc86f74d16d7d5c24bf (diff) | |
parent | 8d339e940fb6aab288287139cdc3617c52d7ae00 (diff) | |
download | core-d32e7f4703d329104941828d5280f4f05438a489.tar.gz core-d32e7f4703d329104941828d5280f4f05438a489.tar.bz2 core-d32e7f4703d329104941828d5280f4f05438a489.zip |
Merge "libcutils: sockets_test breaks MAC build"
am: 8d339e940f
Change-Id: I4dbc000a63c45f82a32012629eec855c60c17b5a
Diffstat (limited to 'libcutils')
-rw-r--r-- | libcutils/tests/sockets_test.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/libcutils/tests/sockets_test.cpp b/libcutils/tests/sockets_test.cpp index 82961a48f..adfbf4ad3 100644 --- a/libcutils/tests/sockets_test.cpp +++ b/libcutils/tests/sockets_test.cpp @@ -190,8 +190,16 @@ TEST(SocketsTest, TestSocketSendBuffersFailure) { EXPECT_EQ(-1, socket_send_buffers(INVALID_SOCKET, nullptr, 0)); } +#ifndef SOCK_NONBLOCK +#define SOCK_NONBLOCK 0 +#endif + +#ifndef SOCK_CLOEXEC +#define SOCK_CLOEXEC 0 +#endif + TEST(SocketsTest, android_get_control_socket) { - static const char key[] = ANDROID_SOCKET_ENV_PREFIX "SocketsTest.android_get_control_socket"; + static const char key[] = ANDROID_SOCKET_ENV_PREFIX "SocketsTest_android_get_control_socket"; static const char* name = key + strlen(ANDROID_SOCKET_ENV_PREFIX); EXPECT_EQ(unsetenv(key), 0); @@ -199,6 +207,11 @@ TEST(SocketsTest, android_get_control_socket) { int fd; ASSERT_GE(fd = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0), 0); +#ifdef F_GETFL + int flags; + ASSERT_GE(flags = fcntl(fd, F_GETFL), 0); + ASSERT_GE(fcntl(fd, F_SETFL, flags | O_NONBLOCK), 0); +#endif EXPECT_EQ(android_get_control_socket(name), -1); struct sockaddr_un addr; |