Skip to content

Commit fc3c827

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 fc3c827

File tree

1 file changed

+54
-1
lines changed

1 file changed

+54
-1
lines changed

conformance_tests/sysman/test_sysman_ecc/src/test_sysman_ecc.cpp

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,5 +185,58 @@ LZT_TEST_F(
185185
}
186186
}
187187
}
188-
188+
LZT_TEST_F(
189+
ECC_TEST,
190+
GivenValidDeviceHandleWhenEccDefaultStateIsQueriedAndSetThenDefaultValuesAreReturned) {
191+
for (const auto &device : devices) {
192+
// Step 1: Get the ECC state (with default state extension)
193+
zes_device_ecc_properties_t originalProps = {};
194+
zes_device_ecc_default_properties_ext_t extProps = {};
195+
originalProps.stype = ZES_STRUCTURE_TYPE_DEVICE_ECC_PROPERTIES;
196+
originalProps.pNext = &extProps;
197+
extProps.stype = ZES_STRUCTURE_TYPE_DEVICE_ECC_DEFAULT_PROPERTIES_EXT;
198+
extProps.pNext = nullptr;
199+
200+
ze_result_t result = zesDeviceGetEccState(device, &originalProps);
201+
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
202+
203+
// Step 2: Set ECC state to default
204+
zes_device_ecc_desc_t setDesc = {};
205+
setDesc.stype = ZES_STRUCTURE_TYPE_DEVICE_ECC_DESC;
206+
setDesc.pNext = nullptr;
207+
setDesc.state = extProps.defaultState;
208+
209+
zes_device_ecc_properties_t newProps = {};
210+
newProps.stype = ZES_STRUCTURE_TYPE_DEVICE_ECC_PROPERTIES;
211+
newProps.pNext = nullptr;
212+
213+
result = zesDeviceSetEccState(device, &setDesc, &newProps);
214+
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
215+
216+
// Step 3: Re-check ECC state
217+
zes_device_ecc_properties_t checkProps = {};
218+
checkProps.stype = ZES_STRUCTURE_TYPE_DEVICE_ECC_PROPERTIES;
219+
checkProps.pNext = nullptr;
220+
221+
result = zesDeviceGetEccState(device, &checkProps);
222+
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
223+
EXPECT_EQ(checkProps.pendingState, extProps.defaultState);
224+
225+
// Step 4: Restore original pending ECC state if it changed
226+
if (checkProps.pendingState != originalProps.pendingState) {
227+
zes_device_ecc_desc_t restoreDesc = {};
228+
restoreDesc.stype = ZES_STRUCTURE_TYPE_DEVICE_ECC_DESC;
229+
restoreDesc.pNext = nullptr;
230+
restoreDesc.state = originalProps.pendingState;
231+
232+
zes_device_ecc_properties_t restoredProps = {};
233+
restoredProps.stype = ZES_STRUCTURE_TYPE_DEVICE_ECC_PROPERTIES;
234+
restoredProps.pNext = nullptr;
235+
236+
result = zesDeviceSetEccState(device, &restoreDesc, &restoredProps);
237+
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
238+
EXPECT_EQ(restoredProps.pendingState, originalProps.pendingState);
239+
}
240+
}
241+
}
189242
} // namespace

0 commit comments

Comments
 (0)