[PATCH 2/3] tpm: Convert sandbox-focussed tests to C
Tom Rini
trini at konsulko.com
Sun Oct 29 15:33:34 CET 2023
On Sun, Oct 29, 2023 at 05:28:13PM +1300, Simon Glass wrote:
> Some of the Python tests are a pain because they don't reset the TPM
> state before each test. Driver model tests do this, so convert the
> tests to C.
>
> This means that these tests won't run on real hardware, but we have
> tests which do TPM init, so there is still enough coverage.
>
> Rename and update the Python tpm_init test to use 'tpm autostart',
> since this deals with starting up ready for the tests below.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
I worry that we're removing maybe a few too many of the tests we can be
used on real HW (and QEMU, another real use case) in favor of just
testing them on sandbox. We can certainly have parallel sandbox-only
test paths.
[snip]
> @@ -92,46 +79,6 @@ def tpm2_sandbox_init(u_boot_console):
> if skip_test:
> pytest.skip('skip TPM device test')
>
> - at pytest.mark.buildconfigspec('cmd_tpm_v2')
> -def test_tpm2_sandbox_self_test_full(u_boot_console):
> - """Execute a TPM2_SelfTest (full) command.
> -
> - Ask the TPM to perform all self tests to also enable full capabilities.
> - """
> - if is_sandbox(u_boot_console):
> - u_boot_console.restart_uboot()
> - u_boot_console.run_command('tpm2 init')
> - output = u_boot_console.run_command('echo $?')
> - assert output.endswith('0')
> -
> - u_boot_console.run_command('tpm2 startup TPM2_SU_CLEAR')
> - 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 self_test full')
> - output = u_boot_console.run_command('echo $?')
> - assert output.endswith('0')
> -
> - at pytest.mark.buildconfigspec('cmd_tpm_v2')
> -def test_tpm2_continue_self_test(u_boot_console):
> - """Execute a TPM2_SelfTest (continued) command.
> -
> - Ask the TPM to finish its self tests (alternative to the full test) in order
> - to enter a fully operational state.
> - """
> -
> - skip_test = u_boot_console.config.env.get('env__tpm_device_test_skip', False)
> - if skip_test:
> - pytest.skip('skip TPM device test')
> - if is_sandbox(u_boot_console):
> - tpm2_sandbox_init(u_boot_console)
> - u_boot_console.run_command('tpm2 self_test continue')
> - output = u_boot_console.run_command('echo $?')
> - assert output.endswith('0')
> -
I would think these are useful cases to check outside of sandbox. But
I'll let Ilias chime in as I'm just assuming.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20231029/05112751/attachment.sig>
More information about the U-Boot
mailing list