diff --git a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp index a6c6d828cf6470..703d9e12bdcaf7 100644 --- a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp @@ -24,6 +24,11 @@ static bool Ready; static constexpr scudo::Chunk::Origin Origin = scudo::Chunk::Origin::Malloc; +template struct UseQuarantineSetter { + UseQuarantineSetter(bool Value) { UseQuarantine = Value; } + ~UseQuarantineSetter() { UseQuarantine = true; } +}; + // Fuchsia complains that the function is not used. UNUSED static void disableDebuggerdMaybe() { #if SCUDO_ANDROID @@ -80,6 +85,8 @@ template struct TestAllocator : scudo::Allocator { }; template static void testAllocator() { + UseQuarantineSetter MUQ( + std::is_same::value); using AllocatorT = TestAllocator; auto Allocator = std::unique_ptr(new AllocatorT()); @@ -318,13 +325,11 @@ void testSEGV() { } TEST(ScudoCombinedTest, BasicCombined) { - UseQuarantine = false; testAllocator(); #if SCUDO_FUCHSIA testAllocator(); #else testAllocator(); - UseQuarantine = true; testAllocator(); testSEGV(); #endif @@ -369,13 +374,11 @@ template static void testAllocatorThreaded() { } TEST(ScudoCombinedTest, ThreadedCombined) { - UseQuarantine = false; testAllocatorThreaded(); #if SCUDO_FUCHSIA testAllocatorThreaded(); #else testAllocatorThreaded(); - UseQuarantine = true; testAllocatorThreaded(); #endif }