From bdc192cf4b2c80c7cf0df31fb609af92f3085445 Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Thu, 22 Jun 2023 16:39:47 -0700 Subject: [PATCH] Simplify MemtagNoteTests It's easier to just disable hwasan than to handle it in the test. Change-Id: I511c63ae8916e03d33984a749f279fabbd0a75e3 --- tests/heap_tagging_level_test.cpp | 9 ++------- tests/libs/Android.bp | 8 ++++++++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/heap_tagging_level_test.cpp b/tests/heap_tagging_level_test.cpp index a5abb7b2a..5d85e9792 100644 --- a/tests/heap_tagging_level_test.cpp +++ b/tests/heap_tagging_level_test.cpp @@ -231,18 +231,13 @@ TEST_P(MemtagNoteTest, SEGV) { } // Note that we do not check running_with_hwasan() - what matters here is whether the test binary // itself is built with HWASan. - bool withHWASAN = __has_feature(hwaddress_sanitizer); bool withMTE = getauxval(AT_HWCAP2) & HWCAP2_MTE; - const char* kExpectedOutputHWASAN[] = {".*tag-mismatch.*", ".*tag-mismatch.*", - ".*tag-mismatch.*"}; // Note that we do not check the exact si_code of the "async" variant, as it may be auto-upgraded // to asymm or even sync. const char* kExpectedOutputMTE[] = {"normal exit\n", "SEGV_MTE[AS]ERR\n", "SEGV_MTESERR\n"}; const char* kExpectedOutputNonMTE[] = {"normal exit\n", "normal exit\n", "normal exit\n"}; - const char** kExpectedOutput = - withHWASAN ? kExpectedOutputHWASAN : (withMTE ? kExpectedOutputMTE : kExpectedOutputNonMTE); - const int kExpectedExitStatus = withHWASAN ? -SIGABRT : 0; + const char** kExpectedOutput = withMTE ? kExpectedOutputMTE : kExpectedOutputNonMTE; MemtagNote note = std::get<0>(GetParam()); bool isStatic = std::get<1>(GetParam()); @@ -252,7 +247,7 @@ TEST_P(MemtagNoteTest, SEGV) { chmod(helper.c_str(), 0755); ExecTestHelper eth; eth.SetArgs({helper.c_str(), nullptr}); - eth.Run([&]() { execve(helper.c_str(), eth.GetArgs(), eth.GetEnv()); }, kExpectedExitStatus, + eth.Run([&]() { execve(helper.c_str(), eth.GetArgs(), eth.GetEnv()); }, 0, kExpectedOutput[static_cast(note)]); #else GTEST_SKIP() << "bionic/arm64 only"; diff --git a/tests/libs/Android.bp b/tests/libs/Android.bp index a2fbe5532..51f5ac600 100644 --- a/tests/libs/Android.bp +++ b/tests/libs/Android.bp @@ -1621,6 +1621,7 @@ cc_test { diag: { memtag_heap: true, }, + hwaddress: false, }, } @@ -1633,6 +1634,7 @@ cc_test { diag: { memtag_heap: false, }, + hwaddress: false, }, } @@ -1642,6 +1644,7 @@ cc_test { srcs: ["heap_tagging_helper.cpp"], sanitize: { memtag_heap: false, + hwaddress: false, }, } @@ -1655,6 +1658,7 @@ cc_test { diag: { memtag_heap: true, }, + hwaddress: false, }, } @@ -1668,6 +1672,7 @@ cc_test { diag: { memtag_heap: false, }, + hwaddress: false, }, } @@ -1678,6 +1683,7 @@ cc_test { static_executable: true, sanitize: { memtag_heap: false, + hwaddress: false, }, } @@ -1691,6 +1697,7 @@ cc_test { diag: { memtag_heap: true, }, + hwaddress: false, }, header_libs: ["bionic_libc_platform_headers"], cflags: ["-fexceptions"], @@ -1707,6 +1714,7 @@ cc_test { diag: { memtag_heap: true, }, + hwaddress: false, }, header_libs: ["bionic_libc_platform_headers"], cflags: ["-fexceptions"],