[compiler-rt] [scudo] Added test fixture for cache tests. (PR #102230)

Joshua Baehring via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 6 15:10:10 PDT 2024


================
@@ -265,3 +265,99 @@ TEST_F(MapAllocatorWithReleaseTest, SecondaryThreadsRace) {
   Allocator->getStats(&Str);
   Str.output();
 }
+
+struct MapAllocatorCacheTest : public Test {
+  static constexpr scudo::u32 MarkerBytes = 0xDEADBEEF;
+
+  static void testUnmapCallback(scudo::MemMapT &MemMap) {
+    scudo::u32 *Ptr = reinterpret_cast<scudo::u32 *>(MemMap.getBase());
+    *Ptr = MarkerBytes;
+  }
+
+  using Config = scudo::DefaultConfig;
----------------
JoshuaMBa wrote:

Do you mean use of `Config` directly?

I used `DefaultConfig` just because I assumed we would want to test it on the default values. There aren't any specific configuration requirements for this test fixture so if I set up a test config I wouldn't have any justification for using different values than the `DefaultConfig`.

https://github.com/llvm/llvm-project/pull/102230


More information about the llvm-commits mailing list