mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-18 22:08:53 +08:00
Refactor sysman ULTs
Related-To: LOCI-3432 Signed-off-by: Bellekallu Rajkiran <bellekallu.rajkiran@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
bac85ddb25
commit
6102f02080
@@ -92,14 +92,14 @@ class SysmanDeviceMemoryFixture : public SysmanDeviceFixture {
|
||||
MemoryManager *pMemoryManagerOld;
|
||||
};
|
||||
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidCountIsReturned) {
|
||||
setLocalSupportedAndReinit(false);
|
||||
uint32_t count = 0;
|
||||
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(count, 0u);
|
||||
}
|
||||
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidCountIsReturned) {
|
||||
setLocalSupportedAndReinit(false);
|
||||
uint32_t count = 0;
|
||||
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
|
||||
@@ -110,14 +110,14 @@ TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemor
|
||||
EXPECT_EQ(count, 0u);
|
||||
}
|
||||
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenValidCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenValidCountIsReturned) {
|
||||
setLocalSupportedAndReinit(true);
|
||||
uint32_t count = 0;
|
||||
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(count, memoryHandleComponentCount);
|
||||
}
|
||||
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenValidCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenValidCountIsReturned) {
|
||||
setLocalSupportedAndReinit(true);
|
||||
uint32_t count = 0;
|
||||
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
|
||||
@@ -128,7 +128,7 @@ TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemor
|
||||
EXPECT_EQ(count, memoryHandleComponentCount);
|
||||
}
|
||||
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesThenValidPowerHandlesIsReturned) {
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesThenValidHandlesIsReturned) {
|
||||
setLocalSupportedAndReinit(true);
|
||||
uint32_t count = 0;
|
||||
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
|
||||
|
||||
@@ -109,7 +109,7 @@ class SysmanDeviceMemoryFixture : public SysmanDeviceFixture {
|
||||
MemoryManager *pMemoryManagerOld;
|
||||
};
|
||||
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidCountIsReturned) {
|
||||
setLocalSupportedAndReinit(true);
|
||||
|
||||
uint32_t count = 0;
|
||||
@@ -117,7 +117,7 @@ TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryMo
|
||||
EXPECT_EQ(count, memoryHandleComponentCount);
|
||||
}
|
||||
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidCountIsReturned) {
|
||||
setLocalSupportedAndReinit(true);
|
||||
|
||||
uint32_t count = 0;
|
||||
@@ -129,7 +129,7 @@ TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemor
|
||||
EXPECT_EQ(count, memoryHandleComponentCount);
|
||||
}
|
||||
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidPowerHandlesIsReturned) {
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidHandlesIsReturned) {
|
||||
setLocalSupportedAndReinit(true);
|
||||
|
||||
uint32_t count = 0;
|
||||
@@ -143,7 +143,7 @@ TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryMo
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenZeroCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenZeroCountIsReturned) {
|
||||
setLocalSupportedAndReinit(false);
|
||||
|
||||
uint32_t count = 0;
|
||||
@@ -151,7 +151,7 @@ TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryMo
|
||||
EXPECT_EQ(count, 0u);
|
||||
}
|
||||
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenZeroCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenZeroCountIsReturned) {
|
||||
setLocalSupportedAndReinit(false);
|
||||
|
||||
uint32_t count = 0;
|
||||
@@ -163,7 +163,7 @@ TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemor
|
||||
EXPECT_EQ(count, 0u);
|
||||
}
|
||||
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenValidPowerHandlesIsReturned) {
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenValidHandlesIsReturned) {
|
||||
setLocalSupportedAndReinit(false);
|
||||
|
||||
uint32_t count = 0;
|
||||
|
||||
@@ -344,6 +344,7 @@ class SysmanDevicePowerFixture : public SysmanDeviceFixture {
|
||||
SysfsAccess *pSysfsAccessOld = nullptr;
|
||||
FsAccess *pFsAccessOriginal = nullptr;
|
||||
OsPower *pOsPowerOriginal = nullptr;
|
||||
std::map<uint32_t, L0::PlatformMonitoringTech *> pmtMapOriginal;
|
||||
std::vector<ze_device_handle_t> deviceHandles;
|
||||
void SetUp() override {
|
||||
if (!sysmanUltsEnable) {
|
||||
@@ -379,6 +380,8 @@ class SysmanDevicePowerFixture : public SysmanDeviceFixture {
|
||||
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, deviceHandles.data());
|
||||
}
|
||||
|
||||
pmtMapOriginal = pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject;
|
||||
pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject.clear();
|
||||
for (auto &deviceHandle : deviceHandles) {
|
||||
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
|
||||
Device::fromHandle(deviceHandle)->getProperties(&deviceProperties);
|
||||
@@ -395,6 +398,8 @@ class SysmanDevicePowerFixture : public SysmanDeviceFixture {
|
||||
if (!sysmanUltsEnable) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
pLinuxSysmanImp->releasePmtObject();
|
||||
pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject = pmtMapOriginal;
|
||||
pLinuxSysmanImp->pFsAccess = pFsAccessOriginal;
|
||||
pLinuxSysmanImp->pSysfsAccess = pSysfsAccessOld;
|
||||
SysmanDeviceFixture::TearDown();
|
||||
|
||||
@@ -304,6 +304,7 @@ class SysmanDevicePowerFixture : public SysmanDeviceFixture {
|
||||
FsAccess *pFsAccessOriginal = nullptr;
|
||||
OsPower *pOsPowerOriginal = nullptr;
|
||||
std::vector<ze_device_handle_t> deviceHandles;
|
||||
std::map<uint32_t, L0::PlatformMonitoringTech *> pmtMapOriginal;
|
||||
void SetUp() override {
|
||||
if (!sysmanUltsEnable) {
|
||||
GTEST_SKIP();
|
||||
@@ -323,6 +324,8 @@ class SysmanDevicePowerFixture : public SysmanDeviceFixture {
|
||||
deviceHandles.resize(subDeviceCount, nullptr);
|
||||
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, deviceHandles.data());
|
||||
}
|
||||
pmtMapOriginal = pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject;
|
||||
pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject.clear();
|
||||
for (auto &deviceHandle : deviceHandles) {
|
||||
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
|
||||
Device::fromHandle(deviceHandle)->getProperties(&deviceProperties);
|
||||
@@ -338,6 +341,8 @@ class SysmanDevicePowerFixture : public SysmanDeviceFixture {
|
||||
if (!sysmanUltsEnable) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
pLinuxSysmanImp->releasePmtObject();
|
||||
pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject = pmtMapOriginal;
|
||||
pLinuxSysmanImp->pFsAccess = pFsAccessOriginal;
|
||||
pLinuxSysmanImp->pSysfsAccess = pSysfsAccessOld;
|
||||
SysmanDeviceFixture::TearDown();
|
||||
|
||||
@@ -43,11 +43,6 @@ TEST_F(SysmanDevicePowerFixture, GivenComponentCountZeroWhenEnumeratingPowerDoma
|
||||
EXPECT_EQ(zesDeviceEnumPowerDomains(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(count, powerHandleComponentCount);
|
||||
}
|
||||
TEST_F(SysmanDeviceFixture, GivenComponentCountZeroWhenEnumeratingPowerDomainsWhenhwmonInterfaceDoesNotExistThenZeroCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
|
||||
uint32_t count = 0;
|
||||
EXPECT_EQ(zesDeviceEnumPowerDomains(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(count, 0u);
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePowerFixture, GivenInvalidComponentCountWhenEnumeratingPowerDomainsWhenhwmonInterfaceExistsThenValidCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
|
||||
uint32_t count = 0;
|
||||
|
||||
@@ -265,6 +265,7 @@ class SysmanDeviceTemperatureFixture : public SysmanDeviceFixture {
|
||||
FsAccess *pFsAccessOriginal = nullptr;
|
||||
std::vector<ze_device_handle_t> deviceHandles;
|
||||
PRODUCT_FAMILY productFamily;
|
||||
std::map<uint32_t, L0::PlatformMonitoringTech *> pmtMapOriginal;
|
||||
void SetUp() override {
|
||||
if (!sysmanUltsEnable) {
|
||||
GTEST_SKIP();
|
||||
@@ -283,6 +284,8 @@ class SysmanDeviceTemperatureFixture : public SysmanDeviceFixture {
|
||||
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, deviceHandles.data());
|
||||
}
|
||||
|
||||
pmtMapOriginal = pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject;
|
||||
pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject.clear();
|
||||
for (auto &deviceHandle : deviceHandles) {
|
||||
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
|
||||
Device::fromHandle(deviceHandle)->getProperties(&deviceProperties);
|
||||
@@ -302,6 +305,8 @@ class SysmanDeviceTemperatureFixture : public SysmanDeviceFixture {
|
||||
if (!sysmanUltsEnable) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
pLinuxSysmanImp->releasePmtObject();
|
||||
pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject = pmtMapOriginal;
|
||||
pLinuxSysmanImp->pFsAccess = pFsAccessOriginal;
|
||||
SysmanDeviceFixture::TearDown();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user