forked from OERV-BSP/u-boot
tpm: Convert sandbox-focussed tests to C
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 fully initializes the TPM and performs the self tests. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
This commit is contained in:
committed by
Ilias Apalodimas
parent
1f144b6174
commit
edc4bfd2e3
@@ -56,7 +56,7 @@ def is_sandbox(ubman):
|
||||
return sys_arch == 'sandbox'
|
||||
|
||||
@pytest.mark.buildconfigspec('cmd_tpm_v2')
|
||||
def test_tpm2_init(ubman):
|
||||
def test_tpm2_autostart(ubman):
|
||||
"""Init the software stack to use TPMv2 commands."""
|
||||
skip_test = ubman.config.env.get('env__tpm_device_test_skip', False)
|
||||
if skip_test:
|
||||
@@ -65,19 +65,6 @@ def test_tpm2_init(ubman):
|
||||
output = ubman.run_command('echo $?')
|
||||
assert output.endswith('0')
|
||||
|
||||
@pytest.mark.buildconfigspec('cmd_tpm_v2')
|
||||
def test_tpm2_startup(ubman):
|
||||
"""Execute a TPM2_Startup command.
|
||||
|
||||
Initiate the TPM internal state machine.
|
||||
"""
|
||||
skip_test = ubman.config.env.get('env__tpm_device_test_skip', False)
|
||||
if skip_test:
|
||||
pytest.skip('skip TPM device test')
|
||||
ubman.run_command('tpm2 startup TPM2_SU_CLEAR')
|
||||
output = ubman.run_command('echo $?')
|
||||
assert output.endswith('0')
|
||||
|
||||
def tpm2_sandbox_init(ubman):
|
||||
"""Put sandbox back into a known state so we can run a test
|
||||
|
||||
@@ -92,29 +79,6 @@ def tpm2_sandbox_init(ubman):
|
||||
if skip_test:
|
||||
pytest.skip('skip TPM device test')
|
||||
|
||||
@pytest.mark.buildconfigspec('cmd_tpm_v2')
|
||||
def test_tpm2_sandbox_self_test_full(ubman):
|
||||
"""Execute a TPM2_SelfTest (full) command.
|
||||
|
||||
Ask the TPM to perform all self tests to also enable full capabilities.
|
||||
"""
|
||||
if is_sandbox(ubman):
|
||||
ubman.restart_uboot()
|
||||
ubman.run_command('tpm2 autostart')
|
||||
output = ubman.run_command('echo $?')
|
||||
assert output.endswith('0')
|
||||
|
||||
ubman.run_command('tpm2 startup TPM2_SU_CLEAR')
|
||||
output = ubman.run_command('echo $?')
|
||||
assert output.endswith('0')
|
||||
|
||||
skip_test = ubman.config.env.get('env__tpm_device_test_skip', False)
|
||||
if skip_test:
|
||||
pytest.skip('skip TPM device test')
|
||||
ubman.run_command('tpm2 self_test full')
|
||||
output = ubman.run_command('echo $?')
|
||||
assert output.endswith('0')
|
||||
|
||||
@pytest.mark.buildconfigspec('cmd_tpm_v2')
|
||||
def test_tpm2_continue_self_test(ubman):
|
||||
"""Execute a TPM2_SelfTest (continued) command.
|
||||
|
||||
Reference in New Issue
Block a user