[scudo] Update ring buffer test to make it accept zero size
authorChia-hung Duan <chiahungduan@google.com>
Wed, 15 Feb 2023 01:23:13 +0000 (01:23 +0000)
committerChia-hung Duan <chiahungduan@google.com>
Wed, 15 Feb 2023 01:23:39 +0000 (01:23 +0000)
allocation ring buffer is allowed to be zero. Update the logic in the
test so that on the platform that disables it won't fail this case.

Reviewed By: fmayer

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

compiler-rt/lib/scudo/standalone/tests/combined_test.cpp

index 63cb571..d4c2a23 100644 (file)
@@ -705,8 +705,8 @@ SCUDO_TYPED_TEST(ScudoCombinedTest, ReallocateInPlaceStress) {
 SCUDO_TYPED_TEST(ScudoCombinedTest, RingBufferSize) {
   auto *Allocator = this->Allocator.get();
   auto Size = Allocator->getRingBufferSize();
-  ASSERT_GT(Size, 0u);
-  EXPECT_EQ(Allocator->getRingBufferAddress()[Size - 1], '\0');
+  if (Size > 0)
+    EXPECT_EQ(Allocator->getRingBufferAddress()[Size - 1], '\0');
 }
 
 SCUDO_TYPED_TEST(ScudoCombinedTest, RingBufferAddress) {