mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 01:04:57 +08:00
Don't copy memory to allocation if allocation has no storage
Change-Id: I3238bec02e5c1ec5877537318bb563e3d0f3799d Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
74f1896c03
commit
c0325b5d19
@@ -1723,16 +1723,12 @@ TEST_F(MemoryAllocatorTest, whenCommandStreamerIsNotRegisteredThenReturnNullEngi
|
||||
auto engineControl = memoryManager->getRegisteredEngineForCsr(dummyCsr);
|
||||
EXPECT_EQ(nullptr, engineControl);
|
||||
}
|
||||
TEST(MemoryManagerCopyMemoryTest, givenNullPointerOrZeroSizeWhenCopyMemoryToAllocationThenReturnFalse) {
|
||||
TEST(MemoryManagerCopyMemoryTest, givenAllocationWithNoStorageWhenCopyMemoryToAllocationThenReturnFalse) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
MockMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
constexpr uint8_t allocationSize = 10;
|
||||
uint8_t allocationStorage[allocationSize];
|
||||
MockGraphicsAllocation allocation{allocationStorage, allocationSize};
|
||||
uint8_t memory = 1;
|
||||
EXPECT_FALSE(memoryManager.copyMemoryToAllocation(nullptr, &memory, sizeof(memory)));
|
||||
EXPECT_FALSE(memoryManager.copyMemoryToAllocation(&allocation, nullptr, sizeof(memory)));
|
||||
EXPECT_FALSE(memoryManager.copyMemoryToAllocation(&allocation, &memory, 0u));
|
||||
MockGraphicsAllocation invalidAllocation{nullptr, 0u};
|
||||
EXPECT_FALSE(memoryManager.copyMemoryToAllocation(&invalidAllocation, &memory, sizeof(memory)));
|
||||
}
|
||||
TEST(MemoryManagerCopyMemoryTest, givenValidAllocationAndMemoryWhenCopyMemoryToAllocationThenDataIsCopied) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
|
||||
Reference in New Issue
Block a user