MCPcopy Create free account
hub / github.com/catboost/catboost / TEST_P

Function TEST_P

library/cpp/coroutine/engine/stack/ut/stack_allocator_ut.cpp:35–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33
34
35 TEST_P(TAllocatorParamFixture, StackAllocationAndRelease) {
36 size_t stackSize = PageSize * 12;
37 auto stack = Allocator_->AllocStack(stackSize, "test_stack");
38#if defined(_san_enabled_) || !defined(NDEBUG)
39 stackSize *= DebugOrSanStackMultiplier;
40#endif
41
42 // Correct stack should have
43 EXPECT_EQ(stack.GetSize(), stackSize); // predefined size
44 EXPECT_FALSE((size_t)stack.GetAlignedMemory() & PageSizeMask); // aligned pointer
45 // Writable workspace
46 auto workspace = Allocator_->GetStackWorkspace(stack.GetAlignedMemory(), stack.GetSize());
47 for (size_t i = 0; i < workspace.size(); i += 512) {
48 workspace[i] = 42;
49 }
50 EXPECT_TRUE(Allocator_->CheckStackOverflow(stack.GetAlignedMemory()));
51 EXPECT_TRUE(Allocator_->CheckStackOverride(stack.GetAlignedMemory(), stack.GetSize()));
52
53 Allocator_->FreeStack(stack);
54 EXPECT_FALSE(stack.GetRawMemory());
55 }
56
57 INSTANTIATE_TEST_SUITE_P(AllocatorTestParams, TAllocatorParamFixture,
58 Combine(Values(EGuard::Canary, EGuard::Page), Values(EAllocator::Pool, EAllocator::Simple)));

Callers

nothing calls this directly

Calls 6

AllocStackMethod · 0.80
FreeStackMethod · 0.80
GetRawMemoryMethod · 0.80
GetSizeMethod · 0.45
GetAlignedMemoryMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected