Use SKIP_WITH_HWASAN macro from libbase.
Change-Id: I83681d2191bf4184e52d84d1107d61065927bb24
diff --git a/libc/malloc_debug/Android.bp b/libc/malloc_debug/Android.bp
index 5aea771..7ff3db2 100644
--- a/libc/malloc_debug/Android.bp
+++ b/libc/malloc_debug/Android.bp
@@ -133,7 +133,6 @@
include_dirs: [
"bionic/libc",
"bionic/libc/async_safe/include",
- "bionic", // For SKIP_WITH_HWASAN.
],
header_libs: [
diff --git a/libc/malloc_debug/tests/malloc_debug_system_tests.cpp b/libc/malloc_debug/tests/malloc_debug_system_tests.cpp
index 5843702..92679e4 100644
--- a/libc/malloc_debug/tests/malloc_debug_system_tests.cpp
+++ b/libc/malloc_debug/tests/malloc_debug_system_tests.cpp
@@ -41,6 +41,7 @@
#include <android-base/file.h>
#include <android-base/stringprintf.h>
+#include <android-base/test_utils.h>
#include <gtest/gtest.h>
#include <log/log_read.h>
diff --git a/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp b/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
index 84f0645..ea2dc78 100644
--- a/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
+++ b/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
@@ -40,10 +40,10 @@
#include <android-base/file.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
+#include <android-base/test_utils.h>
#include <platform/bionic/macros.h>
#include <private/bionic_malloc_dispatch.h>
-#include <tests/utils.h>
#include <unwindstack/Unwinder.h>
diff --git a/libc/malloc_hooks/tests/malloc_hooks_tests.cpp b/libc/malloc_hooks/tests/malloc_hooks_tests.cpp
index d16270f..3ff2537 100644
--- a/libc/malloc_hooks/tests/malloc_hooks_tests.cpp
+++ b/libc/malloc_hooks/tests/malloc_hooks_tests.cpp
@@ -38,6 +38,7 @@
#include <gtest/gtest.h>
+#include <android-base/test_utils.h>
#include <bionic/malloc.h>
#include <private/bionic_malloc_dispatch.h>
#include <tests/utils.h>
diff --git a/tests/dl_test.cpp b/tests/dl_test.cpp
index bf32bd5..a61586b 100644
--- a/tests/dl_test.cpp
+++ b/tests/dl_test.cpp
@@ -34,6 +34,7 @@
#include "gtest_globals.h"
#include <android-base/file.h>
+#include <android-base/test_utils.h>
#include "utils.h"
extern "C" int main_global_default_serial() {
diff --git a/tests/getcwd_test.cpp b/tests/getcwd_test.cpp
index 97b1d4f..4fec40b 100644
--- a/tests/getcwd_test.cpp
+++ b/tests/getcwd_test.cpp
@@ -20,6 +20,8 @@
#include <limits.h>
#include <unistd.h>
+#include <android-base/test_utils.h>
+
#include "utils.h"
TEST(getcwd, auto_full) {
diff --git a/tests/heap_tagging_level_test.cpp b/tests/heap_tagging_level_test.cpp
index c493e1d..96c2ffd 100644
--- a/tests/heap_tagging_level_test.cpp
+++ b/tests/heap_tagging_level_test.cpp
@@ -26,6 +26,7 @@
#include "SignalUtils.h"
+#include <android-base/test_utils.h>
#include <bionic/malloc_tagged_pointers.h>
static bool KernelSupportsTaggedPointers() {
diff --git a/tests/malloc_iterate_test.cpp b/tests/malloc_iterate_test.cpp
index e896c90..297f637 100644
--- a/tests/malloc_iterate_test.cpp
+++ b/tests/malloc_iterate_test.cpp
@@ -26,6 +26,7 @@
#include <vector>
+#include <android-base/test_utils.h>
#include <async_safe/log.h>
#include <procinfo/process_map.h>
diff --git a/tests/malloc_test.cpp b/tests/malloc_test.cpp
index f157ec4..1b875cd 100644
--- a/tests/malloc_test.cpp
+++ b/tests/malloc_test.cpp
@@ -41,6 +41,7 @@
#include <tinyxml2.h>
#include <android-base/file.h>
+#include <android-base/test_utils.h>
#include "utils.h"
diff --git a/tests/stdlib_test.cpp b/tests/stdlib_test.cpp
index 6dbd741..465e61a 100644
--- a/tests/stdlib_test.cpp
+++ b/tests/stdlib_test.cpp
@@ -33,6 +33,7 @@
#include <android-base/file.h>
#include <android-base/macros.h>
#include <android-base/silent_death_test.h>
+#include <android-base/test_utils.h>
#include <gtest/gtest.h>
#include "math_data_test.h"
diff --git a/tests/utils.h b/tests/utils.h
index 284140a..a62dde6 100644
--- a/tests/utils.h
+++ b/tests/utils.h
@@ -69,14 +69,6 @@
return (dlopen("libc.so", 0) != nullptr);
}
-extern "C" void __hwasan_init() __attribute__((weak));
-
-static inline bool running_with_hwasan() {
- return &__hwasan_init != 0;
-}
-
-#define SKIP_WITH_HWASAN if (running_with_hwasan()) GTEST_SKIP()
-
static inline bool running_with_native_bridge() {
#if defined(__BIONIC__)
static const prop_info* pi = __system_property_find("ro.dalvik.vm.isa." ABI_STRING);