Skip to content

Commit 6102f02

Browse files
Refactor sysman ULTs
Related-To: LOCI-3432 Signed-off-by: Bellekallu Rajkiran <bellekallu.rajkiran@intel.com>
1 parent bac85dd commit 6102f02

File tree

6 files changed

+26
-16
lines changed

6 files changed

+26
-16
lines changed

level_zero/tools/test/unit_tests/sources/sysman/memory/linux/test_sysman_memory.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ class SysmanDeviceMemoryFixture : public SysmanDeviceFixture {
9292
MemoryManager *pMemoryManagerOld;
9393
};
9494

95-
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
95+
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidCountIsReturned) {
9696
setLocalSupportedAndReinit(false);
9797
uint32_t count = 0;
9898
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
9999
EXPECT_EQ(count, 0u);
100100
}
101101

102-
TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
102+
TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidCountIsReturned) {
103103
setLocalSupportedAndReinit(false);
104104
uint32_t count = 0;
105105
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
@@ -110,14 +110,14 @@ TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemor
110110
EXPECT_EQ(count, 0u);
111111
}
112112

113-
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenValidCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
113+
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenValidCountIsReturned) {
114114
setLocalSupportedAndReinit(true);
115115
uint32_t count = 0;
116116
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
117117
EXPECT_EQ(count, memoryHandleComponentCount);
118118
}
119119

120-
TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenValidCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
120+
TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenValidCountIsReturned) {
121121
setLocalSupportedAndReinit(true);
122122
uint32_t count = 0;
123123
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
@@ -128,7 +128,7 @@ TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemor
128128
EXPECT_EQ(count, memoryHandleComponentCount);
129129
}
130130

131-
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesThenValidPowerHandlesIsReturned) {
131+
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesThenValidHandlesIsReturned) {
132132
setLocalSupportedAndReinit(true);
133133
uint32_t count = 0;
134134
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);

level_zero/tools/test/unit_tests/sources/sysman/memory/linux/test_sysman_memory_dg1.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ class SysmanDeviceMemoryFixture : public SysmanDeviceFixture {
109109
MemoryManager *pMemoryManagerOld;
110110
};
111111

112-
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
112+
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidCountIsReturned) {
113113
setLocalSupportedAndReinit(true);
114114

115115
uint32_t count = 0;
116116
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
117117
EXPECT_EQ(count, memoryHandleComponentCount);
118118
}
119119

120-
TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
120+
TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidCountIsReturned) {
121121
setLocalSupportedAndReinit(true);
122122

123123
uint32_t count = 0;
@@ -129,7 +129,7 @@ TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemor
129129
EXPECT_EQ(count, memoryHandleComponentCount);
130130
}
131131

132-
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidPowerHandlesIsReturned) {
132+
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidHandlesIsReturned) {
133133
setLocalSupportedAndReinit(true);
134134

135135
uint32_t count = 0;
@@ -143,15 +143,15 @@ TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryMo
143143
}
144144
}
145145

146-
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenZeroCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
146+
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenZeroCountIsReturned) {
147147
setLocalSupportedAndReinit(false);
148148

149149
uint32_t count = 0;
150150
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
151151
EXPECT_EQ(count, 0u);
152152
}
153153

154-
TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenZeroCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
154+
TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenZeroCountIsReturned) {
155155
setLocalSupportedAndReinit(false);
156156

157157
uint32_t count = 0;
@@ -163,7 +163,7 @@ TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemor
163163
EXPECT_EQ(count, 0u);
164164
}
165165

166-
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenValidPowerHandlesIsReturned) {
166+
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenValidHandlesIsReturned) {
167167
setLocalSupportedAndReinit(false);
168168

169169
uint32_t count = 0;

level_zero/tools/test/unit_tests/sources/sysman/power/linux/mock_sysfs_power.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ class SysmanDevicePowerFixture : public SysmanDeviceFixture {
344344
SysfsAccess *pSysfsAccessOld = nullptr;
345345
FsAccess *pFsAccessOriginal = nullptr;
346346
OsPower *pOsPowerOriginal = nullptr;
347+
std::map<uint32_t, L0::PlatformMonitoringTech *> pmtMapOriginal;
347348
std::vector<ze_device_handle_t> deviceHandles;
348349
void SetUp() override {
349350
if (!sysmanUltsEnable) {
@@ -379,6 +380,8 @@ class SysmanDevicePowerFixture : public SysmanDeviceFixture {
379380
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, deviceHandles.data());
380381
}
381382

383+
pmtMapOriginal = pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject;
384+
pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject.clear();
382385
for (auto &deviceHandle : deviceHandles) {
383386
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
384387
Device::fromHandle(deviceHandle)->getProperties(&deviceProperties);
@@ -395,6 +398,8 @@ class SysmanDevicePowerFixture : public SysmanDeviceFixture {
395398
if (!sysmanUltsEnable) {
396399
GTEST_SKIP();
397400
}
401+
pLinuxSysmanImp->releasePmtObject();
402+
pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject = pmtMapOriginal;
398403
pLinuxSysmanImp->pFsAccess = pFsAccessOriginal;
399404
pLinuxSysmanImp->pSysfsAccess = pSysfsAccessOld;
400405
SysmanDeviceFixture::TearDown();

level_zero/tools/test/unit_tests/sources/sysman/power/linux/mock_sysfs_power_prelim.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ class SysmanDevicePowerFixture : public SysmanDeviceFixture {
304304
FsAccess *pFsAccessOriginal = nullptr;
305305
OsPower *pOsPowerOriginal = nullptr;
306306
std::vector<ze_device_handle_t> deviceHandles;
307+
std::map<uint32_t, L0::PlatformMonitoringTech *> pmtMapOriginal;
307308
void SetUp() override {
308309
if (!sysmanUltsEnable) {
309310
GTEST_SKIP();
@@ -323,6 +324,8 @@ class SysmanDevicePowerFixture : public SysmanDeviceFixture {
323324
deviceHandles.resize(subDeviceCount, nullptr);
324325
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, deviceHandles.data());
325326
}
327+
pmtMapOriginal = pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject;
328+
pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject.clear();
326329
for (auto &deviceHandle : deviceHandles) {
327330
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
328331
Device::fromHandle(deviceHandle)->getProperties(&deviceProperties);
@@ -338,6 +341,8 @@ class SysmanDevicePowerFixture : public SysmanDeviceFixture {
338341
if (!sysmanUltsEnable) {
339342
GTEST_SKIP();
340343
}
344+
pLinuxSysmanImp->releasePmtObject();
345+
pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject = pmtMapOriginal;
341346
pLinuxSysmanImp->pFsAccess = pFsAccessOriginal;
342347
pLinuxSysmanImp->pSysfsAccess = pSysfsAccessOld;
343348
SysmanDeviceFixture::TearDown();

level_zero/tools/test/unit_tests/sources/sysman/power/linux/test_zes_power_prelim.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ TEST_F(SysmanDevicePowerFixture, GivenComponentCountZeroWhenEnumeratingPowerDoma
4343
EXPECT_EQ(zesDeviceEnumPowerDomains(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
4444
EXPECT_EQ(count, powerHandleComponentCount);
4545
}
46-
TEST_F(SysmanDeviceFixture, GivenComponentCountZeroWhenEnumeratingPowerDomainsWhenhwmonInterfaceDoesNotExistThenZeroCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
47-
uint32_t count = 0;
48-
EXPECT_EQ(zesDeviceEnumPowerDomains(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
49-
EXPECT_EQ(count, 0u);
50-
}
5146

5247
TEST_F(SysmanDevicePowerFixture, GivenInvalidComponentCountWhenEnumeratingPowerDomainsWhenhwmonInterfaceExistsThenValidCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
5348
uint32_t count = 0;

level_zero/tools/test/unit_tests/sources/sysman/temperature/linux/test_zes_temperature.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ class SysmanDeviceTemperatureFixture : public SysmanDeviceFixture {
265265
FsAccess *pFsAccessOriginal = nullptr;
266266
std::vector<ze_device_handle_t> deviceHandles;
267267
PRODUCT_FAMILY productFamily;
268+
std::map<uint32_t, L0::PlatformMonitoringTech *> pmtMapOriginal;
268269
void SetUp() override {
269270
if (!sysmanUltsEnable) {
270271
GTEST_SKIP();
@@ -283,6 +284,8 @@ class SysmanDeviceTemperatureFixture : public SysmanDeviceFixture {
283284
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, deviceHandles.data());
284285
}
285286

287+
pmtMapOriginal = pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject;
288+
pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject.clear();
286289
for (auto &deviceHandle : deviceHandles) {
287290
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
288291
Device::fromHandle(deviceHandle)->getProperties(&deviceProperties);
@@ -302,6 +305,8 @@ class SysmanDeviceTemperatureFixture : public SysmanDeviceFixture {
302305
if (!sysmanUltsEnable) {
303306
GTEST_SKIP();
304307
}
308+
pLinuxSysmanImp->releasePmtObject();
309+
pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject = pmtMapOriginal;
305310
pLinuxSysmanImp->pFsAccess = pFsAccessOriginal;
306311
SysmanDeviceFixture::TearDown();
307312
}

0 commit comments

Comments
 (0)