[gwp_asan] Exclude recoverable tests on Fuchsia
authorCaslyn Tonelli <caslyn@google.com>
Wed, 26 Apr 2023 22:15:21 +0000 (22:15 +0000)
committerCaslyn Tonelli <caslyn@google.com>
Thu, 27 Apr 2023 21:51:30 +0000 (21:51 +0000)
Signal handlers used by recoverable tests are unsupported on Fuchsia.

Exclude the set of tests that test recoverable code paths (i.e.
BacktraceGuardedPoolAllocator tests in recoverable.cpp) and always set
the `Recoverable` testing bool to `false` on the Fuchsia platform.

Differential Revision: https://reviews.llvm.org/D149311

compiler-rt/lib/gwp_asan/tests/backtrace.cpp
compiler-rt/lib/gwp_asan/tests/harness.cpp

index 7cbbcf5..6a84a2a 100644 (file)
@@ -21,7 +21,7 @@ TEST_P(BacktraceGuardedPoolAllocatorDeathTest, DoubleFree) {
   DeathRegex.append("was deallocated.*DeallocateMemory[^2].*");
   DeathRegex.append("was allocated.*AllocateMemory");
   if (!Recoverable) {
-    ASSERT_DEATH(DeallocateMemory2(GPA, Ptr), DeathRegex);
+    EXPECT_DEATH(DeallocateMemory2(GPA, Ptr), DeathRegex);
     return;
   }
 
@@ -51,7 +51,7 @@ TEST_P(BacktraceGuardedPoolAllocatorDeathTest, UseAfterFree) {
   DeathRegex.append("was allocated.*AllocateMemory");
 
   if (!Recoverable) {
-    ASSERT_DEATH(TouchMemory(Ptr), DeathRegex);
+    EXPECT_DEATH(TouchMemory(Ptr), DeathRegex);
     return;
   }
 
index 6d41630..4633d3e 100644 (file)
@@ -47,8 +47,15 @@ void CheckOnlyOneGwpAsanCrash(const std::string &OutputBuffer) {
       << OutputBuffer;
 }
 
+// Fuchsia does not support recoverable GWP-ASan.
+#if defined(__Fuchsia__)
+INSTANTIATE_TEST_SUITE_P(RecoverableAndNonRecoverableTests,
+                         BacktraceGuardedPoolAllocatorDeathTest,
+                         /* Recoverable */ testing::Values(false));
+#else
 INSTANTIATE_TEST_SUITE_P(RecoverableTests, BacktraceGuardedPoolAllocator,
                          /* Recoverable */ testing::Values(true));
 INSTANTIATE_TEST_SUITE_P(RecoverableAndNonRecoverableTests,
                          BacktraceGuardedPoolAllocatorDeathTest,
                          /* Recoverable */ testing::Bool());
+#endif