diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-04-28 01:12:21 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-04-28 01:12:21 +0000 |
commit | 71cc829becb5d4538d0a41bad0ee8de647c50484 (patch) | |
tree | 2b94fc60a93247d1e8b0239e1811e739ca0402b1 | |
parent | 765a200fffaff9edd30255a5f4470a9669f2f9ff (diff) | |
parent | ab41b0286168bcfa041156530fd59579aaa86bcb (diff) | |
download | gwp_asan-android14-qpr1-release.tar.gz |
Snap for 10017868 from ab41b0286168bcfa041156530fd59579aaa86bcb to udc-qpr1-releaseandroid-14.0.0_r27android-14.0.0_r26android-14.0.0_r25android-14.0.0_r24android-14.0.0_r23android-14.0.0_r22android-14.0.0_r21android-14.0.0_r20android-14.0.0_r19android-14.0.0_r18android-14.0.0_r17android-14.0.0_r16android14-qpr1-s2-releaseandroid14-qpr1-release
Change-Id: I828556a0425ecd2a63de756362641e04e557286c
-rw-r--r-- | gwp_asan/tests/harness.h | 7 | ||||
-rw-r--r-- | gwp_asan/tests/never_allocated.cpp | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/gwp_asan/tests/harness.h b/gwp_asan/tests/harness.h index 3e85935..ae39a44 100644 --- a/gwp_asan/tests/harness.h +++ b/gwp_asan/tests/harness.h @@ -15,6 +15,13 @@ #define ZXTEST_USE_STREAMABLE_MACROS #include <zxtest/zxtest.h> namespace testing = zxtest; +// zxtest defines a different ASSERT_DEATH, taking a lambda and an error message +// if death didn't occur, versus gtest taking a statement and a string to search +// for in the dying process. zxtest doesn't define an EXPECT_DEATH, so we use +// that in the tests below (which works as intended for gtest), and we define +// EXPECT_DEATH as a wrapper for zxtest's ASSERT_DEATH. Note that zxtest drops +// the functionality for checking for a particular message in death. +#define EXPECT_DEATH(X, Y) ASSERT_DEATH(([&] { X; }), "") #else #include "gtest/gtest.h" #endif diff --git a/gwp_asan/tests/never_allocated.cpp b/gwp_asan/tests/never_allocated.cpp index bd43b22..2f695b4 100644 --- a/gwp_asan/tests/never_allocated.cpp +++ b/gwp_asan/tests/never_allocated.cpp @@ -25,7 +25,7 @@ TEST_P(BacktraceGuardedPoolAllocatorDeathTest, NeverAllocated) { // in the posix crash handler. char *volatile NeverAllocatedPtr = static_cast<char *>(Ptr) + 0x3000; if (!Recoverable) { - ASSERT_DEATH(*NeverAllocatedPtr = 0, DeathNeedle); + EXPECT_DEATH(*NeverAllocatedPtr = 0, DeathNeedle); return; } |