Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 55 additions & 1 deletion conformance_tests/sysman/test_sysman_ecc/src/test_sysman_ecc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are we using this? The default state would come as part of this ext structure but we dont seem to be using it,

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
Loading