Skip to content

Commit

Permalink
test/py: always use autostart on tpm2 selftests
Browse files Browse the repository at this point in the history
commit 789ed27 ("test/py: replace 'tpm2 init, startup, selftest' sequences")
changed some of the tpm2 init sequences to 'tpm2 autostart' instead of
calling 'tpm init', 'tpm startup TPM2_SU_CLEAR', 'tpm2 self_test full'.

The autostart command calls the afforementioned sequence and on top of
that deals with the 'tpm2 init' return codes if the tpm is already
started. Since we initialize the tpm from various subsystems now,
replace the last remaining instances of 'tpm2 init' with 'tpm2
autostart'.  Since the latter calls 'tpm2 init' anyway we will still be
implicitly testing the validity of that command

It's worth noting that since 'tpm2 autostart' performs the startup and
self tests sequences of the tpm we could drop
'test_tpm2_sandbox_self_test_full' and 'test_tpm2_startup, but let's
keep the since they test tpm commands and options

Signed-off-by: Ilias Apalodimas <[email protected]>
  • Loading branch information
apalos committed Oct 27, 2023
1 parent 539e2f7 commit 4fd7d27
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/py/tests/test_tpm2.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def test_tpm2_init(u_boot_console):
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 init')
u_boot_console.run_command('tpm2 autostart')
output = u_boot_console.run_command('echo $?')
assert output.endswith('0')

Expand Down Expand Up @@ -100,7 +100,7 @@ def test_tpm2_sandbox_self_test_full(u_boot_console):
"""
if is_sandbox(u_boot_console):
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')

Expand Down

0 comments on commit 4fd7d27

Please sign in to comment.