@@ -195,6 +195,27 @@ TEST_F(DrmMemoryOperationsHandlerBaseTest, givenOperationsHandlerWhenCallingMake
195195 drmMemoryOperationsHandler->makeResident (nullptr , ArrayRef<GraphicsAllocation *>(&allocationPtr, 1 ), true );
196196 EXPECT_EQ (drmMemoryOperationsHandler->flushDummyExecCalled , 1u );
197197}
198+
199+ TEST_F (DrmMemoryOperationsHandlerBaseTest, givenOperationsHandlerWhenFlushReturnedOOMThenEvictCalled) {
200+ drmMemoryOperationsHandler->flushDummyExecCallBase = false ;
201+ drmMemoryOperationsHandler->flushDummyExecResult = MemoryOperationsStatus::outOfMemory;
202+ drmMemoryOperationsHandler->makeResidentWithinOsContextCallBase = false ;
203+
204+ initializeAllocation (1 );
205+ drmMemoryOperationsHandler->makeResident (nullptr , ArrayRef<GraphicsAllocation *>(&allocationPtr, 1 ), true );
206+ EXPECT_EQ (drmMemoryOperationsHandler->evictWithinOsContextCalled , 1u );
207+ }
208+
209+ TEST_F (DrmMemoryOperationsHandlerBaseTest, givenOperationsHandlerWhenFlushReturnedSuccessThenEvictNotcalled) {
210+ drmMemoryOperationsHandler->flushDummyExecCallBase = false ;
211+ drmMemoryOperationsHandler->flushDummyExecResult = MemoryOperationsStatus::success;
212+ drmMemoryOperationsHandler->makeResidentWithinOsContextCallBase = false ;
213+
214+ initializeAllocation (1 );
215+ drmMemoryOperationsHandler->makeResident (nullptr , ArrayRef<GraphicsAllocation *>(&allocationPtr, 1 ), true );
216+ EXPECT_EQ (drmMemoryOperationsHandler->evictWithinOsContextCalled , 0u );
217+ }
218+
198219struct DrmMemoryOperationsHandlerBaseTestFlushDummyExec : public DrmMemoryOperationsHandlerBaseTest {
199220 using BaseClass = DrmMemoryOperationsHandlerBaseTest;
200221 void SetUp () override {
@@ -236,19 +257,14 @@ TEST_F(DrmMemoryOperationsHandlerBaseTestFlushDummyExec, givenOperationsHandlerW
236257 EXPECT_EQ (ret, MemoryOperationsStatus::outOfMemory);
237258}
238259
239- TEST_F (DrmMemoryOperationsHandlerBaseTestFlushDummyExec, givenOperationsHandlerWhenEmitPiningRequestReturnFailThenEvictWithinOsContextCalled) {
240- pMemManager->emitPinningRequestForBoContainerResult = SubmissionStatus::outOfMemory;
241- drmMemoryOperationsHandler->flushDummyExec (device.get (), ArrayRef<GraphicsAllocation *>(&allocationPtr, 1 ));
242- EXPECT_EQ (drmMemoryOperationsHandler->evictWithinOsContextCalled , 1u );
243- }
244-
245260TEST_F (DrmMemoryOperationsHandlerBaseTestFlushDummyExec, givenOperationsHandlerWhenEmitPiningRequestReturnSuccessThenSuccessReturned) {
246261 pMemManager->emitPinningRequestForBoContainerResult = SubmissionStatus::success;
247262 auto ret = drmMemoryOperationsHandler->flushDummyExec (device.get (), ArrayRef<GraphicsAllocation *>(&allocationPtr, 1 ));
248263 EXPECT_EQ (ret, MemoryOperationsStatus::success);
249264}
250- TEST_F (DrmMemoryOperationsHandlerBaseTestFlushDummyExec, givenOperationsHandlerWhenEmitPiningRequestReturnSuccessThenEvictWithinOsContextNotCalled) {
251- pMemManager->emitPinningRequestForBoContainerResult = SubmissionStatus::success;
252- drmMemoryOperationsHandler->flushDummyExec (device.get (), ArrayRef<GraphicsAllocation *>(&allocationPtr, 1 ));
253- EXPECT_EQ (drmMemoryOperationsHandler->evictWithinOsContextCalled , 0u );
265+
266+ TEST_F (DrmMemoryOperationsHandlerBaseTestFlushDummyExec, givenOperationsHandlerWhenEmitPiningRequestReturnOOMThenOOMReturned) {
267+ pMemManager->emitPinningRequestForBoContainerResult = SubmissionStatus::outOfMemory;
268+ auto ret = drmMemoryOperationsHandler->flushDummyExec (device.get (), ArrayRef<GraphicsAllocation *>(&allocationPtr, 1 ));
269+ EXPECT_EQ (ret, MemoryOperationsStatus::outOfMemory);
254270}
0 commit comments