Merge "Avoid printing char16_t* and wchar_t to gtest Message" into main
diff --git a/README.md b/README.md
index 9a44934..32dda04 100644
--- a/README.md
+++ b/README.md
@@ -101,10 +101,18 @@
upstream-freebsd/
upstream-netbsd/
upstream-openbsd/
- # These directories contain unmolested upstream source. Any time we can
- # just use a BSD implementation of something unmodified, we should.
- # The structure under these directories mimics the upstream tree,
- # but there's also...
+ # These directories contain upstream source with no local changes.
+ # Any time we can just use a BSD implementation of something unmodified,
+ # we should. Ideally these should probably have been three separate git
+ # projects in external/, but they're here instead mostly by historical
+ # accident (because it wouldn't have been easy to import just the tiny
+ # subset of these operating systems that -- unlike Android -- just have
+ # one huge repository rather than lots of little ones and a mechanism
+ # like our `repo` tool).
+ # The structure under these directories mimics the relevant upstream tree,
+ # but in order to actually be able to compile this code in our tree
+ # _without_ making modifications to the source files directly, we also
+ # have the following subdirectories in each one that aren't upstream:
android/
include/
# This is where we keep the hacks necessary to build BSD source
diff --git a/libc/system_properties/Android.bp b/libc/system_properties/Android.bp
index af8bda9..a9bdeb5 100644
--- a/libc/system_properties/Android.bp
+++ b/libc/system_properties/Android.bp
@@ -32,6 +32,9 @@
"bionic/libstdc++/include",
],
export_include_dirs: ["include"],
+ apex_available: [
+ "com.android.runtime",
+ ],
}
cc_benchmark {
diff --git a/libc/system_properties/prop_area.cpp b/libc/system_properties/prop_area.cpp
index d5693b9..4668eed 100644
--- a/libc/system_properties/prop_area.cpp
+++ b/libc/system_properties/prop_area.cpp
@@ -41,7 +41,7 @@
#include <async_safe/log.h>
-constexpr size_t PA_SIZE = 256 * 1024;
+constexpr size_t PA_SIZE = 128 * 1024;
constexpr uint32_t PROP_AREA_MAGIC = 0x504f5250;
constexpr uint32_t PROP_AREA_VERSION = 0xfc6ed0ab;
diff --git a/libdl/Android.bp b/libdl/Android.bp
index 3bda856..c7d7cf3 100644
--- a/libdl/Android.bp
+++ b/libdl/Android.bp
@@ -47,6 +47,9 @@
sanitize: {
never: true,
},
+ apex_available: [
+ "com.android.runtime",
+ ],
}
cc_library {
diff --git a/linker/Android.bp b/linker/Android.bp
index 2ca962a..4787d87 100644
--- a/linker/Android.bp
+++ b/linker/Android.bp
@@ -146,12 +146,18 @@
// Ensure that the compiler won't insert string function calls before ifuncs are resolved.
cflags: ["-ffreestanding"],
+ apex_available: [
+ "com.android.runtime",
+ ],
}
cc_library_static {
name: "liblinker_malloc",
defaults: ["linker_defaults", "linker_all_targets"],
srcs: ["linker_memory.cpp"],
+ apex_available: [
+ "com.android.runtime",
+ ],
}
cc_library_static {
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_hwprobe_test.cpp b/tests/sys_hwprobe_test.cpp
index 3c8dce2..6b74e18 100644
--- a/tests/sys_hwprobe_test.cpp
+++ b/tests/sys_hwprobe_test.cpp
@@ -41,19 +41,10 @@
EXPECT_EQ(RISCV_HWPROBE_KEY_IMA_EXT_0, probes[0].key);
EXPECT_TRUE((probes[0].value & RISCV_HWPROBE_IMA_FD) != 0);
EXPECT_TRUE((probes[0].value & RISCV_HWPROBE_IMA_C) != 0);
- // TODO: remove #define when our uapi headers are new enough.
-#define RISCV_HWPROBE_IMA_V (1 << 2)
EXPECT_TRUE((probes[0].value & RISCV_HWPROBE_IMA_V) != 0);
- // TODO: remove #ifs when our kernel is new enough.
-#if defined(RISCV_HWPROBE_EXT_ZBA)
EXPECT_TRUE((probes[0].value & RISCV_HWPROBE_EXT_ZBA) != 0);
-#endif
-#if defined(RISCV_HWPROBE_EXT_ZBB)
EXPECT_TRUE((probes[0].value & RISCV_HWPROBE_EXT_ZBB) != 0);
-#endif
-#if defined(RISCV_HWPROBE_EXT_ZBS)
EXPECT_TRUE((probes[0].value & RISCV_HWPROBE_EXT_ZBS) != 0);
-#endif
EXPECT_EQ(RISCV_HWPROBE_KEY_CPUPERF_0, probes[1].key);
EXPECT_TRUE((probes[1].value & RISCV_HWPROBE_MISALIGNED_MASK) == RISCV_HWPROBE_MISALIGNED_FAST);
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
}
diff --git a/tests/system_properties_test.cpp b/tests/system_properties_test.cpp
index dff92ea..0b7f5ae 100644
--- a/tests/system_properties_test.cpp
+++ b/tests/system_properties_test.cpp
@@ -593,7 +593,7 @@
ASSERT_TRUE(system_properties.valid());
auto name = "ro.super_long_property"s;
- auto value = std::string(256 * 1024 + 1, 'x');
+ auto value = std::string(128 * 1024 + 1, 'x');
ASSERT_NE(0, system_properties.Add(name.c_str(), name.size(), value.c_str(), value.size()));
#else // __BIONIC__