Skip to content

Commit 14af865

Browse files
superm1herbertx
authored andcommitted
crypto: ccp - Update return values for some unit tests
Until authenticated the platform enforces a state machine. Adjust unit tests with this in mind. Correct the return codes for all the states the unit tests ends up hitting: * Set Param / Get Param: DBC_ERROR_BAD_STATE * Set UID: DBC_ERROR_SIGNATURE_INVALID * Authencitated Nonce: DBC_ERROR_BAD_PARAMETERS Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 0e8fca2 commit 14af865

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

tools/crypto/ccp/test_dbc.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,14 @@ def test_multiple_unauthenticated_nonce(self) -> None:
138138

139139
def test_authenticated_nonce(self) -> None:
140140
"""fetch authenticated nonce"""
141+
get_nonce(self.d, None)
141142
with self.assertRaises(OSError) as error:
142143
get_nonce(self.d, self.signature)
143-
self.assertEqual(error.exception.errno, 1)
144+
self.assertEqual(error.exception.errno, 22)
144145

145146
def test_set_uid(self) -> None:
146147
"""set uid"""
148+
get_nonce(self.d, None)
147149
with self.assertRaises(OSError) as error:
148150
set_uid(self.d, self.uid, self.signature)
149151
self.assertEqual(error.exception.errno, 1)
@@ -152,13 +154,13 @@ def test_get_param(self) -> None:
152154
"""fetch a parameter"""
153155
with self.assertRaises(OSError) as error:
154156
process_param(self.d, PARAM_GET_SOC_PWR_CUR, self.signature)
155-
self.assertEqual(error.exception.errno, 1)
157+
self.assertEqual(error.exception.errno, 11)
156158

157159
def test_set_param(self) -> None:
158160
"""set a parameter"""
159161
with self.assertRaises(OSError) as error:
160162
process_param(self.d, PARAM_SET_PWR_CAP, self.signature, 1000)
161-
self.assertEqual(error.exception.errno, 1)
163+
self.assertEqual(error.exception.errno, 11)
162164

163165

164166
class TestUnFusedSystem(DynamicBoostControlTest):

0 commit comments

Comments
 (0)