mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-26 23:33:20 +08:00
Removal of MOCK_METHODS from Power API ULT
The gmock macros in the Power (non prelim) API ULTS have been replaced Related-To: LOCI-3221 Signed-off-by: Bari, Pratik <pratik.bari@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
d45d62ef0e
commit
0606e8ddf3
@@ -44,6 +44,7 @@ constexpr uint64_t expectedEnergyCounter = 123456785u;
|
||||
constexpr uint32_t mockDefaultPowerLimitVal = 300000000;
|
||||
constexpr uint32_t mockMaxPowerLimitVal = 490000000;
|
||||
constexpr uint32_t mockMinPowerLimitVal = 10;
|
||||
|
||||
const std::map<std::string, uint64_t> deviceKeyOffsetMapPower = {
|
||||
{"PACKAGE_ENERGY", 0x400},
|
||||
{"COMPUTE_TEMPERATURES", 0x68},
|
||||
@@ -55,8 +56,15 @@ class PowerSysfsAccess : public SysfsAccess {};
|
||||
template <>
|
||||
struct Mock<PowerSysfsAccess> : public PowerSysfsAccess {
|
||||
|
||||
ze_result_t getValStringHelper(const std::string file, std::string &val);
|
||||
ze_result_t getValString(const std::string file, std::string &val) {
|
||||
std::vector<ze_result_t> mockReadReturnStatus{};
|
||||
std::vector<ze_result_t> mockWriteReturnStatus{};
|
||||
std::vector<ze_result_t> mockScanDirEntriesReturnStatus{};
|
||||
std::vector<uint64_t> mockReadUnsignedLongValue{};
|
||||
std::vector<uint32_t> mockReadUnsignedIntValue{};
|
||||
bool isRepeated = false;
|
||||
|
||||
ze_result_t read(const std::string file, std::string &val) override {
|
||||
|
||||
ze_result_t result = ZE_RESULT_ERROR_UNKNOWN;
|
||||
if (file.compare(i915HwmonDir + "/" + "name") == 0) {
|
||||
val = "i915";
|
||||
@@ -173,9 +181,22 @@ struct Mock<PowerSysfsAccess> : public PowerSysfsAccess {
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ze_result_t getValUnsignedLongHelper(const std::string file, uint64_t &val);
|
||||
ze_result_t getValUnsignedLong(const std::string file, uint64_t &val) {
|
||||
ze_result_t read(const std::string file, uint64_t &val) override {
|
||||
ze_result_t result = ZE_RESULT_SUCCESS;
|
||||
if (!mockReadReturnStatus.empty()) {
|
||||
result = mockReadReturnStatus.front();
|
||||
if (!mockReadUnsignedLongValue.empty()) {
|
||||
val = mockReadUnsignedLongValue.front();
|
||||
}
|
||||
if (isRepeated != true) {
|
||||
if (mockReadUnsignedLongValue.size() != 0) {
|
||||
mockReadUnsignedLongValue.erase(mockReadUnsignedLongValue.begin());
|
||||
}
|
||||
mockReadReturnStatus.erase(mockReadReturnStatus.begin());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
if (file.compare(i915HwmonDir + "/" + sustainedPowerLimitEnabled) == 0) {
|
||||
val = sustainedPowerLimitEnabledVal;
|
||||
} else if (file.compare(i915HwmonDir + "/" + sustainedPowerLimit) == 0) {
|
||||
@@ -191,12 +212,25 @@ struct Mock<PowerSysfsAccess> : public PowerSysfsAccess {
|
||||
} else {
|
||||
result = ZE_RESULT_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
ze_result_t getValUnsignedInt(const std::string file, uint32_t &val) {
|
||||
ze_result_t read(const std::string file, uint32_t &val) override {
|
||||
ze_result_t result = ZE_RESULT_SUCCESS;
|
||||
if (!mockReadReturnStatus.empty()) {
|
||||
result = mockReadReturnStatus.front();
|
||||
if (!mockReadUnsignedIntValue.empty()) {
|
||||
val = mockReadUnsignedIntValue.front();
|
||||
}
|
||||
if (isRepeated != true) {
|
||||
if (mockReadUnsignedIntValue.size() != 0) {
|
||||
mockReadUnsignedIntValue.erase(mockReadUnsignedIntValue.begin());
|
||||
}
|
||||
mockReadReturnStatus.erase(mockReadReturnStatus.begin());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
if (file.compare(i915HwmonDir + "/" + defaultPowerLimit) == 0) {
|
||||
val = mockDefaultPowerLimitVal;
|
||||
} else if (file.compare(i915HwmonDir + "/" + maxPowerLimit) == 0) {
|
||||
@@ -209,18 +243,16 @@ struct Mock<PowerSysfsAccess> : public PowerSysfsAccess {
|
||||
return result;
|
||||
}
|
||||
|
||||
ze_result_t getValUnsignedIntMax(const std::string file, uint32_t &val) {
|
||||
ze_result_t write(const std::string file, const int val) override {
|
||||
ze_result_t result = ZE_RESULT_SUCCESS;
|
||||
if (file.compare(i915HwmonDir + "/" + maxPowerLimit) == 0) {
|
||||
val = std::numeric_limits<uint32_t>::max();
|
||||
} else {
|
||||
result = ZE_RESULT_ERROR_NOT_AVAILABLE;
|
||||
if (!mockWriteReturnStatus.empty()) {
|
||||
ze_result_t result = mockWriteReturnStatus.front();
|
||||
if (isRepeated != true) {
|
||||
mockWriteReturnStatus.erase(mockWriteReturnStatus.begin());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ze_result_t setVal(const std::string file, const int val) {
|
||||
ze_result_t result = ZE_RESULT_SUCCESS;
|
||||
if (file.compare(i915HwmonDir + "/" + sustainedPowerLimitEnabled) == 0) {
|
||||
sustainedPowerLimitEnabledVal = static_cast<uint64_t>(val);
|
||||
} else if (file.compare(i915HwmonDir + "/" + sustainedPowerLimit) == 0) {
|
||||
@@ -234,24 +266,27 @@ struct Mock<PowerSysfsAccess> : public PowerSysfsAccess {
|
||||
} else {
|
||||
result = ZE_RESULT_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
ze_result_t getscanDirEntries(const std::string file, std::vector<std::string> &listOfEntries) {
|
||||
|
||||
ze_result_t scanDirEntries(const std::string file, std::vector<std::string> &listOfEntries) override {
|
||||
ze_result_t result = ZE_RESULT_ERROR_NOT_AVAILABLE;
|
||||
if (!mockScanDirEntriesReturnStatus.empty()) {
|
||||
ze_result_t result = mockScanDirEntriesReturnStatus.front();
|
||||
if (isRepeated != true) {
|
||||
mockScanDirEntriesReturnStatus.erase(mockScanDirEntriesReturnStatus.begin());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
if (file.compare(hwmonDir) == 0) {
|
||||
listOfEntries = listOfMockedHwmonDirs;
|
||||
return ZE_RESULT_SUCCESS;
|
||||
result = ZE_RESULT_SUCCESS;
|
||||
}
|
||||
return ZE_RESULT_ERROR_NOT_AVAILABLE;
|
||||
return result;
|
||||
}
|
||||
|
||||
Mock<PowerSysfsAccess>() = default;
|
||||
|
||||
MOCK_METHOD(ze_result_t, read, (const std::string file, uint64_t &val), (override));
|
||||
MOCK_METHOD(ze_result_t, read, (const std::string file, std::string &val), (override));
|
||||
MOCK_METHOD(ze_result_t, read, (const std::string file, uint32_t &val), (override));
|
||||
MOCK_METHOD(ze_result_t, write, (const std::string file, const int val), (override));
|
||||
MOCK_METHOD(ze_result_t, scanDirEntries, (const std::string file, std::vector<std::string> &listOfEntries), (override));
|
||||
};
|
||||
|
||||
class PowerPmt : public PlatformMonitoringTech {
|
||||
@@ -277,7 +312,6 @@ struct Mock<PowerPmt> : public PowerPmt {
|
||||
if (ZE_RESULT_SUCCESS != PlatformMonitoringTech::enumerateRootTelemIndex(pFsAccess, gpuUpstreamPortPath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
telemetryDeviceEntry = "/sys/class/intel_pmt/telem2/telem";
|
||||
}
|
||||
};
|
||||
@@ -286,7 +320,8 @@ class PowerFsAccess : public FsAccess {};
|
||||
|
||||
template <>
|
||||
struct Mock<PowerFsAccess> : public PowerFsAccess {
|
||||
ze_result_t listDirectorySuccess(const std::string directory, std::vector<std::string> &listOfTelemNodes) {
|
||||
|
||||
ze_result_t listDirectory(const std::string directory, std::vector<std::string> &listOfTelemNodes) override {
|
||||
if (directory.compare(baseTelemSysFS) == 0) {
|
||||
listOfTelemNodes.push_back("telem1");
|
||||
listOfTelemNodes.push_back("telem2");
|
||||
@@ -302,7 +337,7 @@ struct Mock<PowerFsAccess> : public PowerFsAccess {
|
||||
return ZE_RESULT_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
ze_result_t getRealPathSuccess(const std::string path, std::string &buf) {
|
||||
ze_result_t getRealPath(const std::string path, std::string &buf) override {
|
||||
if (path.compare("/sys/class/intel_pmt/telem1") == 0) {
|
||||
buf = "/sys/devices/pci0000:89/0000:89:02.0/0000:86:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem1";
|
||||
} else if (path.compare("/sys/class/intel_pmt/telem2") == 0) {
|
||||
@@ -316,7 +351,6 @@ struct Mock<PowerFsAccess> : public PowerFsAccess {
|
||||
} else {
|
||||
return ZE_RESULT_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -324,8 +358,6 @@ struct Mock<PowerFsAccess> : public PowerFsAccess {
|
||||
return ZE_RESULT_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
MOCK_METHOD(ze_result_t, listDirectory, (const std::string path, std::vector<std::string> &list), (override));
|
||||
MOCK_METHOD(ze_result_t, getRealPath, (const std::string path, std::string &buf), (override));
|
||||
Mock<PowerFsAccess>() = default;
|
||||
};
|
||||
|
||||
@@ -357,20 +389,7 @@ class SysmanDevicePowerFixture : public SysmanDeviceFixture {
|
||||
pSysfsAccessOld = pLinuxSysmanImp->pSysfsAccess;
|
||||
pSysfsAccess = std::make_unique<NiceMock<Mock<PowerSysfsAccess>>>();
|
||||
pLinuxSysmanImp->pSysfsAccess = pSysfsAccess.get();
|
||||
ON_CALL(*pFsAccess.get(), listDirectory(_, _))
|
||||
.WillByDefault(::testing::Invoke(pFsAccess.get(), &Mock<PowerFsAccess>::listDirectorySuccess));
|
||||
ON_CALL(*pFsAccess.get(), getRealPath(_, _))
|
||||
.WillByDefault(::testing::Invoke(pFsAccess.get(), &Mock<PowerFsAccess>::getRealPathSuccess));
|
||||
ON_CALL(*pSysfsAccess.get(), read(_, Matcher<std::string &>(_)))
|
||||
.WillByDefault(::testing::Invoke(pSysfsAccess.get(), &Mock<PowerSysfsAccess>::getValString));
|
||||
ON_CALL(*pSysfsAccess.get(), read(_, Matcher<uint64_t &>(_)))
|
||||
.WillByDefault(::testing::Invoke(pSysfsAccess.get(), &Mock<PowerSysfsAccess>::getValUnsignedLong));
|
||||
ON_CALL(*pSysfsAccess.get(), read(_, Matcher<uint32_t &>(_)))
|
||||
.WillByDefault(::testing::Invoke(pSysfsAccess.get(), &Mock<PowerSysfsAccess>::getValUnsignedInt));
|
||||
ON_CALL(*pSysfsAccess.get(), write(_, _))
|
||||
.WillByDefault(::testing::Invoke(pSysfsAccess.get(), &Mock<PowerSysfsAccess>::setVal));
|
||||
ON_CALL(*pSysfsAccess.get(), scanDirEntries(_, _))
|
||||
.WillByDefault(::testing::Invoke(pSysfsAccess.get(), &Mock<PowerSysfsAccess>::getscanDirEntries));
|
||||
|
||||
uint32_t subDeviceCount = 0;
|
||||
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, nullptr);
|
||||
if (subDeviceCount == 0) {
|
||||
@@ -434,20 +453,7 @@ class SysmanDevicePowerMultiDeviceFixture : public SysmanMultiDeviceFixture {
|
||||
pSysfsAccessOld = pLinuxSysmanImp->pSysfsAccess;
|
||||
pSysfsAccess = std::make_unique<NiceMock<Mock<PowerSysfsAccess>>>();
|
||||
pLinuxSysmanImp->pSysfsAccess = pSysfsAccess.get();
|
||||
ON_CALL(*pFsAccess.get(), listDirectory(_, _))
|
||||
.WillByDefault(::testing::Invoke(pFsAccess.get(), &Mock<PowerFsAccess>::listDirectorySuccess));
|
||||
ON_CALL(*pFsAccess.get(), getRealPath(_, _))
|
||||
.WillByDefault(::testing::Invoke(pFsAccess.get(), &Mock<PowerFsAccess>::getRealPathSuccess));
|
||||
ON_CALL(*pSysfsAccess.get(), read(_, Matcher<std::string &>(_)))
|
||||
.WillByDefault(::testing::Invoke(pSysfsAccess.get(), &Mock<PowerSysfsAccess>::getValString));
|
||||
ON_CALL(*pSysfsAccess.get(), read(_, Matcher<uint64_t &>(_)))
|
||||
.WillByDefault(::testing::Invoke(pSysfsAccess.get(), &Mock<PowerSysfsAccess>::getValUnsignedLong));
|
||||
ON_CALL(*pSysfsAccess.get(), read(_, Matcher<uint32_t &>(_)))
|
||||
.WillByDefault(::testing::Invoke(pSysfsAccess.get(), &Mock<PowerSysfsAccess>::getValUnsignedInt));
|
||||
ON_CALL(*pSysfsAccess.get(), write(_, _))
|
||||
.WillByDefault(::testing::Invoke(pSysfsAccess.get(), &Mock<PowerSysfsAccess>::setVal));
|
||||
ON_CALL(*pSysfsAccess.get(), scanDirEntries(_, _))
|
||||
.WillByDefault(::testing::Invoke(pSysfsAccess.get(), &Mock<PowerSysfsAccess>::getscanDirEntries));
|
||||
|
||||
uint32_t subDeviceCount = 0;
|
||||
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, nullptr);
|
||||
if (subDeviceCount == 0) {
|
||||
@@ -490,4 +496,4 @@ class SysmanDevicePowerMultiDeviceFixture : public SysmanMultiDeviceFixture {
|
||||
};
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
} // namespace L0
|
||||
@@ -66,7 +66,7 @@ TEST_F(SysmanDevicePowerFixture, GivenComponentCountZeroWhenEnumeratingPowerDoma
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePowerFixture, GivenValidPowerPointerWhenGettingCardPowerDomainWhenhwmonInterfaceExistsAndThenCallSucceds) {
|
||||
TEST_F(SysmanDevicePowerFixture, GivenValidPowerPointerWhenGettingCardPowerDomainWhenhwmonInterfaceExistsAndThenCallSucceeds) {
|
||||
zes_pwr_handle_t phPower = {};
|
||||
EXPECT_EQ(zesDeviceGetCardPowerDomain(device->toHandle(), &phPower), ZE_RESULT_SUCCESS);
|
||||
}
|
||||
@@ -75,7 +75,7 @@ TEST_F(SysmanDevicePowerFixture, GivenInvalidPowerPointerWhenGettingCardPowerDom
|
||||
EXPECT_EQ(zesDeviceGetCardPowerDomain(device->toHandle(), nullptr), ZE_RESULT_ERROR_INVALID_NULL_POINTER);
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePowerFixture, GivenUninitializedPowerHandlesAndWhenGettingCardPowerDomainThenReurnsFailure) {
|
||||
TEST_F(SysmanDevicePowerFixture, GivenUninitializedPowerHandlesAndWhenGettingCardPowerDomainThenReturnsFailure) {
|
||||
for (const auto &handle : pSysmanDeviceImp->pPowerHandleContext->handleList) {
|
||||
delete handle;
|
||||
}
|
||||
@@ -95,16 +95,17 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerProperties
|
||||
EXPECT_EQ(properties.subdeviceId, 0u);
|
||||
EXPECT_EQ(properties.canControl, true);
|
||||
EXPECT_EQ(properties.isEnergyThresholdSupported, false);
|
||||
EXPECT_EQ(properties.defaultLimit, (int32_t)(mockDefaultPowerLimitVal / milliFactor));
|
||||
EXPECT_EQ(properties.maxLimit, (int32_t)(mockMaxPowerLimitVal / milliFactor));
|
||||
EXPECT_EQ(properties.minLimit, (int32_t)(mockMinPowerLimitVal / milliFactor));
|
||||
EXPECT_EQ(properties.defaultLimit, static_cast<int32_t>(mockDefaultPowerLimitVal / milliFactor));
|
||||
EXPECT_EQ(properties.maxLimit, static_cast<int32_t>(mockMaxPowerLimitVal / milliFactor));
|
||||
EXPECT_EQ(properties.minLimit, static_cast<int32_t>(mockMinPowerLimitVal / milliFactor));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerPropertiesWhenHwmonInterfaceExistThenLimitsReturnsUnkown) {
|
||||
TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerPropertiesWhenHwmonInterfaceExistThenLimitsReturnsUnknown) {
|
||||
|
||||
pSysfsAccess->mockReadReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
pSysfsAccess->isRepeated = true;
|
||||
|
||||
EXPECT_CALL(*pSysfsAccess.get(), read(_, Matcher<uint32_t &>(_)))
|
||||
.WillRepeatedly(Return(ZE_RESULT_ERROR_NOT_AVAILABLE));
|
||||
for (const auto &handle : pSysmanDeviceImp->pPowerHandleContext->handleList) {
|
||||
delete handle;
|
||||
}
|
||||
@@ -124,11 +125,15 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerProperties
|
||||
|
||||
TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerPropertiesWhenHwmonInterfaceExistThenMaxLimitIsUnsupported) {
|
||||
|
||||
EXPECT_CALL(*pSysfsAccess.get(), read(_, Matcher<uint32_t &>(_)))
|
||||
.WillOnce(Return(ZE_RESULT_ERROR_NOT_AVAILABLE))
|
||||
.WillOnce(Return(ZE_RESULT_ERROR_NOT_AVAILABLE))
|
||||
.WillOnce(::testing::Invoke(pSysfsAccess.get(), &Mock<PowerSysfsAccess>::getValUnsignedIntMax))
|
||||
.WillRepeatedly(DoDefault());
|
||||
pSysfsAccess->mockReadReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
pSysfsAccess->mockReadUnsignedIntValue.push_back(std::numeric_limits<uint32_t>::max());
|
||||
|
||||
pSysfsAccess->mockReadReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
pSysfsAccess->mockReadUnsignedIntValue.push_back(std::numeric_limits<uint32_t>::max());
|
||||
|
||||
pSysfsAccess->mockReadReturnStatus.push_back(ZE_RESULT_SUCCESS);
|
||||
pSysfsAccess->mockReadUnsignedIntValue.push_back(std::numeric_limits<uint32_t>::max());
|
||||
|
||||
for (const auto &handle : pSysmanDeviceImp->pPowerHandleContext->handleList) {
|
||||
delete handle;
|
||||
}
|
||||
@@ -148,13 +153,16 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerProperties
|
||||
|
||||
TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerPropertiesThenHwmonInterfaceExistAndMinLimitIsUnknown) {
|
||||
|
||||
EXPECT_CALL(*pSysfsAccess.get(), read(_, Matcher<uint32_t &>(_)))
|
||||
.WillOnce(Return(ZE_RESULT_ERROR_NOT_AVAILABLE))
|
||||
.WillOnce(::testing::DoAll(::testing::SetArgReferee<1>(0), Return(ZE_RESULT_SUCCESS)))
|
||||
.WillRepeatedly(DoDefault());
|
||||
pSysfsAccess->mockReadReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
pSysfsAccess->mockReadUnsignedIntValue.push_back(0);
|
||||
|
||||
pSysfsAccess->mockReadReturnStatus.push_back(ZE_RESULT_SUCCESS);
|
||||
pSysfsAccess->mockReadUnsignedIntValue.push_back(0);
|
||||
|
||||
for (const auto &handle : pSysmanDeviceImp->pPowerHandleContext->handleList) {
|
||||
delete handle;
|
||||
}
|
||||
|
||||
pSysmanDeviceImp->pPowerHandleContext->handleList.clear();
|
||||
pSysmanDeviceImp->pPowerHandleContext->init(deviceHandles, device->toHandle());
|
||||
auto handles = getPowerHandles(powerHandleComponentCount);
|
||||
@@ -181,8 +189,9 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerEnergyCoun
|
||||
pPmt->preadFunction = preadMockPower;
|
||||
}
|
||||
|
||||
EXPECT_CALL(*pSysfsAccess.get(), read(_, Matcher<uint64_t &>(_)))
|
||||
.WillRepeatedly(Return(ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS));
|
||||
pSysfsAccess->mockReadReturnStatus.push_back(ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS);
|
||||
pSysfsAccess->isRepeated = true;
|
||||
|
||||
for (auto handle : handles) {
|
||||
zes_power_energy_counter_t energyCounter = {};
|
||||
uint64_t expectedEnergyCounter = convertJouleToMicroJoule * (setEnergyCounter / 1048576);
|
||||
@@ -231,9 +240,8 @@ TEST_F(SysmanDevicePowerFixture, GivenSetPowerLimitsWhenGettingPowerLimitsWhenHw
|
||||
TEST_F(SysmanDevicePowerFixture, GivenGetPowerLimitsReturnErrorWhenGettingPowerLimitsWhenHwmonInterfaceExistForBurstPowerLimitThenProperErrorCodesReturned) {
|
||||
auto handles = getPowerHandles(powerHandleComponentCount);
|
||||
|
||||
EXPECT_CALL(*pSysfsAccess.get(), read(_, Matcher<uint64_t &>(_)))
|
||||
.WillOnce(::testing::Invoke(pSysfsAccess.get(), &Mock<PowerSysfsAccess>::getValUnsignedLongReturnErrorForBurstPowerLimit))
|
||||
.WillOnce(Return(ZE_RESULT_ERROR_NOT_AVAILABLE));
|
||||
pSysfsAccess->mockReadReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
|
||||
for (auto handle : handles) {
|
||||
zes_power_burst_limit_t burstSet = {};
|
||||
zes_power_burst_limit_t burstGet = {};
|
||||
@@ -247,8 +255,8 @@ TEST_F(SysmanDevicePowerFixture, GivenGetPowerLimitsReturnErrorWhenGettingPowerL
|
||||
TEST_F(SysmanDevicePowerFixture, GivenGetPowerLimitsReturnErrorWhenGettingPowerLimitsWhenHwmonInterfaceExistForBurstPowerLimitThenProperErrorCodesIsReturned) {
|
||||
auto handles = getPowerHandles(powerHandleComponentCount);
|
||||
|
||||
EXPECT_CALL(*pSysfsAccess.get(), read(_, Matcher<uint64_t &>(_)))
|
||||
.WillRepeatedly(Return(ZE_RESULT_ERROR_UNKNOWN));
|
||||
pSysfsAccess->mockReadReturnStatus.push_back(ZE_RESULT_ERROR_UNKNOWN);
|
||||
pSysfsAccess->isRepeated = true;
|
||||
|
||||
for (auto handle : handles) {
|
||||
zes_power_burst_limit_t burstSet = {};
|
||||
@@ -263,8 +271,7 @@ TEST_F(SysmanDevicePowerFixture, GivenGetPowerLimitsReturnErrorWhenGettingPowerL
|
||||
TEST_F(SysmanDevicePowerFixture, GivenSetPowerLimitsReturnErrorWhenSettingPowerLimitsWhenHwmonInterfaceExistForBurstPowerLimitThenProperErrorCodesReturned) {
|
||||
auto handles = getPowerHandles(powerHandleComponentCount);
|
||||
|
||||
ON_CALL(*pSysfsAccess.get(), write(_, _))
|
||||
.WillByDefault(::testing::Invoke(pSysfsAccess.get(), &Mock<PowerSysfsAccess>::setValUnsignedLongReturnErrorForBurstPowerLimit));
|
||||
pSysfsAccess->mockWriteReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
|
||||
for (auto handle : handles) {
|
||||
zes_power_burst_limit_t burstSet = {};
|
||||
@@ -276,10 +283,8 @@ TEST_F(SysmanDevicePowerFixture, GivenSetPowerLimitsReturnErrorWhenSettingPowerL
|
||||
TEST_F(SysmanDevicePowerFixture, GivenSetPowerLimitsReturnErrorWhenSettingPowerLimitsWhenHwmonInterfaceExistForBurstPowerLimitEnabledThenProperErrorCodesReturned) {
|
||||
auto handles = getPowerHandles(powerHandleComponentCount);
|
||||
|
||||
ON_CALL(*pSysfsAccess.get(), write(_, _))
|
||||
.WillByDefault(::testing::Invoke(pSysfsAccess.get(), &Mock<PowerSysfsAccess>::setValUnsignedLongReturnErrorForBurstPowerLimitEnabled));
|
||||
ON_CALL(*pSysfsAccess.get(), read(_, Matcher<uint64_t &>(_)))
|
||||
.WillByDefault(::testing::Invoke(pSysfsAccess.get(), &Mock<PowerSysfsAccess>::getValUnsignedLongReturnErrorForBurstPowerLimitEnabled));
|
||||
pSysfsAccess->mockWriteReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
pSysfsAccess->mockReadReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
|
||||
for (auto handle : handles) {
|
||||
zes_power_burst_limit_t burstSet = {};
|
||||
@@ -293,8 +298,8 @@ TEST_F(SysmanDevicePowerFixture, GivenSetPowerLimitsReturnErrorWhenSettingPowerL
|
||||
TEST_F(SysmanDevicePowerFixture, GivenReadingSustainedPowerLimitNodeReturnErrorWhenSetOrGetPowerLimitsWhenHwmonInterfaceExistForSustainedPowerLimitEnabledThenProperErrorCodesReturned) {
|
||||
auto handles = getPowerHandles(powerHandleComponentCount);
|
||||
|
||||
ON_CALL(*pSysfsAccess.get(), read(_, Matcher<uint64_t &>(_)))
|
||||
.WillByDefault(::testing::Invoke(pSysfsAccess.get(), &Mock<PowerSysfsAccess>::getValUnsignedLongReturnErrorForSustainedPowerLimitEnabled));
|
||||
pSysfsAccess->mockReadReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
pSysfsAccess->isRepeated = true;
|
||||
|
||||
for (auto handle : handles) {
|
||||
zes_power_sustained_limit_t sustainedSet = {};
|
||||
@@ -308,8 +313,7 @@ TEST_F(SysmanDevicePowerFixture, GivenReadingSustainedPowerLimitNodeReturnErrorW
|
||||
TEST_F(SysmanDevicePowerFixture, GivenReadingSustainedPowerNodeReturnErrorWhenGetPowerLimitsForSustainedPowerWhenHwmonInterfaceExistThenProperErrorCodesReturned) {
|
||||
auto handles = getPowerHandles(powerHandleComponentCount);
|
||||
|
||||
ON_CALL(*pSysfsAccess.get(), read(_, Matcher<uint64_t &>(_)))
|
||||
.WillByDefault(::testing::Invoke(pSysfsAccess.get(), &Mock<PowerSysfsAccess>::getValUnsignedLongReturnErrorForSustainedPower));
|
||||
pSysfsAccess->mockReadReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
|
||||
for (auto handle : handles) {
|
||||
zes_power_sustained_limit_t sustainedGet = {};
|
||||
@@ -320,8 +324,7 @@ TEST_F(SysmanDevicePowerFixture, GivenReadingSustainedPowerNodeReturnErrorWhenGe
|
||||
TEST_F(SysmanDevicePowerFixture, GivenReadingSustainedPowerIntervalNodeReturnErrorWhenGetPowerLimitsForSustainedPowerWhenHwmonInterfaceExistThenProperErrorCodesReturned) {
|
||||
auto handles = getPowerHandles(powerHandleComponentCount);
|
||||
|
||||
ON_CALL(*pSysfsAccess.get(), read(_, Matcher<uint64_t &>(_)))
|
||||
.WillByDefault(::testing::Invoke(pSysfsAccess.get(), &Mock<PowerSysfsAccess>::getValUnsignedLongReturnErrorForSustainedPowerInterval));
|
||||
pSysfsAccess->mockReadReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
|
||||
for (auto handle : handles) {
|
||||
zes_power_sustained_limit_t sustainedGet = {};
|
||||
@@ -332,8 +335,7 @@ TEST_F(SysmanDevicePowerFixture, GivenReadingSustainedPowerIntervalNodeReturnErr
|
||||
TEST_F(SysmanDevicePowerFixture, GivenwritingSustainedPowerNodeReturnErrorWhenSetPowerLimitsForSustainedPowerWhenHwmonInterfaceExistThenProperErrorCodesReturned) {
|
||||
auto handles = getPowerHandles(powerHandleComponentCount);
|
||||
|
||||
ON_CALL(*pSysfsAccess.get(), write(_, _))
|
||||
.WillByDefault(::testing::Invoke(pSysfsAccess.get(), &Mock<PowerSysfsAccess>::setValReturnErrorForSustainedPower));
|
||||
pSysfsAccess->mockWriteReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
|
||||
zes_power_sustained_limit_t sustainedSet = {};
|
||||
sustainedSet.enabled = 1;
|
||||
@@ -345,8 +347,7 @@ TEST_F(SysmanDevicePowerFixture, GivenwritingSustainedPowerNodeReturnErrorWhenSe
|
||||
TEST_F(SysmanDevicePowerFixture, GivenwritingSustainedPowerIntervalNodeReturnErrorWhenSetPowerLimitsForSustainedPowerIntervalWhenHwmonInterfaceExistThenProperErrorCodesReturned) {
|
||||
auto handles = getPowerHandles(powerHandleComponentCount);
|
||||
|
||||
ON_CALL(*pSysfsAccess.get(), write(_, _))
|
||||
.WillByDefault(::testing::Invoke(pSysfsAccess.get(), &Mock<PowerSysfsAccess>::setValReturnErrorForSustainedPowerInterval));
|
||||
pSysfsAccess->mockWriteReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
|
||||
zes_power_sustained_limit_t sustainedSet = {};
|
||||
sustainedSet.enabled = 1;
|
||||
@@ -358,8 +359,7 @@ TEST_F(SysmanDevicePowerFixture, GivenwritingSustainedPowerIntervalNodeReturnErr
|
||||
TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenWritingToSustainedPowerEnableNodeWithoutPermissionsThenValidErrorIsReturned) {
|
||||
auto handles = getPowerHandles(powerHandleComponentCount);
|
||||
|
||||
ON_CALL(*pSysfsAccess.get(), write(_, _))
|
||||
.WillByDefault(::testing::Invoke(pSysfsAccess.get(), &Mock<PowerSysfsAccess>::setValUnsignedLongReturnInsufficientForSustainedPowerLimitEnabled));
|
||||
pSysfsAccess->mockWriteReturnStatus.push_back(ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS);
|
||||
|
||||
zes_power_sustained_limit_t sustainedSet = {};
|
||||
sustainedSet.enabled = 0;
|
||||
@@ -385,8 +385,8 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleAndPermissionsThenFirstDis
|
||||
TEST_F(SysmanDevicePowerFixture, GivenGetPowerLimitsWhenPowerLimitsAreDisabledWhenHwmonInterfaceExistThenAllPowerValuesAreIgnored) {
|
||||
auto handles = getPowerHandles(powerHandleComponentCount);
|
||||
|
||||
ON_CALL(*pSysfsAccess.get(), read(_, Matcher<uint64_t &>(_)))
|
||||
.WillByDefault(::testing::Invoke(pSysfsAccess.get(), &Mock<PowerSysfsAccess>::getValUnsignedLongReturnsPowerLimitEnabledAsDisabled));
|
||||
pSysfsAccess->mockReadReturnStatus.push_back(ZE_RESULT_SUCCESS);
|
||||
pSysfsAccess->mockReadUnsignedLongValue.push_back(0);
|
||||
|
||||
zes_power_sustained_limit_t sustainedGet = {};
|
||||
zes_power_burst_limit_t burstGet = {};
|
||||
@@ -403,9 +403,11 @@ TEST_F(SysmanDevicePowerFixture, GivenGetPowerLimitsWhenPowerLimitsAreDisabledWh
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zesPowerSetLimits(handles[0], nullptr, &burstSet, nullptr));
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePowerFixture, GivenScanDiectoriesFailAndPmtIsNotNullPointerThenPowerModuleIsSupported) {
|
||||
EXPECT_CALL(*pSysfsAccess.get(), scanDirEntries(_, _))
|
||||
.WillRepeatedly(Return(ZE_RESULT_ERROR_NOT_AVAILABLE));
|
||||
TEST_F(SysmanDevicePowerFixture, GivenScanDirectoriesFailAndPmtIsNotNullPointerThenPowerModuleIsSupported) {
|
||||
|
||||
pSysfsAccess->mockScanDirEntriesReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
pSysfsAccess->isRepeated = true;
|
||||
|
||||
pSysmanDeviceImp->pPowerHandleContext->init(deviceHandles, device->toHandle());
|
||||
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
|
||||
Device::fromHandle(device)->getProperties(&deviceProperties);
|
||||
@@ -415,8 +417,10 @@ TEST_F(SysmanDevicePowerFixture, GivenScanDiectoriesFailAndPmtIsNotNullPointerTh
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePowerFixture, GivenComponentCountZeroWhenEnumeratingPowerDomainsThenValidCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
|
||||
EXPECT_CALL(*pSysfsAccess.get(), scanDirEntries(_, _))
|
||||
.WillRepeatedly(Return(ZE_RESULT_ERROR_NOT_AVAILABLE));
|
||||
|
||||
pSysfsAccess->mockScanDirEntriesReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
pSysfsAccess->isRepeated = true;
|
||||
|
||||
for (const auto &handle : pSysmanDeviceImp->pPowerHandleContext->handleList) {
|
||||
delete handle;
|
||||
}
|
||||
@@ -428,8 +432,10 @@ TEST_F(SysmanDevicePowerFixture, GivenComponentCountZeroWhenEnumeratingPowerDoma
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePowerFixture, GivenInvalidComponentCountWhenEnumeratingPowerDomainsThenValidCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
|
||||
EXPECT_CALL(*pSysfsAccess.get(), scanDirEntries(_, _))
|
||||
.WillRepeatedly(Return(ZE_RESULT_ERROR_NOT_AVAILABLE));
|
||||
|
||||
pSysfsAccess->mockScanDirEntriesReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
pSysfsAccess->isRepeated = true;
|
||||
|
||||
for (const auto &handle : pSysmanDeviceImp->pPowerHandleContext->handleList) {
|
||||
delete handle;
|
||||
}
|
||||
@@ -445,8 +451,10 @@ TEST_F(SysmanDevicePowerFixture, GivenInvalidComponentCountWhenEnumeratingPowerD
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePowerFixture, GivenComponentCountZeroWhenEnumeratingPowerDomainsThenValidPowerHandlesIsReturned) {
|
||||
EXPECT_CALL(*pSysfsAccess.get(), scanDirEntries(_, _))
|
||||
.WillRepeatedly(Return(ZE_RESULT_ERROR_NOT_AVAILABLE));
|
||||
|
||||
pSysfsAccess->mockScanDirEntriesReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
pSysfsAccess->isRepeated = true;
|
||||
|
||||
for (const auto &handle : pSysmanDeviceImp->pPowerHandleContext->handleList) {
|
||||
delete handle;
|
||||
}
|
||||
@@ -464,8 +472,10 @@ TEST_F(SysmanDevicePowerFixture, GivenComponentCountZeroWhenEnumeratingPowerDoma
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerPropertiesThenCallSucceeds) {
|
||||
EXPECT_CALL(*pSysfsAccess.get(), scanDirEntries(_, _))
|
||||
.WillRepeatedly(Return(ZE_RESULT_ERROR_NOT_AVAILABLE));
|
||||
|
||||
pSysfsAccess->mockScanDirEntriesReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
pSysfsAccess->isRepeated = true;
|
||||
|
||||
for (const auto &handle : pSysmanDeviceImp->pPowerHandleContext->handleList) {
|
||||
delete handle;
|
||||
}
|
||||
@@ -482,8 +492,10 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerProperties
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerEnergyCounterThenValidPowerReadingsRetrieved) {
|
||||
EXPECT_CALL(*pSysfsAccess.get(), scanDirEntries(_, _))
|
||||
.WillRepeatedly(Return(ZE_RESULT_ERROR_NOT_AVAILABLE));
|
||||
|
||||
pSysfsAccess->mockScanDirEntriesReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
pSysfsAccess->isRepeated = true;
|
||||
|
||||
for (const auto &handle : pSysmanDeviceImp->pPowerHandleContext->handleList) {
|
||||
delete handle;
|
||||
}
|
||||
@@ -509,8 +521,10 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerEnergyCoun
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerEnergyCounterWhenEnergyHwmonFileReturnsErrorAndPmtFailsThenFailureIsReturned) {
|
||||
EXPECT_CALL(*pSysfsAccess.get(), read(_, Matcher<uint64_t &>(_)))
|
||||
.WillRepeatedly(Return(ZE_RESULT_ERROR_NOT_AVAILABLE));
|
||||
|
||||
pSysfsAccess->mockReadReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
pSysfsAccess->isRepeated = true;
|
||||
|
||||
for (const auto &handle : pSysmanDeviceImp->pPowerHandleContext->handleList) {
|
||||
delete handle;
|
||||
}
|
||||
@@ -534,8 +548,10 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerEnergyCoun
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerEnergyThresholdThenUnsupportedFeatureErrorIsReturned) {
|
||||
EXPECT_CALL(*pSysfsAccess.get(), scanDirEntries(_, _))
|
||||
.WillRepeatedly(Return(ZE_RESULT_ERROR_NOT_AVAILABLE));
|
||||
|
||||
pSysfsAccess->mockScanDirEntriesReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
pSysfsAccess->isRepeated = true;
|
||||
|
||||
for (const auto &handle : pSysmanDeviceImp->pPowerHandleContext->handleList) {
|
||||
delete handle;
|
||||
}
|
||||
@@ -548,10 +564,11 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerEnergyThre
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePowerFixture, GivenScanDiectoriesFailAndPmtIsNullWhenGettingCardPowerThenReturnsFailure) {
|
||||
TEST_F(SysmanDevicePowerFixture, GivenScanDirectoriesFailAndPmtIsNullWhenGettingCardPowerThenReturnsFailure) {
|
||||
|
||||
pSysfsAccess->mockScanDirEntriesReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
pSysfsAccess->isRepeated = true;
|
||||
|
||||
EXPECT_CALL(*pSysfsAccess.get(), scanDirEntries(_, _))
|
||||
.WillRepeatedly(Return(ZE_RESULT_ERROR_NOT_AVAILABLE));
|
||||
for (const auto &handle : pSysmanDeviceImp->pPowerHandleContext->handleList) {
|
||||
delete handle;
|
||||
}
|
||||
@@ -570,8 +587,10 @@ TEST_F(SysmanDevicePowerFixture, GivenScanDiectoriesFailAndPmtIsNullWhenGettingC
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenSettingPowerEnergyThresholdThenUnsupportedFeatureErrorIsReturned) {
|
||||
EXPECT_CALL(*pSysfsAccess.get(), scanDirEntries(_, _))
|
||||
.WillRepeatedly(Return(ZE_RESULT_ERROR_NOT_AVAILABLE));
|
||||
|
||||
pSysfsAccess->mockScanDirEntriesReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
pSysfsAccess->isRepeated = true;
|
||||
|
||||
for (const auto &handle : pSysmanDeviceImp->pPowerHandleContext->handleList) {
|
||||
delete handle;
|
||||
}
|
||||
@@ -585,8 +604,10 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenSettingPowerEnergyThre
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerLimitsThenUnsupportedFeatureErrorIsReturned) {
|
||||
EXPECT_CALL(*pSysfsAccess.get(), scanDirEntries(_, _))
|
||||
.WillRepeatedly(Return(ZE_RESULT_ERROR_NOT_AVAILABLE));
|
||||
|
||||
pSysfsAccess->mockScanDirEntriesReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
pSysfsAccess->isRepeated = true;
|
||||
|
||||
for (const auto &handle : pSysmanDeviceImp->pPowerHandleContext->handleList) {
|
||||
delete handle;
|
||||
}
|
||||
@@ -602,8 +623,10 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerLimitsThen
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenSettingPowerLimitsThenUnsupportedFeatureErrorIsReturned) {
|
||||
EXPECT_CALL(*pSysfsAccess.get(), scanDirEntries(_, _))
|
||||
.WillRepeatedly(Return(ZE_RESULT_ERROR_NOT_AVAILABLE));
|
||||
|
||||
pSysfsAccess->mockScanDirEntriesReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
pSysfsAccess->isRepeated = true;
|
||||
|
||||
for (const auto &handle : pSysmanDeviceImp->pPowerHandleContext->handleList) {
|
||||
delete handle;
|
||||
}
|
||||
@@ -619,8 +642,10 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenSettingPowerLimitsThen
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePowerMultiDeviceFixture, GivenValidPowerHandleWhenGettingPowerEnergyCounterWhenEnergyHwmonFailsThenValidPowerReadingsRetrievedFromPmt) {
|
||||
EXPECT_CALL(*pSysfsAccess.get(), scanDirEntries(_, _))
|
||||
.WillRepeatedly(Return(ZE_RESULT_ERROR_NOT_AVAILABLE));
|
||||
|
||||
pSysfsAccess->mockScanDirEntriesReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
pSysfsAccess->isRepeated = true;
|
||||
|
||||
for (const auto &handle : pSysmanDeviceImp->pPowerHandleContext->handleList) {
|
||||
delete handle;
|
||||
}
|
||||
@@ -679,9 +704,9 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerProperties
|
||||
EXPECT_EQ(properties.subdeviceId, 0u);
|
||||
EXPECT_EQ(properties.canControl, true);
|
||||
EXPECT_EQ(properties.isEnergyThresholdSupported, false);
|
||||
EXPECT_EQ(properties.defaultLimit, (int32_t)(mockDefaultPowerLimitVal / milliFactor));
|
||||
EXPECT_EQ(properties.maxLimit, (int32_t)(mockMaxPowerLimitVal / milliFactor));
|
||||
EXPECT_EQ(properties.minLimit, (int32_t)(mockMinPowerLimitVal / milliFactor));
|
||||
EXPECT_EQ(properties.defaultLimit, static_cast<int32_t>(mockDefaultPowerLimitVal / milliFactor));
|
||||
EXPECT_EQ(properties.maxLimit, static_cast<int32_t>(mockMaxPowerLimitVal / milliFactor));
|
||||
EXPECT_EQ(properties.minLimit, static_cast<int32_t>(mockMinPowerLimitVal / milliFactor));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,15 +35,16 @@ TEST_F(SysmanDevicePowerMultiDeviceFixtureHelper, GivenValidDeviceHandlesAndHwmo
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePowerMultiDeviceFixtureHelper, GivenValidPowerPointerWhenGettingCardPowerDomainWhenhwmonInterfaceExistsAndThenCallSucceds) {
|
||||
TEST_F(SysmanDevicePowerMultiDeviceFixtureHelper, GivenValidPowerPointerWhenGettingCardPowerDomainWhenhwmonInterfaceExistsAndThenCallSucceeds) {
|
||||
zes_pwr_handle_t phPower = {};
|
||||
EXPECT_EQ(zesDeviceGetCardPowerDomain(device->toHandle(), &phPower), ZE_RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePowerMultiDeviceFixtureHelper, GivenScanDiectoriesFailAndPmtIsNullForSubDeviceZeroWhenGettingCardPowerThenReturnsFailure) {
|
||||
TEST_F(SysmanDevicePowerMultiDeviceFixtureHelper, GivenScanDirectoriesFailAndPmtIsNullForSubDeviceZeroWhenGettingCardPowerThenReturnsFailure) {
|
||||
|
||||
pSysfsAccess->mockScanDirEntriesReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
pSysfsAccess->isRepeated = true;
|
||||
|
||||
EXPECT_CALL(*pSysfsAccess.get(), scanDirEntries(_, _))
|
||||
.WillRepeatedly(Return(ZE_RESULT_ERROR_NOT_AVAILABLE));
|
||||
for (const auto &handle : pSysmanDeviceImp->pPowerHandleContext->handleList) {
|
||||
delete handle;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user