diff --git a/compiler-rt/lib/gwp_asan/tests/harness.h b/compiler-rt/lib/gwp_asan/tests/harness.h --- a/compiler-rt/lib/gwp_asan/tests/harness.h +++ b/compiler-rt/lib/gwp_asan/tests/harness.h @@ -15,6 +15,14 @@ #define ZXTEST_USE_STREAMABLE_MACROS #include namespace testing = zxtest; +// If ASSERT_DEATH is defined, make EXPECT_DEATH a wrapper to it. +#ifdef ASSERT_DEATH +#define EXPECT_DEATH(X, Y) ASSERT_DEATH(([&] { X; }), "") +#else +#define EXPECT_DEATH(X, Y) \ + do { \ + } while (0) +#endif // ASSERT_DEATH #else #include "gtest/gtest.h" #endif diff --git a/compiler-rt/lib/gwp_asan/tests/never_allocated.cpp b/compiler-rt/lib/gwp_asan/tests/never_allocated.cpp --- a/compiler-rt/lib/gwp_asan/tests/never_allocated.cpp +++ b/compiler-rt/lib/gwp_asan/tests/never_allocated.cpp @@ -25,7 +25,7 @@ // in the posix crash handler. char *volatile NeverAllocatedPtr = static_cast(Ptr) + 0x3000; if (!Recoverable) { - ASSERT_DEATH(*NeverAllocatedPtr = 0, DeathNeedle); + EXPECT_DEATH(*NeverAllocatedPtr = 0, DeathNeedle); return; }