diff --git a/tests/kfdtest/src/KFDExceptionTest.cpp b/tests/kfdtest/src/KFDExceptionTest.cpp index ddcf8ceb16..67ccc68336 100644 --- a/tests/kfdtest/src/KFDExceptionTest.cpp +++ b/tests/kfdtest/src/KFDExceptionTest.cpp @@ -184,11 +184,8 @@ TEST_F(KFDExceptionTest, AddressFault) { m_ChildPid = fork(); if (m_ChildPid == 0) { - m_ChildStatus = hsaKmtOpenKFD(); - if (m_ChildStatus != HSAKMT_STATUS_SUCCESS) { - WARN() << "KFD open failed in child process" << std::endl; - return; - } + KFDBaseComponentTest::TearDown(); + KFDBaseComponentTest::SetUp(); HsaMemoryBuffer srcBuffer(PAGE_SIZE, defaultGPUNode, false); @@ -228,11 +225,8 @@ TEST_F(KFDExceptionTest, PermissionFault) { m_ChildPid = fork(); if (m_ChildPid == 0) { - m_ChildStatus = hsaKmtOpenKFD(); - if (m_ChildStatus != HSAKMT_STATUS_SUCCESS) { - WARN() << "KFD open failed in child process" << std::endl; - return; - } + KFDBaseComponentTest::TearDown(); + KFDBaseComponentTest::SetUp(); HsaMemoryBuffer readOnlyBuffer(PAGE_SIZE, defaultGPUNode, false /*zero*/, false /*isLocal*/, true /*isExec*/, @@ -278,11 +272,8 @@ TEST_F(KFDExceptionTest, FaultStorm) { m_ChildPid = fork(); if (m_ChildPid == 0) { - m_ChildStatus = hsaKmtOpenKFD(); - if (m_ChildStatus != HSAKMT_STATUS_SUCCESS) { - WARN() << "KFD open failed in child process" << std::endl; - return; - } + KFDBaseComponentTest::TearDown(); + KFDBaseComponentTest::SetUp(); TestMemoryException(defaultGPUNode, 0x12345678, 0x76543210, 1024, 1024, 1); } else { @@ -321,11 +312,10 @@ TEST_F(KFDExceptionTest, SdmaQueueException) { if (m_ChildPid == 0) { unsigned int* pDb = NULL; unsigned int *nullPtr = NULL; - m_ChildStatus = hsaKmtOpenKFD(); - if (m_ChildStatus != HSAKMT_STATUS_SUCCESS) { - WARN() << "KFD open failed in child process" << std::endl; - return; - } + + KFDBaseComponentTest::TearDown(); + KFDBaseComponentTest::SetUp(); + m_MemoryFlags.ui32.NonPaged = 1; ASSERT_SUCCESS(hsaKmtAllocMemory(defaultGPUNode, PAGE_SIZE, m_MemoryFlags, reinterpret_cast(&pDb))); diff --git a/tests/kfdtest/src/KFDExceptionTest.hpp b/tests/kfdtest/src/KFDExceptionTest.hpp index df57649e2c..f544d95100 100644 --- a/tests/kfdtest/src/KFDExceptionTest.hpp +++ b/tests/kfdtest/src/KFDExceptionTest.hpp @@ -42,8 +42,11 @@ class KFDExceptionTest : public KFDBaseComponentTest { * child process finishes, gtest assumes the test has finished and * starts the next test while the parent is still active. */ - if (m_ChildPid == 0) + if (m_ChildPid == 0) { + if (!m_ChildStatus && HasFatalFailure()) + m_ChildStatus = HSAKMT_STATUS_ERROR; exit(m_ChildStatus); + } } protected: diff --git a/tests/kfdtest/src/KFDIPCTest.cpp b/tests/kfdtest/src/KFDIPCTest.cpp index c18b471307..77a94b6eb7 100644 --- a/tests/kfdtest/src/KFDIPCTest.cpp +++ b/tests/kfdtest/src/KFDIPCTest.cpp @@ -70,8 +70,8 @@ void KFDIPCTest::BasicTestChildProcess(int defaultGPUNode, int *pipefd, HsaMemFl /* Open KFD device for child process. This needs to called before * any memory definitions */ - if (HSAKMT_STATUS_SUCCESS != hsaKmtOpenKFD()) - exit(1); + TearDown(); + SetUp(); SDMAQueue sdmaQueue; HsaSharedMemoryHandle sharedHandleLM; @@ -635,7 +635,10 @@ TEST_F(KFDIPCTest, CrossMemoryAttachTest) { /* Create a child process and share the above Local Memory with it */ m_ChildPid = fork(); - if (m_ChildPid == 0 && hsaKmtOpenKFD() == HSAKMT_STATUS_SUCCESS) { + if (m_ChildPid == 0) { + TearDown(); + SetUp(); + /* Child Process */ status = CrossMemoryAttachChildProcess(defaultGPUNode, pipeCtoP[1], pipePtoC[0], CMA_READ_TEST);