Add util to skip tests with native_bridge
Bug: 37920774
Bug: 157394871
Test: bionic-unit-tests
Change-Id: Id949c9e568fd068daaf405a377813ee1480c2df7
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>