@@ -195,6 +195,27 @@ TEST_F(DrmMemoryOperationsHandlerBaseTest, givenOperationsHandlerWhenCallingMake
195
195
drmMemoryOperationsHandler->makeResident (nullptr , ArrayRef<GraphicsAllocation *>(&allocationPtr, 1 ), true );
196
196
EXPECT_EQ (drmMemoryOperationsHandler->flushDummyExecCalled , 1u );
197
197
}
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
+
198
219
struct DrmMemoryOperationsHandlerBaseTestFlushDummyExec : public DrmMemoryOperationsHandlerBaseTest {
199
220
using BaseClass = DrmMemoryOperationsHandlerBaseTest;
200
221
void SetUp () override {
@@ -236,19 +257,14 @@ TEST_F(DrmMemoryOperationsHandlerBaseTestFlushDummyExec, givenOperationsHandlerW
236
257
EXPECT_EQ (ret, MemoryOperationsStatus::outOfMemory);
237
258
}
238
259
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
-
245
260
TEST_F (DrmMemoryOperationsHandlerBaseTestFlushDummyExec, givenOperationsHandlerWhenEmitPiningRequestReturnSuccessThenSuccessReturned) {
246
261
pMemManager->emitPinningRequestForBoContainerResult = SubmissionStatus::success;
247
262
auto ret = drmMemoryOperationsHandler->flushDummyExec (device.get (), ArrayRef<GraphicsAllocation *>(&allocationPtr, 1 ));
248
263
EXPECT_EQ (ret, MemoryOperationsStatus::success);
249
264
}
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);
254
270
}
0 commit comments