mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Use EXPECT_THROW instead of handmade try-catch in tests
Signed-off-by: Patryk Wrobel <patryk.wrobel@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
301be3c21b
commit
4395e0c3a1
@ -1868,19 +1868,12 @@ TEST_F(MemoryManagerWithCsrTest, GivenAllocationsInHostPtrManagerWhenBiggerOverl
|
||||
|
||||
GraphicsAllocation *graphicsAllocation3 = nullptr;
|
||||
|
||||
bool catchMe = false;
|
||||
try {
|
||||
graphicsAllocation3 = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), false, MemoryConstants::pageSize * 10}, cpuPtr3);
|
||||
} catch (...) {
|
||||
catchMe = true;
|
||||
}
|
||||
EXPECT_ANY_THROW(graphicsAllocation3 = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), false, MemoryConstants::pageSize * 10}, cpuPtr3));
|
||||
|
||||
EXPECT_NE(nullptr, graphicsAllocation1);
|
||||
EXPECT_NE(nullptr, graphicsAllocation2);
|
||||
EXPECT_EQ(nullptr, graphicsAllocation3);
|
||||
|
||||
EXPECT_TRUE(catchMe);
|
||||
|
||||
EXPECT_EQ((uintptr_t)cpuPtr1 & ~MemoryConstants::pageMask, (uintptr_t)graphicsAllocation1->fragmentsStorage.fragmentStorageData[0].cpuPtr);
|
||||
EXPECT_EQ((uintptr_t)cpuPtr2 & ~MemoryConstants::pageMask, (uintptr_t)graphicsAllocation2->fragmentsStorage.fragmentStorageData[0].cpuPtr);
|
||||
EXPECT_EQ(((uintptr_t)cpuPtr2 + MemoryConstants::pageSize) & ~MemoryConstants::pageMask, (uintptr_t)graphicsAllocation2->fragmentsStorage.fragmentStorageData[1].cpuPtr);
|
||||
|
Reference in New Issue
Block a user