Commit 7b3c2348 authored by Mario Limonciello's avatar Mario Limonciello Committed by Herbert Xu

crypto: ccp - Fix some unfused tests

Some of the tests for unfused parts referenced a named member parameter,
but when the test suite was switched to call a python ctypes library they
weren't updated.  Adjust them to refer to the first argument of the
process_param() call and set the data type of the signature appropriately.

Fixes: 15f8aa7b ("crypto: ccp - Add unit tests for dynamic boost control")
Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 2ad01eb5
......@@ -33,8 +33,8 @@ def system_is_secured() -> bool:
class DynamicBoostControlTest(unittest.TestCase):
def __init__(self, data) -> None:
self.d = None
self.signature = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
self.uid = "1111111111111111"
self.signature = b"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
self.uid = b"1111111111111111"
super().__init__(data)
def setUp(self) -> None:
......@@ -192,12 +192,12 @@ class TestUnFusedSystem(DynamicBoostControlTest):
# SOC power
soc_power_max = process_param(self.d, PARAM_GET_SOC_PWR_MAX, self.signature)
soc_power_min = process_param(self.d, PARAM_GET_SOC_PWR_MIN, self.signature)
self.assertGreater(soc_power_max.parameter, soc_power_min.parameter)
self.assertGreater(soc_power_max[0], soc_power_min[0])
# fmax
fmax_max = process_param(self.d, PARAM_GET_FMAX_MAX, self.signature)
fmax_min = process_param(self.d, PARAM_GET_FMAX_MIN, self.signature)
self.assertGreater(fmax_max.parameter, fmax_min.parameter)
self.assertGreater(fmax_max[0], fmax_min[0])
# cap values
keys = {
......@@ -208,7 +208,7 @@ class TestUnFusedSystem(DynamicBoostControlTest):
}
for k in keys:
result = process_param(self.d, keys[k], self.signature)
self.assertGreater(result.parameter, 0)
self.assertGreater(result[0], 0)
def test_get_invalid_param(self) -> None:
"""fetch an invalid parameter"""
......@@ -226,17 +226,17 @@ class TestUnFusedSystem(DynamicBoostControlTest):
original = process_param(self.d, PARAM_GET_FMAX_CAP, self.signature)
# set the fmax
target = original.parameter - 100
target = original[0] - 100
process_param(self.d, PARAM_SET_FMAX_CAP, self.signature, target)
time.sleep(SET_DELAY)
new = process_param(self.d, PARAM_GET_FMAX_CAP, self.signature)
self.assertEqual(new.parameter, target)
self.assertEqual(new[0], target)
# revert back to current
process_param(self.d, PARAM_SET_FMAX_CAP, self.signature, original.parameter)
process_param(self.d, PARAM_SET_FMAX_CAP, self.signature, original[0])
time.sleep(SET_DELAY)
cur = process_param(self.d, PARAM_GET_FMAX_CAP, self.signature)
self.assertEqual(cur.parameter, original.parameter)
self.assertEqual(cur[0], original[0])
def test_set_power_cap(self) -> None:
"""get/set power cap limit"""
......@@ -244,17 +244,17 @@ class TestUnFusedSystem(DynamicBoostControlTest):
original = process_param(self.d, PARAM_GET_PWR_CAP, self.signature)
# set the fmax
target = original.parameter - 10
target = original[0] - 10
process_param(self.d, PARAM_SET_PWR_CAP, self.signature, target)
time.sleep(SET_DELAY)
new = process_param(self.d, PARAM_GET_PWR_CAP, self.signature)
self.assertEqual(new.parameter, target)
self.assertEqual(new[0], target)
# revert back to current
process_param(self.d, PARAM_SET_PWR_CAP, self.signature, original.parameter)
process_param(self.d, PARAM_SET_PWR_CAP, self.signature, original[0])
time.sleep(SET_DELAY)
cur = process_param(self.d, PARAM_GET_PWR_CAP, self.signature)
self.assertEqual(cur.parameter, original.parameter)
self.assertEqual(cur[0], original[0])
def test_set_3d_graphics_mode(self) -> None:
"""set/get 3d graphics mode"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment