[MTE] remove duplicate logic for mte_enabled
Test: mma
Change-Id: If60bcd80b649122927108ae61adb68ca225a4141
diff --git a/tests/heap_tagging_level_test.cpp b/tests/heap_tagging_level_test.cpp
index c0aa176..4defc5d 100644
--- a/tests/heap_tagging_level_test.cpp
+++ b/tests/heap_tagging_level_test.cpp
@@ -105,7 +105,7 @@
TEST(heap_tagging_level, sync_async_bad_accesses_die) {
#if defined(__BIONIC__) && defined(__aarch64__)
- if (!mte_supported() || !running_with_mte()) {
+ if (!mte_supported() || !mte_enabled()) {
GTEST_SKIP() << "requires MTE to be enabled";
}
@@ -177,7 +177,7 @@
EXPECT_FALSE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_ASYNC));
EXPECT_FALSE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_SYNC));
EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_NONE));
- } else if (mte_supported() && running_with_mte()) {
+ } else if (mte_supported() && mte_enabled()) {
// ASYNC -> ...
EXPECT_FALSE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_TBI));
EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_ASYNC));
@@ -211,7 +211,7 @@
#if defined(__BIONIC__) && defined(__aarch64__)
// We can't test SYNC -> NONE in tagging_level_transitions because we can only make one transition
// to NONE (which we use to test ASYNC -> NONE), so we test it here separately.
- if (!mte_supported() || !running_with_mte()) {
+ if (!mte_supported() || !mte_enabled()) {
GTEST_SKIP() << "requires MTE to be enabled";
}
diff --git a/tests/memtag_stack_dlopen_test.cpp b/tests/memtag_stack_dlopen_test.cpp
index 68ddb81..eb69a62 100644
--- a/tests/memtag_stack_dlopen_test.cpp
+++ b/tests/memtag_stack_dlopen_test.cpp
@@ -38,9 +38,13 @@
#include "mte_utils.h"
#include "utils.h"
+#if defined(__BIONIC__)
+#include <bionic/mte.h>
+#endif
+
TEST(MemtagStackDlopenTest, DependentBinaryGetsMemtagStack) {
#if defined(__BIONIC__) && defined(__aarch64__)
- if (!running_with_mte()) GTEST_SKIP() << "Test requires MTE.";
+ if (!mte_enabled()) GTEST_SKIP() << "Test requires MTE.";
if (is_stack_mte_on())
GTEST_SKIP() << "Stack MTE needs to be off for this test. Are you running fullmte?";
@@ -58,7 +62,7 @@
TEST(MemtagStackDlopenTest, DependentBinaryGetsMemtagStack2) {
#if defined(__BIONIC__) && defined(__aarch64__)
- if (!running_with_mte()) GTEST_SKIP() << "Test requires MTE.";
+ if (!mte_enabled()) GTEST_SKIP() << "Test requires MTE.";
if (is_stack_mte_on())
GTEST_SKIP() << "Stack MTE needs to be off for this test. Are you running fullmte?";
@@ -77,7 +81,7 @@
TEST(MemtagStackDlopenTest, DlopenRemapsStack) {
#if defined(__BIONIC__) && defined(__aarch64__)
// If this test is failing, look at crash logcat for why the test binary died.
- if (!running_with_mte()) GTEST_SKIP() << "Test requires MTE.";
+ if (!mte_enabled()) GTEST_SKIP() << "Test requires MTE.";
if (is_stack_mte_on())
GTEST_SKIP() << "Stack MTE needs to be off for this test. Are you running fullmte?";
@@ -98,7 +102,7 @@
TEST(MemtagStackDlopenTest, DlopenRemapsStack2) {
#if defined(__BIONIC__) && defined(__aarch64__)
// If this test is failing, look at crash logcat for why the test binary died.
- if (!running_with_mte()) GTEST_SKIP() << "Test requires MTE.";
+ if (!mte_enabled()) GTEST_SKIP() << "Test requires MTE.";
if (is_stack_mte_on())
GTEST_SKIP() << "Stack MTE needs to be off for this test. Are you running fullmte?";
diff --git a/tests/mte_test.cpp b/tests/mte_test.cpp
index 5eb804f..67db820 100644
--- a/tests/mte_test.cpp
+++ b/tests/mte_test.cpp
@@ -39,7 +39,7 @@
#endif
}
#if defined(__aarch64__)
- if (mte_supported() && running_with_mte()) {
+ if (mte_supported() && mte_enabled()) {
EXPECT_DEATH(
{
volatile int load ATTRIBUTE_UNUSED = *mistagged_p;