Merge "fortify: remove `static`"
diff --git a/tests/leak_test.cpp b/tests/leak_test.cpp
index e0a3d57..4ebf41f 100644
--- a/tests/leak_test.cpp
+++ b/tests/leak_test.cpp
@@ -109,23 +109,21 @@
// http://b/36045112
TEST(pthread_leak, join) {
+ SKIP_WITH_NATIVE_BRIDGE; // http://b/37920774
+
LeakChecker lc;
- for (size_t pass = 0; pass < 2; ++pass) {
- for (int i = 0; i < 100; ++i) {
- pthread_t thread;
- ASSERT_EQ(0, pthread_create(&thread, nullptr, [](void*) -> void* { return nullptr; }, nullptr));
- ASSERT_EQ(0, pthread_join(thread, nullptr));
- }
-
- // A native bridge implementation might need a warm up pass to reach a steady state.
- // http://b/37920774.
- if (pass == 0) lc.Reset();
+ for (int i = 0; i < 100; ++i) {
+ pthread_t thread;
+ ASSERT_EQ(0, pthread_create(&thread, nullptr, [](void*) -> void* { return nullptr; }, nullptr));
+ ASSERT_EQ(0, pthread_join(thread, nullptr));
}
}
// http://b/36045112
TEST(pthread_leak, detach) {
+ SKIP_WITH_NATIVE_BRIDGE; // http://b/37920774
+
LeakChecker lc;
// Ancient devices with only 2 cores need a lower limit.
@@ -158,8 +156,7 @@
WaitUntilAllThreadsExited(tids, thread_count);
- // A native bridge implementation might need a warm up pass to reach a steady state.
- // http://b/37920774.
+ // TODO(b/158573595): the test is flaky without the warmup pass.
if (pass == 0) lc.Reset();
}
}
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index d825738..851b86f 100644
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -2821,6 +2821,9 @@
}
TEST(pthread, pthread_create__mmap_failures) {
+ // After thread is successfully created, native_bridge might need more memory to run it.
+ SKIP_WITH_NATIVE_BRIDGE;
+
pthread_attr_t attr;
ASSERT_EQ(0, pthread_attr_init(&attr));
ASSERT_EQ(0, pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED));
diff --git a/tests/utils.h b/tests/utils.h
index a9b8513..c1b7f65 100644
--- a/tests/utils.h
+++ b/tests/utils.h
@@ -26,6 +26,10 @@
#include <unistd.h>
#if defined(__BIONIC__)
+#include <sys/system_properties.h>
+#endif
+
+#if defined(__BIONIC__)
#include <bionic/macros.h>
#else
#define untag_address(p) p
@@ -72,6 +76,21 @@
#define SKIP_WITH_HWASAN if (running_with_hwasan()) GTEST_SKIP()
+static inline bool running_with_native_bridge() {
+#if defined(__BIONIC__)
+#if defined(__arm__)
+ static const prop_info* pi = __system_property_find("ro.dalvik.vm.isa.arm");
+ return pi != nullptr;
+#elif defined(__aarch64__)
+ static const prop_info* pi = __system_property_find("ro.dalvik.vm.isa.arm64");
+ return pi != nullptr;
+#endif
+#endif
+ return false;
+}
+
+#define SKIP_WITH_NATIVE_BRIDGE if (running_with_native_bridge()) GTEST_SKIP()
+
#if defined(__linux__)
#include <sys/sysmacros.h>