From 427689da38997fb8e2a569e328124c0403e085cd Mon Sep 17 00:00:00 2001 From: sandhyac Date: Fri, 4 Jul 2025 08:14:07 +0000 Subject: [PATCH] Test: Add test case for setting the default settings and check the get ECC state Related-To: VLCLJ-2434 Signed-off-by: kalyan alle --- .../test_sysman_ecc/src/test_sysman_ecc.cpp | 56 ++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/conformance_tests/sysman/test_sysman_ecc/src/test_sysman_ecc.cpp b/conformance_tests/sysman/test_sysman_ecc/src/test_sysman_ecc.cpp index 4cbdde204..4c028fc91 100644 --- a/conformance_tests/sysman/test_sysman_ecc/src/test_sysman_ecc.cpp +++ b/conformance_tests/sysman/test_sysman_ecc/src/test_sysman_ecc.cpp @@ -185,5 +185,59 @@ LZT_TEST_F( } } } - +LZT_TEST_F( + ECC_TEST, + GivenValidDeviceHandleWhenEccDefaultStateIsQueriedAndSetThenDefaultValuesAreReturned) { + for (const auto &device : devices) { + // Step 1: Get the ECC state (with default state extension) + zes_device_ecc_properties_t originalProps = {}; + zes_device_ecc_default_properties_ext_t extProps = {}; + originalProps.stype = ZES_STRUCTURE_TYPE_DEVICE_ECC_PROPERTIES; + originalProps.pNext = &extProps; + extProps.stype = ZES_STRUCTURE_TYPE_DEVICE_ECC_DEFAULT_PROPERTIES_EXT; + extProps.pNext = nullptr; + + ze_result_t result = zesDeviceGetEccState(device, &originalProps); + EXPECT_ZE_RESULT_SUCCESS(ZE_RESULT_SUCCESS, result); + + // Step 2: Set ECC state to default + zes_device_ecc_desc_t setDesc = {}; + setDesc.stype = ZES_STRUCTURE_TYPE_DEVICE_ECC_DESC; + setDesc.pNext = nullptr; + setDesc.state = extProps.defaultState; + + zes_device_ecc_properties_t newProps = {}; + newProps.stype = ZES_STRUCTURE_TYPE_DEVICE_ECC_PROPERTIES; + newProps.pNext = nullptr; + + result = zesDeviceSetEccState(device, &setDesc, &newProps); + EXPECT_EQ(ZE_RESULT_SUCCESS, result); + + // Step 3: Re-check ECC state + zes_device_ecc_properties_t checkProps = {}; + checkProps.stype = ZES_STRUCTURE_TYPE_DEVICE_ECC_PROPERTIES; + checkProps.pNext = nullptr; + + result = zesDeviceGetEccState(device, &checkProps); + EXPECT_EQ(ZE_RESULT_SUCCESS, result); + EXPECT_EQ(checkProps.pendingState, extProps.defaultState); + + // Step 4: Restore original pending ECC state if it changed + if (checkProps.pendingState != originalProps.pendingState) { + zes_device_ecc_desc_t restoreDesc = {}; + restoreDesc.stype = ZES_STRUCTURE_TYPE_DEVICE_ECC_DESC; + restoreDesc.pNext = nullptr; + restoreDesc.state = originalProps.pendingState; + + zes_device_ecc_properties_t restoredProps = {}; + restoredProps.stype = ZES_STRUCTURE_TYPE_DEVICE_ECC_PROPERTIES; + restoredProps.pNext = nullptr; + + result = zesDeviceSetEccState(device, &restoreDesc, &restoredProps); + EXPECT_EQ(ZE_RESULT_SUCCESS, result); + EXPECT_EQ(restoredProps.pendingState, + originalProps.pendingState); + } + } +} } // namespace