[compiler-rt] dfacba5 - [scudo] Update ring buffer test to make it accept zero size

Chia-hung Duan via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 14 17:24:25 PST 2023


Author: Chia-hung Duan
Date: 2023-02-15T01:23:39Z
New Revision: dfacba5af0fb5dcdbf269b97258e435007276bf1

URL: https://github.com/llvm/llvm-project/commit/dfacba5af0fb5dcdbf269b97258e435007276bf1
DIFF: https://github.com/llvm/llvm-project/commit/dfacba5af0fb5dcdbf269b97258e435007276bf1.diff

LOG: [scudo] Update ring buffer test to make it accept zero size

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
index 63cb5711c193..d4c2a23e0bf8 100644
--- a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
@@ -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) {


        


More information about the llvm-commits mailing list