diff mbox series

[v10,09/10] test/py: only run 'tpm2 autostart' to init the tpm

Message ID 20230807151735.84093-10-eajames@linux.ibm.com
State New
Headers show
Series None | expand

Commit Message

Eddie James Aug. 7, 2023, 3:17 p.m. UTC
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>

commit xxxxxxxx ("")
replaced the forced and sandbox tpm2 initialization running 'tpm2
autostart' instead of the startup tpm sequence.  The difference is that
the new function handles the internal tpm_init state internally and
doesn't return an error when trying to initialize the tpm multiple
times.  Replace the remaining instances

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---
 test/py/tests/test_tpm2.py | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Ilias Apalodimas Aug. 7, 2023, 4 p.m. UTC | #1
On Mon, 7 Aug 2023 at 18:17, Eddie James <eajames@linux.ibm.com> wrote:
>
> From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
>
> commit xxxxxxxx ("")
> replaced the forced and sandbox tpm2 initialization running 'tpm2
> autostart' instead of the startup tpm sequence.  The difference is that
> the new function handles the internal tpm_init state internally and
> doesn't return an error when trying to initialize the tpm multiple
> times.  Replace the remaining instances
>
> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>\

We don't need this anymore, commit 789ed2784256 ("test/py: replace
'tpm2 init, startup, selftest' sequences") should be enough.  In any
case, I'll queue this on the CI without this and make sure.

Cheers
/Ilias
> ---
>  test/py/tests/test_tpm2.py | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/test/py/tests/test_tpm2.py b/test/py/tests/test_tpm2.py
> index 8cd3046285..5bbb2d2069 100644
> --- a/test/py/tests/test_tpm2.py
> +++ b/test/py/tests/test_tpm2.py
> @@ -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')
>
> @@ -97,11 +97,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')
> -        output = u_boot_console.run_command('echo $?')
> -        assert output.endswith('0')
> -
> -        u_boot_console.run_command('tpm2 startup TPM2_SU_CLEAR')
> +        u_boot_console.run_command('tpm2 autostart')
>          output = u_boot_console.run_command('echo $?')
>          assert output.endswith('0')
>
> --
> 2.39.3
>
diff mbox series

Patch

diff --git a/test/py/tests/test_tpm2.py b/test/py/tests/test_tpm2.py
index 8cd3046285..5bbb2d2069 100644
--- a/test/py/tests/test_tpm2.py
+++ b/test/py/tests/test_tpm2.py
@@ -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')
 
@@ -97,11 +97,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')
-        output = u_boot_console.run_command('echo $?')
-        assert output.endswith('0')
-
-        u_boot_console.run_command('tpm2 startup TPM2_SU_CLEAR')
+        u_boot_console.run_command('tpm2 autostart')
         output = u_boot_console.run_command('echo $?')
         assert output.endswith('0')