ULT fix for pmt handle

Fixed failing ULTs  for the  pmt object created in map were not deleted

Related-To: LOCI-2835

Signed-off-by: Ayush Pandey <ayush.pandey@intel.com>
This commit is contained in:
Ayush Pandey
2022-01-12 23:45:17 +00:00
committed by Compute-Runtime-Automation
parent fbbcc27742
commit 5f8913f291
2 changed files with 12 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -60,6 +60,7 @@ class ZesPmtFixtureMultiDevice : public SysmanMultiDeviceFixture {
SysmanMultiDeviceFixture::TearDown();
for (auto &subDeviceIdToPmtEntry : mapOfSubDeviceIdToPmtObject) {
delete subDeviceIdToPmtEntry.second;
subDeviceIdToPmtEntry.second = nullptr;
}
}
};
@@ -270,6 +271,7 @@ TEST_F(ZesPmtFixtureMultiDevice, GivenBaseOffsetReadFailWhenDoingPMTInitThenPMTm
TEST_F(ZesPmtFixtureMultiDevice, GivenNoPMTHandleInmapOfSubDeviceIdToPmtObjectWhenCallingreleasePmtObjectThenMapWouldGetEmpty) {
auto mapOriginal = pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject;
pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject.clear();
for (const auto &deviceHandle : deviceHandles) {
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
Device::fromHandle(deviceHandle)->getProperties(&deviceProperties);
@@ -318,6 +320,7 @@ class ZesPmtFixtureNoSubDevice : public SysmanDeviceFixture {
SysmanDeviceFixture::TearDown();
for (auto &subDeviceIdToPmtEntry : mapOfSubDeviceIdToPmtObject) {
delete subDeviceIdToPmtEntry.second;
subDeviceIdToPmtEntry.second = nullptr;
}
}
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -418,6 +418,7 @@ class SysmanDevicePowerMultiDeviceFixture : public SysmanMultiDeviceFixture {
FsAccess *pFsAccessOriginal = nullptr;
OsPower *pOsPowerOriginal = nullptr;
std::vector<ze_device_handle_t> deviceHandles;
std::map<uint32_t, L0::PlatformMonitoringTech *> mapOriginal;
void SetUp() override {
if (!sysmanUltsEnable) {
GTEST_SKIP();
@@ -451,6 +452,8 @@ class SysmanDevicePowerMultiDeviceFixture : public SysmanMultiDeviceFixture {
deviceHandles.resize(subDeviceCount, nullptr);
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, deviceHandles.data());
}
mapOriginal = pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject;
pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject.clear();
for (auto &deviceHandle : deviceHandles) {
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
@@ -468,9 +471,13 @@ class SysmanDevicePowerMultiDeviceFixture : public SysmanMultiDeviceFixture {
if (!sysmanUltsEnable) {
GTEST_SKIP();
}
for (const auto &pmtMapElement : pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject) {
delete pmtMapElement.second;
}
SysmanMultiDeviceFixture::TearDown();
pLinuxSysmanImp->pFsAccess = pFsAccessOriginal;
pLinuxSysmanImp->pSysfsAccess = pSysfsAccessOld;
pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject = mapOriginal;
}
std::vector<zes_pwr_handle_t> getPowerHandles(uint32_t count) {