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: 15f8aa7bb3
("crypto: ccp - Add unit tests for dynamic boost control")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
2ad01eb5fa
commit
7b3c2348d3
|
@ -33,8 +33,8 @@ def system_is_secured() -> bool:
|
||||||
class DynamicBoostControlTest(unittest.TestCase):
|
class DynamicBoostControlTest(unittest.TestCase):
|
||||||
def __init__(self, data) -> None:
|
def __init__(self, data) -> None:
|
||||||
self.d = None
|
self.d = None
|
||||||
self.signature = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
self.signature = b"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
||||||
self.uid = "1111111111111111"
|
self.uid = b"1111111111111111"
|
||||||
super().__init__(data)
|
super().__init__(data)
|
||||||
|
|
||||||
def setUp(self) -> None:
|
def setUp(self) -> None:
|
||||||
|
@ -192,12 +192,12 @@ class TestUnFusedSystem(DynamicBoostControlTest):
|
||||||
# SOC power
|
# SOC power
|
||||||
soc_power_max = process_param(self.d, PARAM_GET_SOC_PWR_MAX, self.signature)
|
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)
|
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
|
||||||
fmax_max = process_param(self.d, PARAM_GET_FMAX_MAX, self.signature)
|
fmax_max = process_param(self.d, PARAM_GET_FMAX_MAX, self.signature)
|
||||||
fmax_min = process_param(self.d, PARAM_GET_FMAX_MIN, 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
|
# cap values
|
||||||
keys = {
|
keys = {
|
||||||
|
@ -208,7 +208,7 @@ class TestUnFusedSystem(DynamicBoostControlTest):
|
||||||
}
|
}
|
||||||
for k in keys:
|
for k in keys:
|
||||||
result = process_param(self.d, keys[k], self.signature)
|
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:
|
def test_get_invalid_param(self) -> None:
|
||||||
"""fetch an invalid parameter"""
|
"""fetch an invalid parameter"""
|
||||||
|
@ -226,17 +226,17 @@ class TestUnFusedSystem(DynamicBoostControlTest):
|
||||||
original = process_param(self.d, PARAM_GET_FMAX_CAP, self.signature)
|
original = process_param(self.d, PARAM_GET_FMAX_CAP, self.signature)
|
||||||
|
|
||||||
# set the fmax
|
# set the fmax
|
||||||
target = original.parameter - 100
|
target = original[0] - 100
|
||||||
process_param(self.d, PARAM_SET_FMAX_CAP, self.signature, target)
|
process_param(self.d, PARAM_SET_FMAX_CAP, self.signature, target)
|
||||||
time.sleep(SET_DELAY)
|
time.sleep(SET_DELAY)
|
||||||
new = process_param(self.d, PARAM_GET_FMAX_CAP, self.signature)
|
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
|
# 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)
|
time.sleep(SET_DELAY)
|
||||||
cur = process_param(self.d, PARAM_GET_FMAX_CAP, self.signature)
|
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:
|
def test_set_power_cap(self) -> None:
|
||||||
"""get/set power cap limit"""
|
"""get/set power cap limit"""
|
||||||
|
@ -244,17 +244,17 @@ class TestUnFusedSystem(DynamicBoostControlTest):
|
||||||
original = process_param(self.d, PARAM_GET_PWR_CAP, self.signature)
|
original = process_param(self.d, PARAM_GET_PWR_CAP, self.signature)
|
||||||
|
|
||||||
# set the fmax
|
# set the fmax
|
||||||
target = original.parameter - 10
|
target = original[0] - 10
|
||||||
process_param(self.d, PARAM_SET_PWR_CAP, self.signature, target)
|
process_param(self.d, PARAM_SET_PWR_CAP, self.signature, target)
|
||||||
time.sleep(SET_DELAY)
|
time.sleep(SET_DELAY)
|
||||||
new = process_param(self.d, PARAM_GET_PWR_CAP, self.signature)
|
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
|
# 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)
|
time.sleep(SET_DELAY)
|
||||||
cur = process_param(self.d, PARAM_GET_PWR_CAP, self.signature)
|
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:
|
def test_set_3d_graphics_mode(self) -> None:
|
||||||
"""set/get 3d graphics mode"""
|
"""set/get 3d graphics mode"""
|
||||||
|
|
Loading…
Reference in New Issue