kfdtest: Consolidate logic for ASSERT vs EXPECT

ASSERT failures result in immediate termination of the test. EXPECT
returns a failure but continues execution. Reserve ASSERT for required
functionality (node initialization, queue creation, etc) where the rest
of the test cannot run if that call fails. Use EXPECT everywhere else

Change-Id: I1c11326fc3ae22b50fa83b07b3b49af1e1f4e69e


[ROCm/ROCR-Runtime commit: fe33461622]
This commit is contained in:
Kent Russell
2018-08-20 09:54:26 -04:00
vanhempi b86f145610
commit 52536ba23b
17 muutettua tiedostoa jossa 208 lisäystä ja 209 poistoa
@@ -96,11 +96,11 @@ TEST_F(KFDLocalMemoryTest, BasicTest) {
dispatch.Submit(queue);
dispatch.Sync(g_TestTimeOut);
ASSERT_SUCCESS(queue.Destroy());
EXPECT_SUCCESS(queue.Destroy());
ASSERT_SUCCESS(hsaKmtUnmapMemoryToGPU(srcLocalBuffer.As<void*>()));
ASSERT_SUCCESS(hsaKmtUnmapMemoryToGPU(dstLocalBuffer.As<void*>()));
ASSERT_EQ(destSysBuffer.As<unsigned int*>()[0], 0x01010101);
EXPECT_SUCCESS(hsaKmtUnmapMemoryToGPU(srcLocalBuffer.As<void*>()));
EXPECT_SUCCESS(hsaKmtUnmapMemoryToGPU(dstLocalBuffer.As<void*>()));
EXPECT_EQ(destSysBuffer.As<unsigned int*>()[0], 0x01010101);
TEST_END
}
@@ -142,17 +142,17 @@ TEST_F(KFDLocalMemoryTest, VerifyContentsAfterUnmapAndMap) {
dispatch.Submit(queue);
dispatch.Sync(g_TestTimeOut);
ASSERT_SUCCESS(hsaKmtUnmapMemoryToGPU(LocalBuffer.As<void*>()));
ASSERT_SUCCESS(hsaKmtMapMemoryToGPU(LocalBuffer.As<void*>(), LocalBuffer.Size(), &AlternateVAGPU));
EXPECT_SUCCESS(hsaKmtUnmapMemoryToGPU(LocalBuffer.As<void*>()));
EXPECT_SUCCESS(hsaKmtMapMemoryToGPU(LocalBuffer.As<void*>(), LocalBuffer.Size(), &AlternateVAGPU));
dispatch.SetArgs(LocalBuffer.As<void*>(), SysBufferB.As<void*>());
dispatch.Submit(queue);
dispatch.Sync(g_TestTimeOut);
ASSERT_SUCCESS(queue.Destroy());
ASSERT_EQ(SysBufferB.As<unsigned int*>()[0], 0x01010101);
EXPECT_SUCCESS(queue.Destroy());
EXPECT_EQ(SysBufferB.As<unsigned int*>()[0], 0x01010101);
if (!is_dgpu())
ASSERT_SUCCESS(hsaKmtUnmapMemoryToGPU(LocalBuffer.As<void*>()));
EXPECT_SUCCESS(hsaKmtUnmapMemoryToGPU(LocalBuffer.As<void*>()));
TEST_END
}
@@ -378,7 +378,7 @@ TEST_F(KFDLocalMemoryTest, Fragmentation) {
delete[] pages[order].pointers;
}
ASSERT_SUCCESS(queue.Destroy());
EXPECT_SUCCESS(queue.Destroy());
TEST_END
}