Skip to content

Commit 3c6d026

Browse files
Add ULTs for fence
Signed-off-by: Aravind Gopalakrishnan <[email protected]>
1 parent e74ed26 commit 3c6d026

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

level_zero/core/test/unit_tests/sources/fence/test_fence.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,29 @@ TEST_F(FenceTest, whenQueryingStatusThenCsrAllocationsAreDownloaded) {
3939
EXPECT_EQ(ZE_RESULT_SUCCESS, status);
4040
}
4141

42+
TEST_F(FenceTest, whenQueryingStatusWithoutCsrAndFenceUnsignaledThenReturnsNotReady) {
43+
Mock<CommandQueue> cmdQueue(device, nullptr);
44+
auto fence = Fence::create(&cmdQueue, nullptr);
45+
46+
EXPECT_NE(nullptr, fence);
47+
auto status = fence->queryStatus();
48+
EXPECT_EQ(ZE_RESULT_NOT_READY, status);
49+
fence->destroy();
50+
}
51+
52+
TEST_F(FenceTest, whenQueryingStatusAndStateSignaledThenReturnSuccess) {
53+
auto csr = std::make_unique<MockCommandStreamReceiver>(*neoDevice->getExecutionEnvironment(), 0, neoDevice->getDeviceBitfield());
54+
Mock<CommandQueue> cmdQueue(device, csr.get());
55+
auto fence = Fence::create(&cmdQueue, nullptr);
56+
EXPECT_NE(nullptr, fence);
57+
58+
auto &graphicsAllocation = fence->getAllocation();
59+
auto hostAddr = static_cast<uint64_t *>(graphicsAllocation.getUnderlyingBuffer());
60+
*hostAddr = Fence::STATE_SIGNALED;
61+
auto status = fence->queryStatus();
62+
EXPECT_EQ(ZE_RESULT_SUCCESS, status);
63+
fence->destroy();
64+
}
65+
4266
} // namespace ult
4367
} // namespace L0

0 commit comments

Comments
 (0)