[compiler-rt] [scudo] Minor refactoring of secondary cache test (PR #95995)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 18 14:29:50 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: None (ChiaHungDuan)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/95995.diff
1 Files Affected:
- (modified) compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp (+20-18)
``````````diff
diff --git a/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp b/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
index af69313214ea6..c0d015c276729 100644
--- a/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
@@ -190,29 +190,31 @@ TEST_F(MapAllocatorTest, SecondaryIterate) {
Str.output();
}
-TEST_F(MapAllocatorTest, SecondaryOptions) {
+TEST_F(MapAllocatorTest, SecondaryCacheOptions) {
+ if (!Allocator->canCache(0U))
+ GTEST_SKIP();
+
// Attempt to set a maximum number of entries higher than the array size.
EXPECT_TRUE(Allocator->setOption(scudo::Option::MaxCacheEntriesCount, 4096U));
// Attempt to set an invalid (negative) number of entries
EXPECT_FALSE(Allocator->setOption(scudo::Option::MaxCacheEntriesCount, -1));
- if (Allocator->canCache(0U)) {
- // Various valid combinations.
- EXPECT_TRUE(Allocator->setOption(scudo::Option::MaxCacheEntriesCount, 4U));
- EXPECT_TRUE(
- Allocator->setOption(scudo::Option::MaxCacheEntrySize, 1UL << 20));
- EXPECT_TRUE(Allocator->canCache(1UL << 18));
- EXPECT_TRUE(
- Allocator->setOption(scudo::Option::MaxCacheEntrySize, 1UL << 17));
- EXPECT_FALSE(Allocator->canCache(1UL << 18));
- EXPECT_TRUE(Allocator->canCache(1UL << 16));
- EXPECT_TRUE(Allocator->setOption(scudo::Option::MaxCacheEntriesCount, 0U));
- EXPECT_FALSE(Allocator->canCache(1UL << 16));
- EXPECT_TRUE(Allocator->setOption(scudo::Option::MaxCacheEntriesCount, 4U));
- EXPECT_TRUE(
- Allocator->setOption(scudo::Option::MaxCacheEntrySize, 1UL << 20));
- EXPECT_TRUE(Allocator->canCache(1UL << 16));
- }
+
+ // Various valid combinations.
+ EXPECT_TRUE(Allocator->setOption(scudo::Option::MaxCacheEntriesCount, 4U));
+ EXPECT_TRUE(
+ Allocator->setOption(scudo::Option::MaxCacheEntrySize, 1UL << 20));
+ EXPECT_TRUE(Allocator->canCache(1UL << 18));
+ EXPECT_TRUE(
+ Allocator->setOption(scudo::Option::MaxCacheEntrySize, 1UL << 17));
+ EXPECT_FALSE(Allocator->canCache(1UL << 18));
+ EXPECT_TRUE(Allocator->canCache(1UL << 16));
+ EXPECT_TRUE(Allocator->setOption(scudo::Option::MaxCacheEntriesCount, 0U));
+ EXPECT_FALSE(Allocator->canCache(1UL << 16));
+ EXPECT_TRUE(Allocator->setOption(scudo::Option::MaxCacheEntriesCount, 4U));
+ EXPECT_TRUE(
+ Allocator->setOption(scudo::Option::MaxCacheEntrySize, 1UL << 20));
+ EXPECT_TRUE(Allocator->canCache(1UL << 16));
}
struct MapAllocatorWithReleaseTest : public MapAllocatorTest {
``````````
</details>
https://github.com/llvm/llvm-project/pull/95995
More information about the llvm-commits
mailing list