@@ -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