Diagnostics: Remove duplicate code
gpuProcessCleanUp is defined in multile places, Reuse common code for cleaning up all processes. Related-To: LOCI-3746 Signed-off-by: Bellekallu Rajkiran <bellekallu.rajkiran@intel.com>
This commit is contained in:
parent
fd6035d06c
commit
8d39ab7bcd
|
@ -32,41 +32,6 @@ void OsDiagnostics::getSupportedDiagTestsFromFW(void *pOsSysman, std::vector<std
|
|||
}
|
||||
}
|
||||
|
||||
ze_result_t LinuxDiagnosticsImp::gpuProcessCleanup() {
|
||||
::pid_t myPid = pProcfsAccess->myProcessId();
|
||||
std::vector<::pid_t> processes;
|
||||
std::vector<int> myPidFds;
|
||||
ze_result_t result = pProcfsAccess->listProcesses(processes);
|
||||
if (ZE_RESULT_SUCCESS != result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
for (auto &&pid : processes) {
|
||||
std::vector<int> fds;
|
||||
pLinuxSysmanImp->getPidFdsForOpenDevice(pProcfsAccess, pSysfsAccess, pid, fds);
|
||||
if (pid == myPid) {
|
||||
// L0 is expected to have this file open.
|
||||
// Keep list of fds. Close before unbind.
|
||||
myPidFds = fds;
|
||||
continue;
|
||||
}
|
||||
if (!fds.empty()) {
|
||||
pProcfsAccess->kill(pid);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &&fd : myPidFds) {
|
||||
// Close open filedescriptors to the device
|
||||
// before unbinding device.
|
||||
// From this point forward, there is no
|
||||
// graceful way to fail the reset call.
|
||||
// All future ze calls by this process for this
|
||||
// device will fail.
|
||||
::close(fd);
|
||||
}
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
// before running diagnostics need to close all active workloads
|
||||
// writing 1 to /sys/class/drm/card<n>/quiesce_gpu will signal KMD
|
||||
//to close and clear all allocations,
|
||||
|
@ -86,7 +51,7 @@ ze_result_t LinuxDiagnosticsImp::waitForQuiescentCompletion() {
|
|||
if (ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE == result) {
|
||||
count++;
|
||||
NEO::sleep(std::chrono::seconds(1)); // Sleep for 1second every loop, gives enough time for KMD to clear all allocations and wedge the system
|
||||
auto processResult = gpuProcessCleanup();
|
||||
auto processResult = pLinuxSysmanImp->gpuProcessCleanup();
|
||||
if (ZE_RESULT_SUCCESS != processResult) {
|
||||
return processResult;
|
||||
}
|
||||
|
@ -110,7 +75,7 @@ ze_result_t LinuxDiagnosticsImp::osRunDiagTestsinFW(zes_diag_result_t *pResult)
|
|||
NEO::ExecutionEnvironment *executionEnvironment = devicePtr->getNEODevice()->getExecutionEnvironment();
|
||||
auto restorer = std::make_unique<L0::ExecutionEnvironmentRefCountRestore>(executionEnvironment);
|
||||
pLinuxSysmanImp->releaseDeviceResources();
|
||||
ze_result_t result = gpuProcessCleanup();
|
||||
ze_result_t result = pLinuxSysmanImp->gpuProcessCleanup();
|
||||
if (ZE_RESULT_SUCCESS != result) {
|
||||
return result;
|
||||
}
|
||||
|
@ -156,7 +121,6 @@ LinuxDiagnosticsImp::LinuxDiagnosticsImp(OsSysman *pOsSysman, const std::string
|
|||
pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
|
||||
pFwInterface = pLinuxSysmanImp->getFwUtilInterface();
|
||||
pSysfsAccess = &pLinuxSysmanImp->getSysfsAccess();
|
||||
pProcfsAccess = &pLinuxSysmanImp->getProcfsAccess();
|
||||
}
|
||||
|
||||
std::unique_ptr<OsDiagnostics> OsDiagnostics::create(OsSysman *pOsSysman, const std::string &diagTests) {
|
||||
|
|
|
@ -31,7 +31,6 @@ class LinuxDiagnosticsImp : public OsDiagnostics, NEO::NonCopyableOrMovableClass
|
|||
FirmwareUtil *pFwInterface = nullptr;
|
||||
SysfsAccess *pSysfsAccess = nullptr;
|
||||
FsAccess *pFsAccess = nullptr;
|
||||
ProcfsAccess *pProcfsAccess = nullptr;
|
||||
ze_result_t gpuProcessCleanup();
|
||||
ze_result_t waitForQuiescentCompletion();
|
||||
|
||||
|
|
|
@ -27,10 +27,7 @@ const std::string mockSlotPath1("/sys/bus/pci/slots/1/");
|
|||
const std::string mockCorrectRootAddress("0000:8a:00.0");
|
||||
const std::string mockWrongRootAddress("0000:7a:00.0");
|
||||
|
||||
class DiagnosticsFwInterface : public FirmwareUtil {};
|
||||
|
||||
template <>
|
||||
struct Mock<DiagnosticsFwInterface> : public DiagnosticsFwInterface {
|
||||
struct MockDiagnosticsFwInterface : public FirmwareUtil {
|
||||
zes_diag_result_t mockDiagResult = ZES_DIAG_RESULT_NO_ERRORS;
|
||||
ze_result_t mockFwInitResult = ZE_RESULT_SUCCESS;
|
||||
ze_result_t mockFwRunDiagTestsResult = ZE_RESULT_SUCCESS;
|
||||
|
@ -57,7 +54,7 @@ struct Mock<DiagnosticsFwInterface> : public DiagnosticsFwInterface {
|
|||
mockDiagResult = result;
|
||||
}
|
||||
|
||||
Mock<DiagnosticsFwInterface>() = default;
|
||||
MockDiagnosticsFwInterface() = default;
|
||||
|
||||
ADDMETHOD_NOBASE(getFwVersion, ze_result_t, ZE_RESULT_SUCCESS, (std::string fwType, std::string &firmwareVersion));
|
||||
ADDMETHOD_NOBASE(flashFirmware, ze_result_t, ZE_RESULT_SUCCESS, (std::string fwType, void *pImage, uint32_t size));
|
||||
|
@ -72,9 +69,7 @@ struct MockGlobalOperationsEngineHandleContext : public EngineHandleContext {
|
|||
void init(std::vector<ze_device_handle_t> &deviceHandles) override {}
|
||||
};
|
||||
|
||||
class DiagFsAccess : public FsAccess {};
|
||||
template <>
|
||||
struct Mock<DiagFsAccess> : public DiagFsAccess {
|
||||
struct MockDiagFsAccess : public FsAccess {
|
||||
ze_result_t mockReadError = ZE_RESULT_SUCCESS;
|
||||
ze_result_t mockWriteError = ZE_RESULT_SUCCESS;
|
||||
ze_result_t mockListDirError = ZE_RESULT_SUCCESS;
|
||||
|
@ -126,12 +121,10 @@ struct Mock<DiagFsAccess> : public DiagFsAccess {
|
|||
mockRootAddress = mockWrongRootAddress;
|
||||
}
|
||||
|
||||
Mock<DiagFsAccess>() = default;
|
||||
MockDiagFsAccess() = default;
|
||||
};
|
||||
|
||||
class DiagSysfsAccess : public SysfsAccess {};
|
||||
template <>
|
||||
struct Mock<DiagSysfsAccess> : public DiagSysfsAccess {
|
||||
struct MockDiagSysfsAccess : public SysfsAccess {
|
||||
ze_result_t mockError = ZE_RESULT_SUCCESS;
|
||||
int checkErrorAfterCount = 0;
|
||||
ze_result_t getRealPath(const std::string file, std::string &val) override {
|
||||
|
@ -183,13 +176,10 @@ struct Mock<DiagSysfsAccess> : public DiagSysfsAccess {
|
|||
checkErrorAfterCount = count;
|
||||
setMockError(result);
|
||||
}
|
||||
Mock<DiagSysfsAccess>() = default;
|
||||
MockDiagSysfsAccess() = default;
|
||||
};
|
||||
|
||||
class DiagProcfsAccess : public ProcfsAccess {};
|
||||
|
||||
template <>
|
||||
struct Mock<DiagProcfsAccess> : public DiagProcfsAccess {
|
||||
struct MockDiagProcfsAccess : public ProcfsAccess {
|
||||
std::vector<::pid_t> pidList = {1, 2, 3};
|
||||
::pid_t ourDevicePid = 0;
|
||||
ze_result_t mockError = ZE_RESULT_SUCCESS;
|
||||
|
@ -217,10 +207,11 @@ struct Mock<DiagProcfsAccess> : public DiagProcfsAccess {
|
|||
mockError = result;
|
||||
}
|
||||
|
||||
Mock<DiagProcfsAccess>() = default;
|
||||
MockDiagProcfsAccess() = default;
|
||||
};
|
||||
|
||||
struct MockDiagLinuxSysmanImp : public LinuxSysmanImp {
|
||||
using LinuxSysmanImp::pProcfsAccess;
|
||||
MockDiagLinuxSysmanImp(SysmanDeviceImp *pParentSysmanDeviceImp) : LinuxSysmanImp(pParentSysmanDeviceImp) {}
|
||||
std::vector<int> fdList = {0, 1, 2};
|
||||
::pid_t ourDevicePid = 0;
|
||||
|
@ -263,7 +254,6 @@ class PublicLinuxDiagnosticsImp : public L0::LinuxDiagnosticsImp {
|
|||
using LinuxDiagnosticsImp::gpuProcessCleanup;
|
||||
using LinuxDiagnosticsImp::pFwInterface;
|
||||
using LinuxDiagnosticsImp::pLinuxSysmanImp;
|
||||
using LinuxDiagnosticsImp::pProcfsAccess;
|
||||
using LinuxDiagnosticsImp::pSysfsAccess;
|
||||
using LinuxDiagnosticsImp::waitForQuiescentCompletion;
|
||||
};
|
||||
|
|
|
@ -54,10 +54,10 @@ class ZesDiagnosticsFixture : public SysmanDeviceFixture {
|
|||
|
||||
protected:
|
||||
zes_diag_handle_t hSysmanDiagnostics = {};
|
||||
std::unique_ptr<Mock<DiagnosticsFwInterface>> pMockDiagFwInterface;
|
||||
std::unique_ptr<Mock<DiagSysfsAccess>> pMockSysfsAccess;
|
||||
std::unique_ptr<Mock<DiagFsAccess>> pMockFsAccess;
|
||||
std::unique_ptr<Mock<DiagProcfsAccess>> pMockDiagProcfsAccess;
|
||||
std::unique_ptr<MockDiagnosticsFwInterface> pMockDiagFwInterface;
|
||||
std::unique_ptr<MockDiagSysfsAccess> pMockSysfsAccess;
|
||||
std::unique_ptr<MockDiagFsAccess> pMockFsAccess;
|
||||
std::unique_ptr<MockDiagProcfsAccess> pMockDiagProcfsAccess;
|
||||
std::unique_ptr<MockGlobalOperationsEngineHandleContext> pEngineHandleContext;
|
||||
std::unique_ptr<MockDiagLinuxSysmanImp> pMockDiagLinuxSysmanImp;
|
||||
|
||||
|
@ -66,7 +66,6 @@ class ZesDiagnosticsFixture : public SysmanDeviceFixture {
|
|||
FsAccess *pFsAccessOld = nullptr;
|
||||
ProcfsAccess *pProcfsAccessOld = nullptr;
|
||||
EngineHandleContext *pEngineHandleContextOld = nullptr;
|
||||
LinuxSysmanImp *pLinuxSysmanImpOld = nullptr;
|
||||
PRODUCT_FAMILY productFamily;
|
||||
|
||||
void SetUp() override {
|
||||
|
@ -79,13 +78,12 @@ class ZesDiagnosticsFixture : public SysmanDeviceFixture {
|
|||
pFsAccessOld = pLinuxSysmanImp->pFsAccess;
|
||||
pProcfsAccessOld = pLinuxSysmanImp->pProcfsAccess;
|
||||
pFwUtilInterfaceOld = pLinuxSysmanImp->pFwUtilInterface;
|
||||
pLinuxSysmanImpOld = pLinuxSysmanImp;
|
||||
|
||||
pEngineHandleContext = std::make_unique<MockGlobalOperationsEngineHandleContext>(pOsSysman);
|
||||
pMockDiagFwInterface = std::make_unique<NiceMock<Mock<DiagnosticsFwInterface>>>();
|
||||
pMockSysfsAccess = std::make_unique<NiceMock<Mock<DiagSysfsAccess>>>();
|
||||
pMockFsAccess = std::make_unique<NiceMock<Mock<DiagFsAccess>>>();
|
||||
pMockDiagProcfsAccess = std::make_unique<NiceMock<Mock<DiagProcfsAccess>>>();
|
||||
pMockDiagFwInterface = std::make_unique<MockDiagnosticsFwInterface>();
|
||||
pMockSysfsAccess = std::make_unique<MockDiagSysfsAccess>();
|
||||
pMockFsAccess = std::make_unique<MockDiagFsAccess>();
|
||||
pMockDiagProcfsAccess = std::make_unique<MockDiagProcfsAccess>();
|
||||
pMockDiagLinuxSysmanImp = std::make_unique<MockDiagLinuxSysmanImp>(pLinuxSysmanImp->getSysmanDeviceImp());
|
||||
pSysmanDeviceImp->pEngineHandleContext = pEngineHandleContext.get();
|
||||
pLinuxSysmanImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
|
@ -213,9 +211,9 @@ TEST_F(ZesDiagnosticsFixture, GivenValidDiagnosticsHandleWhenRunningDiagnosticsT
|
|||
|
||||
pPublicLinuxDiagnosticsImp->pSysfsAccess = pMockSysfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pFwInterface = pMockDiagFwInterface.get();
|
||||
pPublicLinuxDiagnosticsImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp = pMockDiagLinuxSysmanImp.get();
|
||||
|
||||
VariableBackup<ProcfsAccess *> backup(&pMockDiagLinuxSysmanImp->pProcfsAccess);
|
||||
pMockDiagLinuxSysmanImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp->pDevice = pLinuxSysmanImp->getDeviceHandle();
|
||||
|
||||
DiagnosticsImp *ptestDiagnosticsImp = new DiagnosticsImp(pSysmanDeviceImp->pDiagnosticsHandleContext->pOsSysman, mockSupportedDiagTypes[0]);
|
||||
|
@ -239,10 +237,10 @@ TEST_F(ZesDiagnosticsFixture, GivenValidDiagnosticsHandleWhenRunningDiagnosticsT
|
|||
|
||||
pPublicLinuxDiagnosticsImp->pSysfsAccess = pMockSysfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pFwInterface = pMockDiagFwInterface.get();
|
||||
pPublicLinuxDiagnosticsImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp = pMockDiagLinuxSysmanImp.get();
|
||||
|
||||
VariableBackup<ProcfsAccess *> backup(&pMockDiagLinuxSysmanImp->pProcfsAccess);
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp->pDevice = pLinuxSysmanImp->getDeviceHandle();
|
||||
pMockDiagLinuxSysmanImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
|
||||
pMockDiagFwInterface->setDiagResult(ZES_DIAG_RESULT_FORCE_UINT32);
|
||||
pMockDiagFwInterface->mockFwRunDiagTestsResult = ZE_RESULT_ERROR_NOT_AVAILABLE;
|
||||
|
@ -267,8 +265,9 @@ TEST_F(ZesDiagnosticsFixture, GivenValidDiagnosticsHandleWhenListProcessFailsThe
|
|||
|
||||
pPublicLinuxDiagnosticsImp->pSysfsAccess = pMockSysfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pFwInterface = pMockDiagFwInterface.get();
|
||||
pPublicLinuxDiagnosticsImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp = pMockDiagLinuxSysmanImp.get();
|
||||
VariableBackup<ProcfsAccess *> backup(&pMockDiagLinuxSysmanImp->pProcfsAccess);
|
||||
pMockDiagLinuxSysmanImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp->pDevice = pLinuxSysmanImp->getDeviceHandle();
|
||||
|
||||
|
@ -295,8 +294,9 @@ TEST_F(ZesDiagnosticsFixture, GivenValidDiagnosticsHandleWhenQuiescentingFailsTh
|
|||
|
||||
pPublicLinuxDiagnosticsImp->pSysfsAccess = pMockSysfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pFwInterface = pMockDiagFwInterface.get();
|
||||
pPublicLinuxDiagnosticsImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp = pMockDiagLinuxSysmanImp.get();
|
||||
VariableBackup<ProcfsAccess *> backup(&pMockDiagLinuxSysmanImp->pProcfsAccess);
|
||||
pMockDiagLinuxSysmanImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp->pDevice = pLinuxSysmanImp->getDeviceHandle();
|
||||
|
||||
|
@ -323,8 +323,9 @@ TEST_F(ZesDiagnosticsFixture, GivenValidDiagnosticsHandleWhenInvalidateLmemFails
|
|||
|
||||
pPublicLinuxDiagnosticsImp->pSysfsAccess = pMockSysfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pFwInterface = pMockDiagFwInterface.get();
|
||||
pPublicLinuxDiagnosticsImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp = pMockDiagLinuxSysmanImp.get();
|
||||
VariableBackup<ProcfsAccess *> backup(&pMockDiagLinuxSysmanImp->pProcfsAccess);
|
||||
pMockDiagLinuxSysmanImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp->pDevice = pLinuxSysmanImp->getDeviceHandle();
|
||||
|
||||
|
@ -351,8 +352,9 @@ TEST_F(ZesDiagnosticsFixture, GivenValidDiagnosticsHandleWhenColdResetFailsThenC
|
|||
|
||||
pPublicLinuxDiagnosticsImp->pSysfsAccess = pMockSysfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pFwInterface = pMockDiagFwInterface.get();
|
||||
pPublicLinuxDiagnosticsImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp = pMockDiagLinuxSysmanImp.get();
|
||||
VariableBackup<ProcfsAccess *> backup(&pMockDiagLinuxSysmanImp->pProcfsAccess);
|
||||
pMockDiagLinuxSysmanImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp->pDevice = pLinuxSysmanImp->getDeviceHandle();
|
||||
|
||||
|
@ -380,8 +382,9 @@ TEST_F(ZesDiagnosticsFixture, GivenValidDiagnosticsHandleWhenWarmResetFailsThenC
|
|||
|
||||
pPublicLinuxDiagnosticsImp->pSysfsAccess = pMockSysfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pFwInterface = pMockDiagFwInterface.get();
|
||||
pPublicLinuxDiagnosticsImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp = pMockDiagLinuxSysmanImp.get();
|
||||
VariableBackup<ProcfsAccess *> backup(&pMockDiagLinuxSysmanImp->pProcfsAccess);
|
||||
pMockDiagLinuxSysmanImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp->pDevice = pLinuxSysmanImp->getDeviceHandle();
|
||||
|
||||
|
@ -408,8 +411,9 @@ TEST_F(ZesDiagnosticsFixture, GivenValidDiagnosticsHandleWhenWarmResetSucceedsAn
|
|||
|
||||
pPublicLinuxDiagnosticsImp->pSysfsAccess = pMockSysfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pFwInterface = pMockDiagFwInterface.get();
|
||||
pPublicLinuxDiagnosticsImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp = pMockDiagLinuxSysmanImp.get();
|
||||
VariableBackup<ProcfsAccess *> backup(&pMockDiagLinuxSysmanImp->pProcfsAccess);
|
||||
pMockDiagLinuxSysmanImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp->pDevice = pLinuxSysmanImp->getDeviceHandle();
|
||||
|
||||
|
@ -436,8 +440,9 @@ TEST_F(ZesDiagnosticsFixture, GivenValidDiagnosticsHandleWhenColdResetSucceedsAn
|
|||
|
||||
pPublicLinuxDiagnosticsImp->pSysfsAccess = pMockSysfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pFwInterface = pMockDiagFwInterface.get();
|
||||
pPublicLinuxDiagnosticsImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp = pMockDiagLinuxSysmanImp.get();
|
||||
VariableBackup<ProcfsAccess *> backup(&pMockDiagLinuxSysmanImp->pProcfsAccess);
|
||||
pMockDiagLinuxSysmanImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp->pDevice = pLinuxSysmanImp->getDeviceHandle();
|
||||
|
||||
|
@ -465,7 +470,8 @@ TEST_F(ZesDiagnosticsFixture, GivenValidDiagnosticsHandleWhenGPUProcessCleanupSu
|
|||
|
||||
pPublicLinuxDiagnosticsImp->pSysfsAccess = pMockSysfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pFwInterface = pMockDiagFwInterface.get();
|
||||
pPublicLinuxDiagnosticsImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
VariableBackup<ProcfsAccess *> backup(&pMockDiagLinuxSysmanImp->pProcfsAccess);
|
||||
pMockDiagLinuxSysmanImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp = pMockDiagLinuxSysmanImp.get();
|
||||
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp->pDevice = pLinuxSysmanImp->getDeviceHandle();
|
||||
|
@ -473,7 +479,7 @@ TEST_F(ZesDiagnosticsFixture, GivenValidDiagnosticsHandleWhenGPUProcessCleanupSu
|
|||
pMockDiagProcfsAccess->ourDevicePid = getpid();
|
||||
pMockDiagLinuxSysmanImp->ourDevicePid = getpid();
|
||||
pMockDiagLinuxSysmanImp->ourDeviceFd = ::open("/dev/null", 0);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, pPublicLinuxDiagnosticsImp->gpuProcessCleanup());
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, pPublicLinuxDiagnosticsImp->pLinuxSysmanImp->gpuProcessCleanup());
|
||||
}
|
||||
|
||||
TEST_F(ZesDiagnosticsFixture, GivenValidDiagnosticsHandleWhenGPUProcessCleanupFailsThenWaitForQuiescentCompletionsFails) {
|
||||
|
@ -483,8 +489,9 @@ TEST_F(ZesDiagnosticsFixture, GivenValidDiagnosticsHandleWhenGPUProcessCleanupFa
|
|||
|
||||
pPublicLinuxDiagnosticsImp->pSysfsAccess = pMockSysfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pFwInterface = pMockDiagFwInterface.get();
|
||||
pPublicLinuxDiagnosticsImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp = pMockDiagLinuxSysmanImp.get();
|
||||
VariableBackup<ProcfsAccess *> backup(&pMockDiagLinuxSysmanImp->pProcfsAccess);
|
||||
pMockDiagLinuxSysmanImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp->pDevice = pLinuxSysmanImp->getDeviceHandle();
|
||||
|
||||
|
@ -500,8 +507,9 @@ TEST_F(ZesDiagnosticsFixture, GivenValidDiagnosticsHandleWhenQuiescentFailsConti
|
|||
|
||||
pPublicLinuxDiagnosticsImp->pSysfsAccess = pMockSysfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pFwInterface = pMockDiagFwInterface.get();
|
||||
pPublicLinuxDiagnosticsImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp = pMockDiagLinuxSysmanImp.get();
|
||||
VariableBackup<ProcfsAccess *> backup(&pMockDiagLinuxSysmanImp->pProcfsAccess);
|
||||
pMockDiagLinuxSysmanImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp->pDevice = pLinuxSysmanImp->getDeviceHandle();
|
||||
|
||||
pMockSysfsAccess->setErrorAfterCount(12, ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE);
|
||||
|
@ -515,8 +523,9 @@ TEST_F(ZesDiagnosticsFixture, GivenValidDiagnosticsHandleWhenInvalidateLmemFails
|
|||
|
||||
pPublicLinuxDiagnosticsImp->pSysfsAccess = pMockSysfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pFwInterface = pMockDiagFwInterface.get();
|
||||
pPublicLinuxDiagnosticsImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp = pMockDiagLinuxSysmanImp.get();
|
||||
VariableBackup<ProcfsAccess *> backup(&pMockDiagLinuxSysmanImp->pProcfsAccess);
|
||||
pMockDiagLinuxSysmanImp->pProcfsAccess = pMockDiagProcfsAccess.get();
|
||||
|
||||
pPublicLinuxDiagnosticsImp->pLinuxSysmanImp->pDevice = pLinuxSysmanImp->getDeviceHandle();
|
||||
|
||||
|
|
Loading…
Reference in New Issue