mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Remove GMock from GMockDrmMemoryManager, MockOSMemoryLinux, MyCsr...
Removed Gmock from: - GMockDrmMemoryManager - MockOSMemoryLinux - MyCsr - GmockGfxPartition Renamed: - GMockDrmMemoryManager -> MockTestedDrmMemoryManager Moved class body: - GmockGfxPartition -> MockGfxPartition - MockTestedDrmMemoryManager -> TestedDrmMemoryManager Related-To: NEO-4914 Signed-off-by: Fabian Zwolinski <fabian.zwolinski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
e51f8ceb0d
commit
4e31612c31
@ -29,7 +29,24 @@ class MyCsr : public UltCommandStreamReceiver<Family> {
|
||||
public:
|
||||
MyCsr(const ExecutionEnvironment &executionEnvironment, const DeviceBitfield deviceBitfield)
|
||||
: UltCommandStreamReceiver<Family>(const_cast<ExecutionEnvironment &>(executionEnvironment), 0, deviceBitfield) {}
|
||||
MOCK_METHOD3(waitForCompletionWithTimeout, WaitStatus(bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait));
|
||||
|
||||
WaitStatus waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait) override {
|
||||
waitForCompletionWithTimeoutCalled++;
|
||||
waitForCompletionWithTimeoutParamsPassed.push_back({enableTimeout, timeoutMs, taskCountToWait});
|
||||
*this->getTagAddress() = getTagAddressValue;
|
||||
return waitForCompletionWithTimeoutResult;
|
||||
}
|
||||
|
||||
struct WaitForCompletionWithTimeoutParams {
|
||||
bool enableTimeout;
|
||||
int64_t timeoutMs;
|
||||
uint32_t taskCountToWait;
|
||||
};
|
||||
|
||||
uint32_t waitForCompletionWithTimeoutCalled = 0u;
|
||||
WaitStatus waitForCompletionWithTimeoutResult = NEO::WaitStatus::Ready;
|
||||
StackVec<WaitForCompletionWithTimeoutParams, 2> waitForCompletionWithTimeoutParamsPassed{};
|
||||
uint32_t getTagAddressValue{};
|
||||
};
|
||||
|
||||
void CL_CALLBACK emptyDestructorCallback(cl_mem memObj, void *userData) {
|
||||
@ -141,46 +158,48 @@ HWTEST_P(MemObjAsyncDestructionTest, givenUsedMemObjWithAsyncDestructionsEnabled
|
||||
|
||||
auto rootDeviceIndex = device->getRootDeviceIndex();
|
||||
|
||||
auto mockCsr0 = new ::testing::NiceMock<MyCsr<FamilyType>>(*device->executionEnvironment, device->getDeviceBitfield());
|
||||
auto mockCsr1 = new ::testing::NiceMock<MyCsr<FamilyType>>(*device->executionEnvironment, device->getDeviceBitfield());
|
||||
auto mockCsr0 = new MyCsr<FamilyType>(*device->executionEnvironment, device->getDeviceBitfield());
|
||||
auto mockCsr1 = new MyCsr<FamilyType>(*device->executionEnvironment, device->getDeviceBitfield());
|
||||
device->resetCommandStreamReceiver(mockCsr0, 0);
|
||||
device->resetCommandStreamReceiver(mockCsr1, 1);
|
||||
*mockCsr0->getTagAddress() = 0;
|
||||
*mockCsr1->getTagAddress() = 0;
|
||||
|
||||
auto waitForCompletionWithTimeoutMock0 = [&mockCsr0](bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait) -> NEO::WaitStatus {
|
||||
*mockCsr0->getTagAddress() = taskCountReady;
|
||||
return NEO::WaitStatus::Ready;
|
||||
};
|
||||
auto waitForCompletionWithTimeoutMock1 = [&mockCsr1](bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait) -> NEO::WaitStatus {
|
||||
*mockCsr1->getTagAddress() = taskCountReady;
|
||||
return NEO::WaitStatus::Ready;
|
||||
};
|
||||
mockCsr0->getTagAddressValue = taskCountReady;
|
||||
mockCsr1->getTagAddressValue = taskCountReady;
|
||||
|
||||
auto osContextId0 = mockCsr0->getOsContext().getContextId();
|
||||
auto osContextId1 = mockCsr1->getOsContext().getContextId();
|
||||
|
||||
memObj->getGraphicsAllocation(rootDeviceIndex)->updateTaskCount(taskCountReady, osContextId0);
|
||||
memObj->getGraphicsAllocation(rootDeviceIndex)->updateTaskCount(taskCountReady, osContextId1);
|
||||
|
||||
ON_CALL(*mockCsr0, waitForCompletionWithTimeout(::testing::_, ::testing::_, ::testing::_))
|
||||
.WillByDefault(::testing::Invoke(waitForCompletionWithTimeoutMock0));
|
||||
ON_CALL(*mockCsr1, waitForCompletionWithTimeout(::testing::_, ::testing::_, ::testing::_))
|
||||
.WillByDefault(::testing::Invoke(waitForCompletionWithTimeoutMock1));
|
||||
uint32_t expectedTaskCount0{};
|
||||
uint32_t expectedTaskCount1{};
|
||||
|
||||
if (hasCallbacks) {
|
||||
EXPECT_CALL(*mockCsr0, waitForCompletionWithTimeout(::testing::_, TimeoutControls::maxTimeout, allocation->getTaskCount(osContextId0)))
|
||||
.Times(1);
|
||||
EXPECT_CALL(*mockCsr1, waitForCompletionWithTimeout(::testing::_, TimeoutControls::maxTimeout, allocation->getTaskCount(osContextId1)))
|
||||
.Times(1);
|
||||
expectedTaskCount0 = allocation->getTaskCount(osContextId0);
|
||||
expectedTaskCount1 = allocation->getTaskCount(osContextId1);
|
||||
|
||||
} else {
|
||||
*mockCsr0->getTagAddress() = taskCountReady;
|
||||
*mockCsr1->getTagAddress() = taskCountReady;
|
||||
EXPECT_CALL(*mockCsr0, waitForCompletionWithTimeout(::testing::_, ::testing::_, ::testing::_))
|
||||
.Times(0);
|
||||
EXPECT_CALL(*mockCsr1, waitForCompletionWithTimeout(::testing::_, ::testing::_, ::testing::_))
|
||||
.Times(0);
|
||||
}
|
||||
|
||||
delete memObj;
|
||||
|
||||
if (hasCallbacks) {
|
||||
EXPECT_EQ(1u, mockCsr0->waitForCompletionWithTimeoutCalled);
|
||||
EXPECT_EQ(TimeoutControls::maxTimeout, mockCsr0->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
|
||||
EXPECT_EQ(expectedTaskCount0, mockCsr0->waitForCompletionWithTimeoutParamsPassed[0].taskCountToWait);
|
||||
|
||||
EXPECT_EQ(1u, mockCsr1->waitForCompletionWithTimeoutCalled);
|
||||
EXPECT_EQ(TimeoutControls::maxTimeout, mockCsr1->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
|
||||
EXPECT_EQ(expectedTaskCount1, mockCsr1->waitForCompletionWithTimeoutParamsPassed[0].taskCountToWait);
|
||||
} else {
|
||||
EXPECT_EQ(0u, mockCsr0->waitForCompletionWithTimeoutCalled);
|
||||
EXPECT_EQ(0u, mockCsr1->waitForCompletionWithTimeoutCalled);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_P(MemObjAsyncDestructionTest, givenUsedMemObjWithAsyncDestructionsEnabledThatHasAllocatedMappedPtrWhenItIsDestroyedThenDestructorWaitsOnTaskCount) {
|
||||
@ -193,26 +212,26 @@ HWTEST_P(MemObjAsyncDestructionTest, givenUsedMemObjWithAsyncDestructionsEnabled
|
||||
memObj->setAllocatedMapPtr(allocatedPtr);
|
||||
}
|
||||
|
||||
auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(*device->executionEnvironment, device->getDeviceBitfield());
|
||||
auto mockCsr = new MyCsr<FamilyType>(*device->executionEnvironment, device->getDeviceBitfield());
|
||||
device->resetCommandStreamReceiver(mockCsr);
|
||||
*mockCsr->getTagAddress() = 0;
|
||||
auto osContextId = mockCsr->getOsContext().getContextId();
|
||||
|
||||
auto desired = NEO::WaitStatus::Ready;
|
||||
|
||||
auto waitForCompletionWithTimeoutMock = [=](bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait) { return desired; };
|
||||
|
||||
ON_CALL(*mockCsr, waitForCompletionWithTimeout(::testing::_, ::testing::_, ::testing::_))
|
||||
.WillByDefault(::testing::Invoke(waitForCompletionWithTimeoutMock));
|
||||
uint32_t expectedTaskCount{};
|
||||
|
||||
if (hasAllocatedMappedPtr) {
|
||||
EXPECT_CALL(*mockCsr, waitForCompletionWithTimeout(::testing::_, TimeoutControls::maxTimeout, allocation->getTaskCount(osContextId)))
|
||||
.Times(1);
|
||||
} else {
|
||||
EXPECT_CALL(*mockCsr, waitForCompletionWithTimeout(::testing::_, ::testing::_, ::testing::_))
|
||||
.Times(0);
|
||||
expectedTaskCount = allocation->getTaskCount(osContextId);
|
||||
}
|
||||
|
||||
delete memObj;
|
||||
|
||||
if (hasAllocatedMappedPtr) {
|
||||
EXPECT_EQ(1u, mockCsr->waitForCompletionWithTimeoutCalled);
|
||||
EXPECT_EQ(TimeoutControls::maxTimeout, mockCsr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
|
||||
EXPECT_EQ(expectedTaskCount, mockCsr->waitForCompletionWithTimeoutParamsPassed[0].taskCountToWait);
|
||||
} else {
|
||||
EXPECT_EQ(0u, mockCsr->waitForCompletionWithTimeoutCalled);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_P(MemObjAsyncDestructionTest, givenUsedMemObjWithAsyncDestructionsEnabledThatHasDestructableMappedPtrWhenItIsDestroyedThenDestructorWaitsOnTaskCount) {
|
||||
@ -236,30 +255,31 @@ HWTEST_P(MemObjAsyncDestructionTest, givenUsedMemObjWithAsyncDestructionsEnabled
|
||||
}
|
||||
|
||||
makeMemObjUsed();
|
||||
auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(*device->executionEnvironment, device->getDeviceBitfield());
|
||||
auto mockCsr = new MyCsr<FamilyType>(*device->executionEnvironment, device->getDeviceBitfield());
|
||||
device->resetCommandStreamReceiver(mockCsr);
|
||||
*mockCsr->getTagAddress() = 0;
|
||||
|
||||
auto desired = NEO::WaitStatus::Ready;
|
||||
|
||||
auto waitForCompletionWithTimeoutMock = [=](bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait) { return desired; };
|
||||
auto osContextId = mockCsr->getOsContext().getContextId();
|
||||
|
||||
ON_CALL(*mockCsr, waitForCompletionWithTimeout(::testing::_, ::testing::_, ::testing::_))
|
||||
.WillByDefault(::testing::Invoke(waitForCompletionWithTimeoutMock));
|
||||
uint32_t expectedTaskCount{};
|
||||
|
||||
if (hasAllocatedMappedPtr) {
|
||||
EXPECT_CALL(*mockCsr, waitForCompletionWithTimeout(::testing::_, TimeoutControls::maxTimeout, allocation->getTaskCount(osContextId)))
|
||||
.Times(1);
|
||||
} else {
|
||||
EXPECT_CALL(*mockCsr, waitForCompletionWithTimeout(::testing::_, ::testing::_, ::testing::_))
|
||||
.Times(0);
|
||||
expectedTaskCount = allocation->getTaskCount(osContextId);
|
||||
}
|
||||
|
||||
delete memObj;
|
||||
|
||||
if (!hasAllocatedMappedPtr) {
|
||||
alignedFree(storage);
|
||||
}
|
||||
|
||||
if (hasAllocatedMappedPtr) {
|
||||
EXPECT_EQ(1u, mockCsr->waitForCompletionWithTimeoutCalled);
|
||||
EXPECT_EQ(TimeoutControls::maxTimeout, mockCsr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
|
||||
EXPECT_EQ(expectedTaskCount, mockCsr->waitForCompletionWithTimeoutParamsPassed[0].taskCountToWait);
|
||||
} else {
|
||||
EXPECT_EQ(0u, mockCsr->waitForCompletionWithTimeoutCalled);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_P(MemObjSyncDestructionTest, givenMemObjWithDestructableAllocationWhenAsyncDestructionsAreDisabledThenDestructorWaitsOnTaskCount) {
|
||||
@ -271,22 +291,19 @@ HWTEST_P(MemObjSyncDestructionTest, givenMemObjWithDestructableAllocationWhenAsy
|
||||
} else {
|
||||
makeMemObjNotReady();
|
||||
}
|
||||
auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(*device->executionEnvironment, device->getDeviceBitfield());
|
||||
auto mockCsr = new MyCsr<FamilyType>(*device->executionEnvironment, device->getDeviceBitfield());
|
||||
device->resetCommandStreamReceiver(mockCsr);
|
||||
*mockCsr->getTagAddress() = 0;
|
||||
|
||||
auto desired = NEO::WaitStatus::Ready;
|
||||
|
||||
auto waitForCompletionWithTimeoutMock = [=](bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait) { return desired; };
|
||||
auto osContextId = mockCsr->getOsContext().getContextId();
|
||||
|
||||
ON_CALL(*mockCsr, waitForCompletionWithTimeout(::testing::_, ::testing::_, ::testing::_))
|
||||
.WillByDefault(::testing::Invoke(waitForCompletionWithTimeoutMock));
|
||||
|
||||
EXPECT_CALL(*mockCsr, waitForCompletionWithTimeout(::testing::_, TimeoutControls::maxTimeout, allocation->getTaskCount(osContextId)))
|
||||
.Times(1);
|
||||
uint32_t expectedTaskCount = allocation->getTaskCount(osContextId);
|
||||
|
||||
delete memObj;
|
||||
|
||||
EXPECT_EQ(1u, mockCsr->waitForCompletionWithTimeoutCalled);
|
||||
EXPECT_EQ(TimeoutControls::maxTimeout, mockCsr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
|
||||
EXPECT_EQ(expectedTaskCount, mockCsr->waitForCompletionWithTimeoutParamsPassed[0].taskCountToWait);
|
||||
}
|
||||
|
||||
HWTEST_P(MemObjSyncDestructionTest, givenMemObjWithDestructableAllocationWhenAsyncDestructionsAreDisabledThenAllocationIsNotDeferred) {
|
||||
@ -298,17 +315,10 @@ HWTEST_P(MemObjSyncDestructionTest, givenMemObjWithDestructableAllocationWhenAsy
|
||||
} else {
|
||||
makeMemObjNotReady();
|
||||
}
|
||||
auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(*device->executionEnvironment, device->getDeviceBitfield());
|
||||
auto mockCsr = new MyCsr<FamilyType>(*device->executionEnvironment, device->getDeviceBitfield());
|
||||
device->resetCommandStreamReceiver(mockCsr);
|
||||
*mockCsr->getTagAddress() = 0;
|
||||
|
||||
auto desired = NEO::WaitStatus::Ready;
|
||||
|
||||
auto waitForCompletionWithTimeoutMock = [=](bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait) { return desired; };
|
||||
|
||||
ON_CALL(*mockCsr, waitForCompletionWithTimeout(::testing::_, ::testing::_, ::testing::_))
|
||||
.WillByDefault(::testing::Invoke(waitForCompletionWithTimeoutMock));
|
||||
|
||||
delete memObj;
|
||||
auto &allocationList = mockCsr->getTemporaryAllocations();
|
||||
EXPECT_TRUE(allocationList.peekIsEmpty());
|
||||
@ -317,7 +327,7 @@ HWTEST_P(MemObjSyncDestructionTest, givenMemObjWithDestructableAllocationWhenAsy
|
||||
HWTEST_P(MemObjSyncDestructionTest, givenMemObjWithMapAllocationWhenAsyncDestructionsAreDisabledThenWaitForCompletionWithTimeoutOnMapAllocation) {
|
||||
auto isMapAllocationUsed = GetParam();
|
||||
|
||||
auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(*device->executionEnvironment, device->getDeviceBitfield());
|
||||
auto mockCsr = new MyCsr<FamilyType>(*device->executionEnvironment, device->getDeviceBitfield());
|
||||
device->resetCommandStreamReceiver(mockCsr);
|
||||
*mockCsr->getTagAddress() = 0;
|
||||
|
||||
@ -335,27 +345,29 @@ HWTEST_P(MemObjSyncDestructionTest, givenMemObjWithMapAllocationWhenAsyncDestruc
|
||||
memObj->getMapAllocation(device->getRootDeviceIndex())->updateTaskCount(taskCountReady, contextId);
|
||||
}
|
||||
|
||||
auto waitForCompletionWithTimeoutMock = [=](bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait) { return NEO::WaitStatus::Ready; };
|
||||
auto osContextId = mockCsr->getOsContext().getContextId();
|
||||
|
||||
ON_CALL(*mockCsr, waitForCompletionWithTimeout(::testing::_, ::testing::_, ::testing::_))
|
||||
.WillByDefault(::testing::Invoke(waitForCompletionWithTimeoutMock));
|
||||
uint32_t expectedTaskCount{};
|
||||
|
||||
if (isMapAllocationUsed) {
|
||||
EXPECT_CALL(*mockCsr, waitForCompletionWithTimeout(::testing::_, TimeoutControls::maxTimeout, mapAllocation->getTaskCount(osContextId)))
|
||||
.Times(1);
|
||||
} else {
|
||||
EXPECT_CALL(*mockCsr, waitForCompletionWithTimeout(::testing::_, ::testing::_, ::testing::_))
|
||||
.Times(0);
|
||||
expectedTaskCount = mapAllocation->getTaskCount(osContextId);
|
||||
}
|
||||
|
||||
delete memObj;
|
||||
|
||||
if (isMapAllocationUsed) {
|
||||
EXPECT_EQ(1u, mockCsr->waitForCompletionWithTimeoutCalled);
|
||||
EXPECT_EQ(TimeoutControls::maxTimeout, mockCsr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
|
||||
EXPECT_EQ(expectedTaskCount, mockCsr->waitForCompletionWithTimeoutParamsPassed[0].taskCountToWait);
|
||||
} else {
|
||||
EXPECT_EQ(0u, mockCsr->waitForCompletionWithTimeoutCalled);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_P(MemObjSyncDestructionTest, givenMemObjWithMapAllocationWhenAsyncDestructionsAreDisabledThenMapAllocationIsNotDeferred) {
|
||||
auto hasMapAllocation = GetParam();
|
||||
|
||||
auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(*device->executionEnvironment, device->getDeviceBitfield());
|
||||
auto mockCsr = new MyCsr<FamilyType>(*device->executionEnvironment, device->getDeviceBitfield());
|
||||
device->resetCommandStreamReceiver(mockCsr);
|
||||
*mockCsr->getTagAddress() = 0;
|
||||
|
||||
@ -386,7 +398,7 @@ HWTEST_P(MemObjSyncDestructionTest, givenMemObjWithMapAllocationWhenAsyncDestruc
|
||||
HWTEST_P(MemObjAsyncDestructionTest, givenMemObjWithMapAllocationWithoutMemUseHostPtrFlagWhenAsyncDestructionsAreEnabledThenMapAllocationIsDeferred) {
|
||||
auto hasMapAllocation = GetParam();
|
||||
|
||||
auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(*device->executionEnvironment, device->getDeviceBitfield());
|
||||
auto mockCsr = new MyCsr<FamilyType>(*device->executionEnvironment, device->getDeviceBitfield());
|
||||
device->resetCommandStreamReceiver(mockCsr);
|
||||
*mockCsr->getTagAddress() = 0;
|
||||
|
||||
@ -425,7 +437,7 @@ HWTEST_P(MemObjAsyncDestructionTest, givenMemObjWithMapAllocationWithoutMemUseHo
|
||||
HWTEST_P(MemObjAsyncDestructionTest, givenMemObjWithMapAllocationWithMemUseHostPtrFlagWhenAsyncDestructionsAreEnabledThenMapAllocationIsNotDeferred) {
|
||||
auto hasMapAllocation = GetParam();
|
||||
|
||||
auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(*device->executionEnvironment, device->getDeviceBitfield());
|
||||
auto mockCsr = new MyCsr<FamilyType>(*device->executionEnvironment, device->getDeviceBitfield());
|
||||
device->resetCommandStreamReceiver(mockCsr);
|
||||
*mockCsr->getTagAddress() = 0;
|
||||
|
||||
@ -486,7 +498,7 @@ HWTEST_F(UsmDestructionTests, givenSharedUsmAllocationWhenBlockingFreeIsCalledTh
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(*mockDevice.executionEnvironment, 1);
|
||||
auto mockCsr = new MyCsr<FamilyType>(*mockDevice.executionEnvironment, 1);
|
||||
mockDevice.resetCommandStreamReceiver(mockCsr);
|
||||
*mockCsr->getTagAddress() = 5u;
|
||||
|
||||
@ -498,15 +510,16 @@ HWTEST_F(UsmDestructionTests, givenSharedUsmAllocationWhenBlockingFreeIsCalledTh
|
||||
|
||||
auto svmEntry = svmAllocationsManager->getSVMAlloc(sharedMemory);
|
||||
|
||||
auto waitForCompletionWithTimeoutMock = [=](bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait) { return NEO::WaitStatus::Ready; };
|
||||
ON_CALL(*mockCsr, waitForCompletionWithTimeout(::testing::_, ::testing::_, ::testing::_))
|
||||
.WillByDefault(::testing::Invoke(waitForCompletionWithTimeoutMock));
|
||||
svmEntry->gpuAllocations.getGraphicsAllocation(mockDevice.getRootDeviceIndex())->updateTaskCount(6u, 0u);
|
||||
svmEntry->cpuAllocation->updateTaskCount(6u, 0u);
|
||||
EXPECT_CALL(*mockCsr, waitForCompletionWithTimeout(::testing::_, TimeoutControls::maxTimeout, 6u))
|
||||
.Times(2);
|
||||
|
||||
clMemBlockingFreeINTEL(&mockContext, sharedMemory);
|
||||
|
||||
EXPECT_EQ(2u, mockCsr->waitForCompletionWithTimeoutCalled);
|
||||
EXPECT_EQ(TimeoutControls::maxTimeout, mockCsr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
|
||||
EXPECT_EQ(TimeoutControls::maxTimeout, mockCsr->waitForCompletionWithTimeoutParamsPassed[1].timeoutMs);
|
||||
EXPECT_EQ(6u, mockCsr->waitForCompletionWithTimeoutParamsPassed[0].taskCountToWait);
|
||||
EXPECT_EQ(6u, mockCsr->waitForCompletionWithTimeoutParamsPassed[1].taskCountToWait);
|
||||
}
|
||||
|
||||
HWTEST_F(UsmDestructionTests, givenUsmAllocationWhenBlockingFreeIsCalledThenWaitForCompletionIsCalled) {
|
||||
@ -519,7 +532,7 @@ HWTEST_F(UsmDestructionTests, givenUsmAllocationWhenBlockingFreeIsCalledThenWait
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(*mockDevice.executionEnvironment, 1);
|
||||
auto mockCsr = new MyCsr<FamilyType>(*mockDevice.executionEnvironment, 1);
|
||||
mockDevice.resetCommandStreamReceiver(mockCsr);
|
||||
*mockCsr->getTagAddress() = 5u;
|
||||
|
||||
@ -531,12 +544,11 @@ HWTEST_F(UsmDestructionTests, givenUsmAllocationWhenBlockingFreeIsCalledThenWait
|
||||
|
||||
auto svmEntry = svmAllocationsManager->getSVMAlloc(hostMemory);
|
||||
|
||||
auto waitForCompletionWithTimeoutMock = [=](bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait) { return NEO::WaitStatus::Ready; };
|
||||
ON_CALL(*mockCsr, waitForCompletionWithTimeout(::testing::_, ::testing::_, ::testing::_))
|
||||
.WillByDefault(::testing::Invoke(waitForCompletionWithTimeoutMock));
|
||||
svmEntry->gpuAllocations.getGraphicsAllocation(mockDevice.getRootDeviceIndex())->updateTaskCount(6u, 0u);
|
||||
EXPECT_CALL(*mockCsr, waitForCompletionWithTimeout(::testing::_, TimeoutControls::maxTimeout, 6u))
|
||||
.Times(1);
|
||||
|
||||
clMemBlockingFreeINTEL(&mockContext, hostMemory);
|
||||
|
||||
EXPECT_EQ(1u, mockCsr->waitForCompletionWithTimeoutCalled);
|
||||
EXPECT_EQ(TimeoutControls::maxTimeout, mockCsr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
|
||||
EXPECT_EQ(6u, mockCsr->waitForCompletionWithTimeoutParamsPassed[0].taskCountToWait);
|
||||
}
|
||||
|
Reference in New Issue
Block a user