aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTom Rini2023-06-13 13:14:49 -0400
committerTom Rini2023-06-13 13:14:49 -0400
commitcb4fe56eca1109780e97c68329e6b71ef33bf0e6 (patch)
tree55d67b8fea6be17e32964d52b276a7b200faa1e9 /test
parent7da82de916d6aaeeef62431810cb3335e1207b28 (diff)
parent011f015540d788227a1a2d16dd6245120827bdec (diff)
Merge tag 'tpm-for_tom-13062023' of https://source.denx.de/u-boot/custodians/u-boot-tpm into next
tpm autostart
Diffstat (limited to 'test')
-rw-r--r--test/py/tests/test_tpm2.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/test/py/tests/test_tpm2.py b/test/py/tests/test_tpm2.py
index d2ad6f9e73c..fce689cd992 100644
--- a/test/py/tests/test_tpm2.py
+++ b/test/py/tests/test_tpm2.py
@@ -41,11 +41,9 @@ def force_init(u_boot_console, force=False):
skip_test = u_boot_console.config.env.get('env__tpm_device_test_skip', False)
if skip_test:
pytest.skip('skip TPM device test')
- output = u_boot_console.run_command('tpm2 init')
+ output = u_boot_console.run_command('tpm2 autostart')
if force or not 'Error' in output:
u_boot_console.run_command('echo --- start of init ---')
- u_boot_console.run_command('tpm2 startup TPM2_SU_CLEAR')
- u_boot_console.run_command('tpm2 self_test full')
u_boot_console.run_command('tpm2 clear TPM2_RH_LOCKOUT')
output = u_boot_console.run_command('echo $?')
if not output.endswith('0'):
@@ -83,20 +81,13 @@ def tpm2_sandbox_init(u_boot_console):
This allows all tests to run in parallel, since no test depends on another.
"""
u_boot_console.restart_uboot()
- u_boot_console.run_command('tpm2 init')
+ u_boot_console.run_command('tpm2 autostart')
output = u_boot_console.run_command('echo $?')
assert output.endswith('0')
skip_test = u_boot_console.config.env.get('env__tpm_device_test_skip', False)
if skip_test:
pytest.skip('skip TPM device test')
- u_boot_console.run_command('tpm2 startup TPM2_SU_CLEAR')
- output = u_boot_console.run_command('echo $?')
- assert output.endswith('0')
-
- u_boot_console.run_command('tpm2 self_test full')
- output = u_boot_console.run_command('echo $?')
- assert output.endswith('0')
@pytest.mark.buildconfigspec('cmd_tpm_v2')
def test_tpm2_sandbox_self_test_full(u_boot_console):
@@ -281,6 +272,12 @@ def test_tpm2_pcr_extend(u_boot_console):
force_init(u_boot_console)
ram = u_boot_utils.find_ram_base(u_boot_console)
+ read_pcr = u_boot_console.run_command('tpm2 pcr_read 0 0x%x' % (ram + 0x20))
+ output = u_boot_console.run_command('echo $?')
+ assert output.endswith('0')
+ str = re.findall(r'\d+ known updates', read_pcr)[0]
+ updates = int(re.findall(r'\d+', str)[0])
+
u_boot_console.run_command('tpm2 pcr_extend 0 0x%x' % ram)
output = u_boot_console.run_command('echo $?')
assert output.endswith('0')