Merge "The host prebuilt glibc is 2.11, so remove workarounds for 2.9."

This commit is contained in:
Elliott Hughes 2014-08-29 18:12:36 +00:00 committed by Gerrit Code Review
commit 1f39afc8d4

View file

@ -23,13 +23,9 @@
#include <fcntl.h> #include <fcntl.h>
#if defined(__BIONIC__) #if defined(__BIONIC__)
#define ACCEPT4_SUPPORTED 1
#define RECVMMSG_SUPPORTED 1 #define RECVMMSG_SUPPORTED 1
#define SENDMMSG_SUPPORTED 1 #define SENDMMSG_SUPPORTED 1
#elif defined(__GLIBC_PREREQ) #elif defined(__GLIBC_PREREQ)
#if __GLIBC_PREREQ(2, 9)
#define ACCEPT4_SUPPORTED 1
#endif
#if __GLIBC_PREREQ(2, 12) #if __GLIBC_PREREQ(2, 12)
#define RECVMMSG_SUPPORTED 1 #define RECVMMSG_SUPPORTED 1
#endif #endif
@ -38,8 +34,6 @@
#endif #endif
#endif #endif
#if defined(ACCEPT4_SUPPORTED) || defined(RECVMMSG_SUPPORTED) || defined(SENDMMSG_SUPPORTED)
#define SOCK_PATH "test" #define SOCK_PATH "test"
static void* ConnectFn(void* data) { static void* ConnectFn(void* data) {
@ -105,18 +99,12 @@ static void RunTest(void (*test_fn)(struct sockaddr_un*, int),
close(fd); close(fd);
} }
#endif
TEST(sys_socket, accept4_error) { TEST(sys_socket, accept4_error) {
#if defined(ACCEPT4_SUPPORTED)
ASSERT_EQ(-1, accept4(-1, NULL, NULL, 0)); ASSERT_EQ(-1, accept4(-1, NULL, NULL, 0));
ASSERT_EQ(EBADF, errno); ASSERT_EQ(EBADF, errno);
#else
GTEST_LOG_(INFO) << "This test does nothing.\n";
#endif
} }
#if defined(ACCEPT4_SUPPORTED)
static void TestAccept4(struct sockaddr_un* addr, int fd) { static void TestAccept4(struct sockaddr_un* addr, int fd) {
socklen_t len = sizeof(*addr); socklen_t len = sizeof(*addr);
int fd_acc = accept4(fd, reinterpret_cast<struct sockaddr*>(addr), &len, SOCK_CLOEXEC); int fd_acc = accept4(fd, reinterpret_cast<struct sockaddr*>(addr), &len, SOCK_CLOEXEC);
@ -127,14 +115,9 @@ static void TestAccept4(struct sockaddr_un* addr, int fd) {
close(fd_acc); close(fd_acc);
} }
#endif
TEST(sys_socket, accept4_smoke) { TEST(sys_socket, accept4_smoke) {
#if defined(ACCEPT4_SUPPORTED)
RunTest(TestAccept4, NULL); RunTest(TestAccept4, NULL);
#else
GTEST_LOG_(INFO) << "This test does nothing.\n";
#endif
} }
#if defined(RECVMMSG_SUPPORTED) #if defined(RECVMMSG_SUPPORTED)