@@ -190,30 +190,31 @@ TEST_F(MapAllocatorTest, SecondaryIterate) {
190
190
Str.output ();
191
191
}
192
192
193
- TEST_F (MapAllocatorTest, SecondaryOptions) {
194
- // Test options that are only meaningful if the secondary cache is enabled.
195
- if (Allocator->canCache (0U )) {
196
- // Attempt to set a maximum number of entries higher than the array size.
197
- EXPECT_TRUE (
198
- Allocator->setOption (scudo::Option::MaxCacheEntriesCount, 4096U ));
199
- // Attempt to set an invalid (negative) number of entries
200
- EXPECT_FALSE (Allocator->setOption (scudo::Option::MaxCacheEntriesCount, -1 ));
201
- // Various valid combinations.
202
- EXPECT_TRUE (Allocator->setOption (scudo::Option::MaxCacheEntriesCount, 4U ));
203
- EXPECT_TRUE (
204
- Allocator->setOption (scudo::Option::MaxCacheEntrySize, 1UL << 20 ));
205
- EXPECT_TRUE (Allocator->canCache (1UL << 18 ));
206
- EXPECT_TRUE (
207
- Allocator->setOption (scudo::Option::MaxCacheEntrySize, 1UL << 17 ));
208
- EXPECT_FALSE (Allocator->canCache (1UL << 18 ));
209
- EXPECT_TRUE (Allocator->canCache (1UL << 16 ));
210
- EXPECT_TRUE (Allocator->setOption (scudo::Option::MaxCacheEntriesCount, 0U ));
211
- EXPECT_FALSE (Allocator->canCache (1UL << 16 ));
212
- EXPECT_TRUE (Allocator->setOption (scudo::Option::MaxCacheEntriesCount, 4U ));
213
- EXPECT_TRUE (
214
- Allocator->setOption (scudo::Option::MaxCacheEntrySize, 1UL << 20 ));
215
- EXPECT_TRUE (Allocator->canCache (1UL << 16 ));
216
- }
193
+ TEST_F (MapAllocatorTest, SecondaryCacheOptions) {
194
+ if (!Allocator->canCache (0U ))
195
+ TEST_SKIP (" Secondary Cache disabled" );
196
+
197
+ // Attempt to set a maximum number of entries higher than the array size.
198
+ EXPECT_TRUE (Allocator->setOption (scudo::Option::MaxCacheEntriesCount, 4096U ));
199
+
200
+ // Attempt to set an invalid (negative) number of entries
201
+ EXPECT_FALSE (Allocator->setOption (scudo::Option::MaxCacheEntriesCount, -1 ));
202
+
203
+ // Various valid combinations.
204
+ EXPECT_TRUE (Allocator->setOption (scudo::Option::MaxCacheEntriesCount, 4U ));
205
+ EXPECT_TRUE (
206
+ Allocator->setOption (scudo::Option::MaxCacheEntrySize, 1UL << 20 ));
207
+ EXPECT_TRUE (Allocator->canCache (1UL << 18 ));
208
+ EXPECT_TRUE (
209
+ Allocator->setOption (scudo::Option::MaxCacheEntrySize, 1UL << 17 ));
210
+ EXPECT_FALSE (Allocator->canCache (1UL << 18 ));
211
+ EXPECT_TRUE (Allocator->canCache (1UL << 16 ));
212
+ EXPECT_TRUE (Allocator->setOption (scudo::Option::MaxCacheEntriesCount, 0U ));
213
+ EXPECT_FALSE (Allocator->canCache (1UL << 16 ));
214
+ EXPECT_TRUE (Allocator->setOption (scudo::Option::MaxCacheEntriesCount, 4U ));
215
+ EXPECT_TRUE (
216
+ Allocator->setOption (scudo::Option::MaxCacheEntrySize, 1UL << 20 ));
217
+ EXPECT_TRUE (Allocator->canCache (1UL << 16 ));
217
218
}
218
219
219
220
struct MapAllocatorWithReleaseTest : public MapAllocatorTest {
0 commit comments