MCPcopy Create free account
hub / github.com/Snapchat/Valdi / TEST_F

Function TEST_F

valdi/test/integration/MmapModuleArchive_tests.cpp:207–221  ·  view source on GitHub ↗

COF off → heap counter fires, mmap counters do not, latency timer fires.

Source from the content-addressed store, hash-verified

205
206// COF off → heap counter fires, mmap counters do not, latency timer fires.
207TEST_F(MmapModuleArchiveFixture, EmitsHeapCounterWhenCofDisabled) {
208 auto& wrapper = makeWrapper(/*enableCof=*/false);
209 // Cache dir intentionally NOT set; with COF off it doesn't matter anyway.
210
211 auto result = wrapper.loadModule(STRING_LITERAL(kModuleName), ResourceManagerLoadModuleType::Sources);
212 ASSERT_TRUE(result) << result.description();
213
214 EXPECT_EQ(0, _metrics->mmapSuccess.load());
215 EXPECT_EQ(0, _metrics->mmapFallback.load());
216 EXPECT_GE(_metrics->heap.load(), 1);
217 EXPECT_EQ(_metrics->heap.load(), _metrics->totalPathCounters()) << "Exactly the heap counter should have fired";
218 EXPECT_EQ(_metrics->heap.load(), _metrics->decompressLatencyCalls.load())
219 << "Latency timer should fire once per successful decompress";
220 EXPECT_EQ(0, _metrics->mmapPublishFail.load()) << "Publish-failure counter is for the mmap path only";
221}
222
223// COF on but no cache dir → ResourceManager short-circuits to the heap path
224// (because _mmapCacheDirectory is empty), so heap counter fires.

Callers

nothing calls this directly

Calls 8

readdirFunction · 0.85
descriptionMethod · 0.80
totalPathCountersMethod · 0.80
pathMethod · 0.80
loadModuleMethod · 0.65
loadMethod · 0.65
toStringMethod · 0.65
setMmapCacheDirectoryMethod · 0.45

Tested by

no test coverage detected