Skip to content

Commit f9dee0c

Browse files
fix: correct error codes in ecc
Related-To: NEO-15201 Signed-off-by: shubham kumar <[email protected]> Source: a3bbfbc
1 parent 0f6e1c5 commit f9dee0c

File tree

5 files changed

+62
-42
lines changed

5 files changed

+62
-42
lines changed

level_zero/sysman/source/api/ecc/sysman_ecc_imp.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,16 @@ ze_result_t EccImp::getEccState(zes_device_ecc_properties_t *pState) {
6363
}
6464
}
6565

66-
uint8_t currentState = 0;
67-
uint8_t pendingState = 0;
66+
uint8_t currentState = 0xff;
67+
uint8_t pendingState = 0xff;
6868
ze_result_t result = pFwInterface->fwGetEccConfig(&currentState, &pendingState);
69+
70+
pState->currentState = getEccState(currentState);
71+
pState->pendingState = getEccState(pendingState);
72+
6973
if (result != ZE_RESULT_SUCCESS) {
7074
return result;
7175
}
72-
pState->currentState = getEccState(currentState);
73-
pState->pendingState = getEccState(pendingState);
7476

7577
pState->pendingAction = ZES_DEVICE_ACTION_WARM_CARD_RESET;
7678
if (pState->currentState == pState->pendingState) {
@@ -96,6 +98,8 @@ ze_result_t EccImp::setEccState(const zes_device_ecc_desc_t *newState, zes_devic
9698
state = eccStateEnable;
9799
} else if (newState->state == ZES_DEVICE_ECC_STATE_DISABLED) {
98100
state = eccStateDisable;
101+
} else if (newState->state == ZES_DEVICE_ECC_STATE_UNAVAILABLE) {
102+
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
99103
} else {
100104
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Invalid ecc enumeration and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_INVALID_ENUMERATION);
101105
return ZE_RESULT_ERROR_INVALID_ENUMERATION;

level_zero/sysman/source/shared/firmware_util/sysman_firmware_util_imp_helper.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ ze_result_t FirmwareUtilImp::fwGetEccConfig(uint8_t *currentState, uint8_t *pend
165165
*pendingState = outBuf[GfspHeciConstants::GetEccCmd9BytePostition::pendingState];
166166
return ZE_RESULT_SUCCESS;
167167
}
168-
return ZE_RESULT_ERROR_UNINITIALIZED;
168+
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
169169
}
170-
return ZE_RESULT_ERROR_UNINITIALIZED;
170+
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
171171
}
172172

173173
ze_result_t FirmwareUtilImp::fwGetEccAvailable(ze_bool_t *pAvailable) {
@@ -197,9 +197,9 @@ ze_result_t FirmwareUtilImp::fwGetEccAvailable(ze_bool_t *pAvailable) {
197197
}
198198
return ZE_RESULT_SUCCESS;
199199
}
200-
return ZE_RESULT_ERROR_UNINITIALIZED;
200+
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
201201
}
202-
return ZE_RESULT_ERROR_UNINITIALIZED;
202+
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
203203
}
204204

205205
ze_result_t FirmwareUtilImp::fwGetEccConfigurable(ze_bool_t *pConfigurable) {
@@ -229,9 +229,9 @@ ze_result_t FirmwareUtilImp::fwGetEccConfigurable(ze_bool_t *pConfigurable) {
229229
}
230230
return ZE_RESULT_SUCCESS;
231231
}
232-
return ZE_RESULT_ERROR_UNINITIALIZED;
232+
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
233233
}
234-
return ZE_RESULT_ERROR_UNINITIALIZED;
234+
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
235235
}
236236

237237
ze_result_t FirmwareUtilImp::fwSetEccConfig(uint8_t newState, uint8_t *currentState, uint8_t *pendingState) {
@@ -266,9 +266,9 @@ ze_result_t FirmwareUtilImp::fwSetEccConfig(uint8_t newState, uint8_t *currentSt
266266
*pendingState = outBuf[GfspHeciConstants::SetEccCmd8BytePostition::responsePendingState];
267267
return ZE_RESULT_SUCCESS;
268268
}
269-
return ZE_RESULT_ERROR_UNINITIALIZED;
269+
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
270270
}
271-
return ZE_RESULT_ERROR_UNINITIALIZED;
271+
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
272272
}
273273

274274
ze_result_t FirmwareUtilImp::fwSupportedDiagTests(std::vector<std::string> &supportedDiagTests) {

level_zero/sysman/test/unit_tests/sources/ecc/windows/test_zes_ecc.cpp

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class ZesEccFixture : public SysmanDeviceFixture {
4343
}
4444
};
4545

46-
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingzesDeviceEccAvailableTwiceThenVerifyApiCallSucceeds) {
46+
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingZesDeviceEccAvailableTwiceThenVerifyApiCallSucceeds) {
4747
ze_bool_t eccAvailable = false;
4848
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDeviceEccAvailable(pSysmanDevice->toHandle(), &eccAvailable));
4949
EXPECT_EQ(true, eccAvailable);
@@ -53,7 +53,7 @@ TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingze
5353
EXPECT_EQ(true, eccAvailable);
5454
}
5555

56-
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingzesDeviceEccConfigurableTwiceThenVerifyApiCallSucceeds) {
56+
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingZesDeviceEccConfigurableTwiceThenVerifyApiCallSucceeds) {
5757
ze_bool_t eccConfigurable = false;
5858
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDeviceEccConfigurable(pSysmanDevice->toHandle(), &eccConfigurable));
5959
EXPECT_EQ(true, eccConfigurable);
@@ -79,7 +79,7 @@ TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsAbsentWhenCallingEcc
7979
delete tempEccImp;
8080
}
8181

82-
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwGetEccConfigFailsWhenCallingzesDeviceEccConfigurableAndAvailableThenVerifyApiCallReturnsFailure) {
82+
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwGetEccConfigFailsWhenCallingZesDeviceEccConfigurableAndAvailableThenVerifyApiCallReturnsFailure) {
8383
ze_bool_t eccConfigurable = true;
8484
ze_bool_t eccAvailable = true;
8585
pMockFwInterface->mockFwGetEccAvailableResult = ZE_RESULT_ERROR_UNINITIALIZED;
@@ -89,7 +89,7 @@ TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwGetEccConfigFailsWhenCallingzes
8989
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, zesDeviceEccConfigurable(pSysmanDevice->toHandle(), &eccConfigurable));
9090
}
9191

92-
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndCurrentStateIsNoneWhenCallingzesDeviceEccConfigurableAndAvailableThenNotSupportedEccIsReturned) {
92+
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndCurrentStateIsNoneWhenCallingZesDeviceEccConfigurableAndAvailableThenNotSupportedEccIsReturned) {
9393
ze_bool_t eccConfigurable = true;
9494
ze_bool_t eccAvailable = true;
9595
pMockFwInterface->mockEccAvailable = false;
@@ -101,21 +101,23 @@ TEST_F(ZesEccFixture, GivenValidSysmanHandleAndCurrentStateIsNoneWhenCallingzesD
101101
EXPECT_EQ(false, eccConfigurable);
102102
}
103103

104-
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingzesDeviceGetEccStateThenApiCallSucceeds) {
104+
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingZesDeviceGetEccStateThenApiCallSucceeds) {
105105
zes_device_ecc_properties_t props = {};
106106
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDeviceGetEccState(pSysmanDevice->toHandle(), &props));
107107
EXPECT_EQ(ZES_DEVICE_ECC_STATE_DISABLED, props.currentState);
108108
EXPECT_EQ(ZES_DEVICE_ECC_STATE_DISABLED, props.pendingState);
109109
EXPECT_EQ(ZES_DEVICE_ACTION_NONE, props.pendingAction);
110110
}
111111

112-
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwGetEccConfigFailsWhenCallingzesDeviceGetEccStateThenApiCallReturnFailure) {
112+
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwGetEccConfigFailsWhenCallingZesDeviceGetEccStateThenApiCallReturnFailure) {
113113
zes_device_ecc_properties_t props = {};
114114
pMockFwInterface->mockFwGetEccConfigResult = ZE_RESULT_ERROR_UNINITIALIZED;
115115
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, zesDeviceGetEccState(pSysmanDevice->toHandle(), &props));
116+
EXPECT_EQ(ZES_DEVICE_ECC_STATE_UNAVAILABLE, props.currentState);
117+
EXPECT_EQ(ZES_DEVICE_ECC_STATE_UNAVAILABLE, props.pendingState);
116118
}
117119

118-
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingzesDeviceSetEccStateThenApiCallSucceeds) {
120+
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingZesDeviceSetEccStateThenApiCallSucceeds) {
119121
zes_device_ecc_desc_t newState = {ZES_STRUCTURE_TYPE_DEVICE_STATE, nullptr, ZES_DEVICE_ECC_STATE_ENABLED};
120122
zes_device_ecc_properties_t props = {};
121123
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDeviceSetEccState(pSysmanDevice->toHandle(), &newState, &props));
@@ -124,13 +126,19 @@ TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingze
124126
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDeviceSetEccState(pSysmanDevice->toHandle(), &newState, &props));
125127
}
126128

127-
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingzesDeviceSetEccStateWithInvalidEnumThenFailureIsReturned) {
129+
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingZesDeviceSetEccStateWithUnavailableEnumThenUnsupportedIsReturned) {
128130
zes_device_ecc_desc_t newState = {ZES_STRUCTURE_TYPE_DEVICE_STATE, nullptr, ZES_DEVICE_ECC_STATE_UNAVAILABLE};
129131
zes_device_ecc_properties_t props = {};
132+
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zesDeviceSetEccState(pSysmanDevice->toHandle(), &newState, &props));
133+
}
134+
135+
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingZesDeviceSetEccStateWithInvalidEnumThenFailureIsReturned) {
136+
zes_device_ecc_desc_t newState = {ZES_STRUCTURE_TYPE_DEVICE_STATE, nullptr, ZES_DEVICE_ECC_STATE_FORCE_UINT32};
137+
zes_device_ecc_properties_t props = {};
130138
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ENUMERATION, zesDeviceSetEccState(pSysmanDevice->toHandle(), &newState, &props));
131139
}
132140

133-
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwSetEccConfigFailsWhenCallingzesDeviceSetEccStateThenFailureIsReturned) {
141+
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwSetEccConfigFailsWhenCallingZesDeviceSetEccStateThenFailureIsReturned) {
134142
zes_device_ecc_desc_t newState = {ZES_STRUCTURE_TYPE_DEVICE_STATE, nullptr, ZES_DEVICE_ECC_STATE_ENABLED};
135143
zes_device_ecc_properties_t props = {};
136144
pMockFwInterface->mockFwSetEccConfigResult = ZE_RESULT_ERROR_UNINITIALIZED;

level_zero/sysman/test/unit_tests/sources/firmware_util/test_fw_util_helper.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,9 @@ TEST(FwEccTest, GivenFwEccConfigCallFailsWhenCallingFirmwareUtilSetAndGetEccThen
266266
uint8_t pendingState = 0;
267267
uint8_t newState = 0;
268268
auto ret = pFwUtilImp->fwGetEccConfig(&currentState, &pendingState);
269-
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, ret);
269+
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, ret);
270270
ret = pFwUtilImp->fwSetEccConfig(newState, &currentState, &pendingState);
271-
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, ret);
271+
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, ret);
272272
delete pFwUtilImp->libraryHandle;
273273
pFwUtilImp->libraryHandle = nullptr;
274274
delete pFwUtilImp;
@@ -327,9 +327,9 @@ TEST(LinuxFwEccTest, GivenGetProcAddrCallFailsWhenFirmwareUtilChecksEccGetAndSet
327327
uint8_t pendingState = 0;
328328
uint8_t newState = 0;
329329
auto ret = pFwUtilImp->fwGetEccConfig(&currentState, &pendingState);
330-
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, ret);
330+
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, ret);
331331
ret = pFwUtilImp->fwSetEccConfig(newState, &currentState, &pendingState);
332-
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, ret);
332+
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, ret);
333333
delete pFwUtilImp->libraryHandle;
334334
pFwUtilImp->libraryHandle = nullptr;
335335
delete pFwUtilImp;
@@ -626,7 +626,7 @@ TEST(LinuxFwEccTest, GivenHeciCmd9AndCmd16AreUnsupportedWhenCallingFwGetEccAvail
626626
ze_bool_t pAvailable;
627627
auto ret = pFwUtilImp->fwGetEccAvailable(&pAvailable);
628628
EXPECT_FALSE(pAvailable);
629-
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, ret);
629+
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, ret);
630630

631631
delete pFwUtilImp->libraryHandle;
632632
pFwUtilImp->libraryHandle = nullptr;
@@ -717,7 +717,7 @@ TEST(LinuxFwEccTest, GivenHeciCmd9AndCmd16AreUnsupportedWhenCallingFwGetEccConfi
717717
ze_bool_t pConfigurable;
718718
auto ret = pFwUtilImp->fwGetEccConfigurable(&pConfigurable);
719719
EXPECT_FALSE(pConfigurable);
720-
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, ret);
720+
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, ret);
721721

722722
delete pFwUtilImp->libraryHandle;
723723
pFwUtilImp->libraryHandle = nullptr;
@@ -784,17 +784,17 @@ TEST(LinuxFwEccTest, GivenUnavailableHeciFunctionPointersWhenCallingEccMethodsTh
784784
pFwUtilImp->libraryHandle = static_cast<OsLibrary *>(osLibHandle);
785785

786786
ze_bool_t pAvailable;
787-
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, pFwUtilImp->fwGetEccAvailable(&pAvailable));
787+
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, pFwUtilImp->fwGetEccAvailable(&pAvailable));
788788

789789
ze_bool_t pConfigurable;
790-
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, pFwUtilImp->fwGetEccConfigurable(&pConfigurable));
790+
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, pFwUtilImp->fwGetEccConfigurable(&pConfigurable));
791791

792792
uint8_t currentState;
793793
uint8_t pendingState;
794-
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, pFwUtilImp->fwGetEccConfig(&currentState, &pendingState));
794+
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, pFwUtilImp->fwGetEccConfig(&currentState, &pendingState));
795795

796796
uint8_t newState = 1;
797-
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, pFwUtilImp->fwSetEccConfig(newState, &currentState, &pendingState));
797+
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, pFwUtilImp->fwSetEccConfig(newState, &currentState, &pendingState));
798798

799799
delete pFwUtilImp->libraryHandle;
800800
pFwUtilImp->libraryHandle = nullptr;
@@ -840,7 +840,7 @@ TEST(LinuxFwEccTest, GivenHeciCmd15IsSupportedThenWhenCallingFwSetEccConfigAndFw
840840
uint8_t pendingState;
841841
uint8_t newState = 1;
842842
auto ret = pFwUtilImp->fwSetEccConfig(newState, &currentState, &pendingState);
843-
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, ret);
843+
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, ret);
844844

845845
delete pFwUtilImp->libraryHandle;
846846
pFwUtilImp->libraryHandle = nullptr;
@@ -861,7 +861,7 @@ TEST(LinuxFwEccTest, GivenHeciSetCommandsAreNotSupportedThenWhenCallingFwSetEccC
861861
uint8_t pendingState;
862862
uint8_t newState = 1;
863863
auto ret = pFwUtilImp->fwSetEccConfig(newState, &currentState, &pendingState);
864-
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, ret);
864+
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, ret);
865865

866866
delete pFwUtilImp->libraryHandle;
867867
pFwUtilImp->libraryHandle = nullptr;

level_zero/sysman/test/unit_tests/sources/shared/linux/product_helper/sysman_product_helper_ecc_tests.cpp

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ZesEccFixture : public SysmanDeviceFixture {
4141
}
4242
};
4343

44-
HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingzesDeviceEccAvailableTwiceThenVerifyApiCallSucceeds, isDg2OrBmg) {
44+
HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingZesDeviceEccAvailableTwiceThenVerifyApiCallSucceeds, isDg2OrBmg) {
4545
ze_bool_t eccAvailable = false;
4646
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDeviceEccAvailable(device, &eccAvailable));
4747
EXPECT_EQ(true, eccAvailable);
@@ -51,7 +51,7 @@ HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallin
5151
EXPECT_EQ(true, eccAvailable);
5252
}
5353

54-
HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingzesDeviceEccConfigurableTwiceThenVerifyApiCallSucceeds, isDg2OrBmg) {
54+
HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingZesDeviceEccConfigurableTwiceThenVerifyApiCallSucceeds, isDg2OrBmg) {
5555
ze_bool_t eccConfigurable = false;
5656
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDeviceEccConfigurable(device, &eccConfigurable));
5757
EXPECT_EQ(true, eccConfigurable);
@@ -77,7 +77,7 @@ HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsAbsentWhenCalling
7777
delete tempEccImp;
7878
}
7979

80-
HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwGetEccConfigFailsWhenCallingzesDeviceEccConfigurableAndAvailableThenVerifyApiCallReturnsFailure, isDg2OrBmg) {
80+
HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwGetEccConfigFailsWhenCallingZesDeviceEccConfigurableAndAvailableThenVerifyApiCallReturnsFailure, isDg2OrBmg) {
8181
ze_bool_t eccConfigurable = true;
8282
ze_bool_t eccAvailable = true;
8383
pMockFwInterface->mockFwGetEccAvailableResult = ZE_RESULT_ERROR_UNINITIALIZED;
@@ -87,7 +87,7 @@ HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwGetEccConfigFailsWhenCalling
8787
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, zesDeviceEccConfigurable(device, &eccConfigurable));
8888
}
8989

90-
HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndCurrentStateIsNoneWhenCallingzesDeviceEccConfigurableAndAvailableThenNotSupportedEccIsReturned, isDg2OrBmg) {
90+
HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndCurrentStateIsNoneWhenCallingZesDeviceEccConfigurableAndAvailableThenNotSupportedEccIsReturned, isDg2OrBmg) {
9191
ze_bool_t eccConfigurable = true;
9292
ze_bool_t eccAvailable = true;
9393
pMockFwInterface->mockEccAvailable = false;
@@ -99,21 +99,23 @@ HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndCurrentStateIsNoneWhenCallingz
9999
EXPECT_EQ(false, eccConfigurable);
100100
}
101101

102-
HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingzesDeviceGetEccStateThenApiCallSucceeds, isDg2OrBmg) {
102+
HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingZesDeviceGetEccStateThenApiCallSucceeds, isDg2OrBmg) {
103103
zes_device_ecc_properties_t props = {};
104104
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDeviceGetEccState(device, &props));
105105
EXPECT_EQ(ZES_DEVICE_ECC_STATE_DISABLED, props.currentState);
106106
EXPECT_EQ(ZES_DEVICE_ECC_STATE_DISABLED, props.pendingState);
107107
EXPECT_EQ(ZES_DEVICE_ACTION_NONE, props.pendingAction);
108108
}
109109

110-
HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwGetEccConfigFailsWhenCallingzesDeviceGetEccStateThenApiCallReturnFailure, isDg2OrBmg) {
110+
HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwGetEccConfigFailsWhenCallingZesDeviceGetEccStateThenApiCallReturnFailure, isDg2OrBmg) {
111111
zes_device_ecc_properties_t props = {};
112112
pMockFwInterface->mockFwGetEccConfigResult = ZE_RESULT_ERROR_UNINITIALIZED;
113113
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, zesDeviceGetEccState(device, &props));
114+
EXPECT_EQ(ZES_DEVICE_ECC_STATE_UNAVAILABLE, props.currentState);
115+
EXPECT_EQ(ZES_DEVICE_ECC_STATE_UNAVAILABLE, props.pendingState);
114116
}
115117

116-
HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingzesDeviceSetEccStateThenApiCallSucceeds, isDg2OrBmg) {
118+
HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingZesDeviceSetEccStateThenApiCallSucceeds, isDg2OrBmg) {
117119
zes_device_ecc_desc_t newState = {ZES_STRUCTURE_TYPE_DEVICE_STATE, nullptr, ZES_DEVICE_ECC_STATE_ENABLED};
118120
zes_device_ecc_properties_t props = {};
119121
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDeviceSetEccState(device, &newState, &props));
@@ -122,13 +124,19 @@ HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallin
122124
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDeviceSetEccState(device, &newState, &props));
123125
}
124126

125-
HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingzesDeviceSetEccStateWithInvalidEnumThenFailureIsReturned, isDg2OrBmg) {
127+
HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingZesDeviceSetEccStateWithUnavailableEnumThenUnsupportedIsReturned, isDg2OrBmg) {
126128
zes_device_ecc_desc_t newState = {ZES_STRUCTURE_TYPE_DEVICE_STATE, nullptr, ZES_DEVICE_ECC_STATE_UNAVAILABLE};
127129
zes_device_ecc_properties_t props = {};
130+
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zesDeviceSetEccState(device, &newState, &props));
131+
}
132+
133+
HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingZesDeviceSetEccStateWithInvalidEnumThenFailureIsReturned, isDg2OrBmg) {
134+
zes_device_ecc_desc_t newState = {ZES_STRUCTURE_TYPE_DEVICE_STATE, nullptr, ZES_DEVICE_ECC_STATE_FORCE_UINT32};
135+
zes_device_ecc_properties_t props = {};
128136
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ENUMERATION, zesDeviceSetEccState(device, &newState, &props));
129137
}
130138

131-
HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwSetEccConfigFailsWhenCallingzesDeviceSetEccStateThenFailureIsReturned, isDg2OrBmg) {
139+
HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwSetEccConfigFailsWhenCallingZesDeviceSetEccStateThenFailureIsReturned, isDg2OrBmg) {
132140
zes_device_ecc_desc_t newState = {ZES_STRUCTURE_TYPE_DEVICE_STATE, nullptr, ZES_DEVICE_ECC_STATE_ENABLED};
133141
zes_device_ecc_properties_t props = {};
134142
pMockFwInterface->mockFwSetEccConfigResult = ZE_RESULT_ERROR_UNINITIALIZED;

0 commit comments

Comments
 (0)