Name all DEATH tests using 'DeathTest' suffix.
gtest highly recommends this prefix, and runs death tests first
(https://github.com/google/googletest/blob/master/docs/advanced.md#death-test-naming).
This may help with some spurious bot failures like
https://lab.llvm.org/buildbot/#/builders/169/builds/1290/steps/25/logs/stdio.
Reviewed By: cryptoad, vitalybuka
Differential Revision: https://reviews.llvm.org/D105371
GitOrigin-RevId: dd1c4bd09dd7a48c744f58847862f2e2bd633477
diff --git a/tests/backtrace.cpp b/tests/backtrace.cpp
index 9515065..4f63648 100644
--- a/tests/backtrace.cpp
+++ b/tests/backtrace.cpp
@@ -30,7 +30,7 @@
*(reinterpret_cast<volatile char *>(Ptr)) = 7;
}
-TEST_F(BacktraceGuardedPoolAllocator, DoubleFree) {
+TEST_F(BacktraceGuardedPoolAllocatorDeathTest, DoubleFree) {
void *Ptr = AllocateMemory(GPA);
DeallocateMemory(GPA, Ptr);
@@ -45,7 +45,7 @@
ASSERT_DEATH(DeallocateMemory2(GPA, Ptr), DeathRegex);
}
-TEST_F(BacktraceGuardedPoolAllocator, UseAfterFree) {
+TEST_F(BacktraceGuardedPoolAllocatorDeathTest, UseAfterFree) {
void *Ptr = AllocateMemory(GPA);
DeallocateMemory(GPA, Ptr);
diff --git a/tests/enable_disable.cpp b/tests/enable_disable.cpp
index 2c6ba51..98da591 100644
--- a/tests/enable_disable.cpp
+++ b/tests/enable_disable.cpp
@@ -10,7 +10,7 @@
constexpr size_t Size = 100;
-TEST_F(DefaultGuardedPoolAllocator, Fork) {
+TEST_F(DefaultGuardedPoolAllocatorDeathTest, Fork) {
void *P;
pid_t Pid = fork();
EXPECT_GE(Pid, 0);
diff --git a/tests/harness.h b/tests/harness.h
index a61b856..ed91e64 100644
--- a/tests/harness.h
+++ b/tests/harness.h
@@ -106,4 +106,9 @@
gwp_asan::GuardedPoolAllocator GPA;
};
+// https://github.com/google/googletest/blob/master/docs/advanced.md#death-tests-and-threads
+using DefaultGuardedPoolAllocatorDeathTest = DefaultGuardedPoolAllocator;
+using CustomGuardedPoolAllocatorDeathTest = CustomGuardedPoolAllocator;
+using BacktraceGuardedPoolAllocatorDeathTest = BacktraceGuardedPoolAllocator;
+
#endif // GWP_ASAN_TESTS_HARNESS_H_