Merge changes I42a81210,I42ce2b5a,Id949c9e5 into android11-tests-dev
* changes:
Skip android_unsafe_frame_pointer_chase.pthread with native bridge
Skip pthread.pthread_create__mmap_failures with native_bridge
Add util to skip tests with native_bridge
diff --git a/tests/Android.bp b/tests/Android.bp
index 8b1eebc..f215e60 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -308,6 +308,9 @@
cflags: [
"-fno-omit-frame-pointer",
],
+ static_libs: [
+ "libbase",
+ ],
}
// -----------------------------------------------------------------------------
diff --git a/tests/android_unsafe_frame_pointer_chase_test.cpp b/tests/android_unsafe_frame_pointer_chase_test.cpp
index 7fa50e1..5b436ff 100644
--- a/tests/android_unsafe_frame_pointer_chase_test.cpp
+++ b/tests/android_unsafe_frame_pointer_chase_test.cpp
@@ -22,6 +22,8 @@
#include "platform/bionic/android_unsafe_frame_pointer_chase.h"
+#include "utils.h"
+
// Prevent tail calls inside recurse.
__attribute__((weak, noinline)) size_t nop(size_t val) {
return val;
@@ -94,6 +96,10 @@
}
TEST(android_unsafe_frame_pointer_chase, pthread) {
+ // Android11 missed the fix (r.android.com/1382566) so disabling the test.
+ // It will be re-enabled in the next releases.
+ SKIP_WITH_NATIVE_BRIDGE;
+
pthread_t t;
ASSERT_EQ(0, pthread_create(&t, nullptr, BacktraceThread, nullptr));
void* retval;
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 5014ef7..34283a0 100644
--- a/tests/utils.h
+++ b/tests/utils.h
@@ -25,6 +25,10 @@
#include <sys/wait.h>
#include <unistd.h>
+#if defined(__BIONIC__)
+#include <sys/system_properties.h>
+#endif
+
#include <atomic>
#include <string>
#include <regex>
@@ -66,6 +70,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()
+
static inline void* untag_address(void* addr) {
#if defined(__LP64__)
constexpr uintptr_t mask = (static_cast<uintptr_t>(1) << 56) - 1;