Skip to content

Commit 5ec5d6c

Browse files
committed
Test: Add test case for setting the default settings and check the get ECC state
Related-To: VLCLJ-2434 Signed-off-by: kalyan alle <[email protected]>
1 parent 7e1fe2b commit 5ec5d6c

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

conformance_tests/sysman/test_sysman_ecc/src/test_sysman_ecc.cpp

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,5 +185,37 @@ LZT_TEST_F(
185185
}
186186
}
187187
}
188-
188+
LZT_TEST_F(
189+
ECC_TEST,
190+
GivenValidDeviceHandleAndECCAvailableWhenEccGetDefaultStateIsQueriedAndSetThenDefaultValuesAreReturnedFromGetEccAPI) {
191+
for (const auto &device : devices) {
192+
// Check if ECC is available and configurable
193+
zes_device_ecc_properties_t getProps = {};
194+
zes_device_ecc_default_properties_ext_t extProps = {};
195+
extProps.stype = ZES_STRUCTURE_TYPE_DEVICE_ECC_DEFAULT_PROPERTIES_EXT;
196+
getProps.pNext = &extProps;
197+
auto available = lzt::get_ecc_available(device);
198+
auto configurable = lzt::get_ecc_configurable(device);
199+
if (available == static_cast<ze_bool_t>(true) &&
200+
configurable == static_cast<ze_bool_t>(true)) {
201+
// Get ECC state with defaults
202+
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDeviceGetEccState(device, &getProps));
203+
// Set ECC state with default settings
204+
zes_device_ecc_desc_t newState = {ZES_STRUCTURE_TYPE_DEVICE_ECC_DESC,
205+
nullptr};
206+
newState.state = getProps.currentState;
207+
zes_device_ecc_properties_t setState = {
208+
ZES_STRUCTURE_TYPE_DEVICE_ECC_PROPERTIES, nullptr};
209+
EXPECT_EQ(ZE_RESULT_SUCCESS,
210+
zesDeviceSetEccState(device, &newState, &setState));
211+
// Get ECC state without defaults
212+
EXPECT_EQ(EXPECT_ZE_RESULT_SUCCESS, zesDeviceGetEccState(device, &getProps));
213+
if (getProps.pendingState != getProps.currentState) {
214+
EXPECT_NE(getProps.pendingAction, ZES_DEVICE_ACTION_NONE);
215+
}
216+
} else {
217+
LOG_INFO << "ECC is not available or not configurable";
218+
}
219+
}
220+
}
189221
} // namespace

0 commit comments

Comments
 (0)