Add util to skip tests with native_bridge
Bug: 37920774
Bug: 157394871
Test: bionic-unit-tests
Change-Id: Id949c9e568fd068daaf405a377813ee1480c2df7
(cherry picked from commit b56d1182d1067e70910584cf0c8fd797a262d82a)
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;