Remove a few glibc #if hacks.
We've updated the corresponding glibc headers so we don't need these
hacks any more.
Bug: http://b/318541070
Test: treehugger
Change-Id: Ic1974f30f9edb2589cc93041822706bc89909882
diff --git a/tests/fcntl_test.cpp b/tests/fcntl_test.cpp
index 47f3d91..57766ef 100644
--- a/tests/fcntl_test.cpp
+++ b/tests/fcntl_test.cpp
@@ -320,7 +320,6 @@
}
TEST(fcntl, open_O_TMPFILE_mode) {
-#if defined(__BIONIC__) // Our glibc is too old for O_TMPFILE.
TemporaryDir dir;
// Without O_EXCL, we're allowed to give this a name later.
// (This is unrelated to the O_CREAT interaction with O_EXCL.)
@@ -359,7 +358,6 @@
AT_SYMLINK_FOLLOW));
ASSERT_ERRNO(ENOENT);
ASSERT_EQ(0, close(fd));
-#endif
}
TEST_F(fcntl_DeathTest, fcntl_F_SETFD) {
diff --git a/tests/fortify_test.cpp b/tests/fortify_test.cpp
index 12ea21b..cb96f9f 100644
--- a/tests/fortify_test.cpp
+++ b/tests/fortify_test.cpp
@@ -1026,8 +1026,6 @@
}
TEST_F(DEATHTEST, open_O_TMPFILE_without_mode_fortified) {
-#if defined(__BIONIC__) // Our glibc is too old for O_TMPFILE.
int flags = O_TMPFILE; // Fool the compiler.
ASSERT_FORTIFY(open("", flags));
-#endif
}
diff --git a/tests/ifaddrs_test.cpp b/tests/ifaddrs_test.cpp
index 95562be..b3ab94d 100644
--- a/tests/ifaddrs_test.cpp
+++ b/tests/ifaddrs_test.cpp
@@ -20,13 +20,16 @@
#include <dirent.h>
#include <fcntl.h>
-#include <linux/if_packet.h>
#include <net/ethernet.h>
#include <net/if.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
+// (glibc as of 2.37 has redefinitions if you include these before <net/if.h>.)
+#include <linux/if.h>
+#include <linux/if_packet.h>
+
#include <algorithm>
#include <map>
#include <thread>
@@ -211,15 +214,9 @@
if ((flags & IFF_PORTSEL) != 0) result += " PORTSEL";
if ((flags & IFF_AUTOMEDIA) != 0) result += " AUTOMEDIA";
if ((flags & IFF_DYNAMIC) != 0) result += " DYNAMIC";
-#if defined(IFF_LOWER_UP)
if ((flags & IFF_LOWER_UP) != 0) result += " LOWER_UP";
-#endif
-#if defined(IFF_DORMANT)
if ((flags & IFF_DORMANT) != 0) result += " DORMANT";
-#endif
-#if defined(IFF_ECHO)
if ((flags & IFF_ECHO) != 0) result += " ECHO";
-#endif
return result;
}
diff --git a/tests/sys_prctl_test.cpp b/tests/sys_prctl_test.cpp
index bbc1c67..ea36d8a 100644
--- a/tests/sys_prctl_test.cpp
+++ b/tests/sys_prctl_test.cpp
@@ -35,7 +35,6 @@
// http://b/20017123.
TEST(sys_prctl, bug_20017123) {
-#if defined(PR_SET_VMA) // PR_SET_VMA is only available in Android kernels.
size_t page_size = static_cast<size_t>(sysconf(_SC_PAGESIZE));
void* p = mmap(NULL, page_size * 3, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
ASSERT_NE(MAP_FAILED, p);
@@ -62,15 +61,9 @@
}
ASSERT_EQ(0, munmap(p, page_size * 3));
-#else
- GTEST_SKIP() << "PR_SET_VMA not available";
-#endif
}
TEST(sys_prctl, pr_cap_ambient) {
-// PR_CAP_AMBIENT was introduced in v4.3. Android devices should always
-// have a backport, but we can't guarantee it's available on the host.
-#if defined(__ANDROID__) || defined(PR_CAP_AMBIENT)
const std::string caps_sha =
"https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/"
"?id=58319057b7847667f0c9585b9de0e8932b0fdb08";
@@ -113,7 +106,4 @@
err = prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_LOWER, ULONG_MAX, 0, 0);
EXPECT_EQ(-1, err);
EXPECT_ERRNO(EINVAL);
-#else
- GTEST_SKIP() << "PR_CAP_AMBIENT not available";
-#endif
}