Add failAllocate32Bit flag to MockMemoryManager

Related-To: NEO-2877

Change-Id: Ifc0461a9131472591b8306840af85d405a82a9eb
Signed-off-by: Venevtsev, Igor <igor.venevtsev@intel.com>
This commit is contained in:
Venevtsev, Igor 2019-07-26 15:28:06 +02:00
parent 223c979d3a
commit 169ec2b21a
2 changed files with 10 additions and 0 deletions

View File

@ -98,6 +98,13 @@ GraphicsAllocation *MockMemoryManager::allocate32BitGraphicsMemory(size_t size,
return allocate32BitGraphicsMemoryImpl(allocationData);
}
GraphicsAllocation *MockMemoryManager::allocate32BitGraphicsMemoryImpl(const AllocationData &allocationData) {
if (failAllocate32Bit) {
return nullptr;
}
return OsAgnosticMemoryManager::allocate32BitGraphicsMemoryImpl(allocationData);
}
FailMemoryManager::FailMemoryManager(int32_t failedAllocationsCount, ExecutionEnvironment &executionEnvironment) : MockMemoryManager(executionEnvironment) {
this->failedAllocationsCount = failedAllocationsCount;
}

View File

@ -37,6 +37,7 @@ class MockMemoryManager : public MemoryManagerCreate<OsAgnosticMemoryManager> {
using MemoryManager::createStorageInfoFromProperties;
using MemoryManager::getAllocationData;
using MemoryManager::getBanksCount;
using MemoryManager::gfxPartition;
using MemoryManager::localMemoryUsageBankSelector;
using MemoryManager::multiContextResourceDestructor;
using MemoryManager::registeredEngines;
@ -97,6 +98,7 @@ class MockMemoryManager : public MemoryManagerCreate<OsAgnosticMemoryManager> {
}
GraphicsAllocation *allocate32BitGraphicsMemory(size_t size, const void *ptr, GraphicsAllocation::AllocationType allocationType);
GraphicsAllocation *allocate32BitGraphicsMemoryImpl(const AllocationData &allocationData) override;
uint32_t freeGraphicsMemoryCalled = 0u;
uint32_t unlockResourceCalled = 0u;
@ -112,6 +114,7 @@ class MockMemoryManager : public MemoryManagerCreate<OsAgnosticMemoryManager> {
bool allocateForImageCalled = false;
bool failReserveAddress = false;
bool failAllocateSystemMemory = false;
bool failAllocate32Bit = false;
std::unique_ptr<ExecutionEnvironment> mockExecutionEnvironment;
};