Skip to content

Commit eb4b525

Browse files
committed
test(core): add CleanupMarksContextHandleDead test
Verify that Context::Cleanup() marks the handle as dead, making FromHandle() and KernelFromHandle() return nullptr.
1 parent 10b1e17 commit eb4b525

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

tests/ContextLifecycleTests.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,17 @@ TEST_F(ContextLifecycleTests, CleanupRunsShutdownHooksWithoutHoldingStateMutex)
141141
EXPECT_TRUE(state.resolved.load(std::memory_order_acquire));
142142
}
143143

144+
TEST_F(ContextLifecycleTests, CleanupMarksContextHandleDead) {
145+
auto &ctx = *kernel_->context;
146+
BML_Context handle = ctx.GetHandle();
147+
ASSERT_NE(handle, nullptr);
148+
149+
ctx.Cleanup(*kernel_);
150+
151+
EXPECT_EQ(Context::FromHandle(handle), nullptr);
152+
EXPECT_EQ(Context::KernelFromHandle(handle), nullptr);
153+
}
154+
144155
TEST_F(ContextLifecycleTests, CurrentModuleIsThreadLocalPerThread) {
145156
auto primary = std::make_unique<BML_Mod_T>();
146157
primary->id = "context.primary";

0 commit comments

Comments
 (0)