All of lore.kernel.org
 help / color / mirror / Atom feed
From: T Karthik Reddy <tkarthik@xilinx.com>
To: T Karthik Reddy <tkarthik@xilinx.com>,
	"u-boot@lists.denx.de" <u-boot@lists.denx.de>
Cc: git-dev <git-dev@xilinx.com>
Subject: RE: [PATCH] test/py: tpm2: Skip tpm pytest based on env variable
Date: Tue, 6 Jul 2021 03:59:57 +0000	[thread overview]
Message-ID: <BY5PR02MB6739DB4131F2ED941B9FCFA8A51B9@BY5PR02MB6739.namprd02.prod.outlook.com> (raw)
In-Reply-To: <1624340962-91190-1-git-send-email-t.karthik.reddy@xilinx.com>

Hi,
	Any update on this patch?

Thanks
T Karthik

> -----Original Message-----
> From: T Karthik Reddy <t.karthik.reddy@xilinx.com>
> Sent: Tuesday, June 22, 2021 11:19 AM
> To: u-boot@lists.denx.de
> Cc: git-dev <git-dev@xilinx.com>; T Karthik Reddy <tkarthik@xilinx.com>
> Subject: [PATCH] test/py: tpm2: Skip tpm pytest based on env variable
> 
> Tpm test cases relies on tpm device setup. Provide an environment variable
> "env__tpm_device_test_skip = True" to skip the test case if tpm device is
> not present.
> Only needed will have to add variable to the py-test framework.
> Test runs successfully even this variable is absent.
> 
> Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
> ---
> 
>  test/py/tests/test_tpm2.py | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/test/py/tests/test_tpm2.py b/test/py/tests/test_tpm2.py index
> 70f906da51..bb147d4e88 100644
> --- a/test/py/tests/test_tpm2.py
> +++ b/test/py/tests/test_tpm2.py
> @@ -18,6 +18,15 @@ any password.
>  * Commands like pcr_setauthpolicy and pcr_resetauthpolicy are not
> implemented  here because they would fail the tests in most cases (TPMs do
> not implement them  and return an error).
> +
> +
> +Note:
> +This test doesn't rely on boardenv_* configuration value but can change
> +test behavior.
> +
> +* Setup env__tpm_device_test_skip to True if tests with TPM devices
> +should be skipped.
> +
>  """
> 
>  updates = 0
> @@ -29,6 +38,9 @@ def force_init(u_boot_console, force=False):
>      twice will spawn an error used to detect that the TPM was not reset and
> no
>      initialization code should be run.
>      """
> +    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')
>      if force or not 'Error' in output:
>          u_boot_console.run_command('echo --- start of init ---') @@ -44,6
> +56,10 @@ def force_init(u_boot_console, force=False):
>  def test_tpm2_init(u_boot_console):
>      """Init the software stack to use TPMv2 commands."""
> 
> +    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')
>      output = u_boot_console.run_command('echo $?')
>      assert output.endswith('0')
> @@ -55,6 +71,9 @@ def test_tpm2_startup(u_boot_console):
>      Initiate the TPM internal state machine.
>      """
> 
> +    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')
> @@ -66,6 +85,9 @@ def test_tpm2_self_test_full(u_boot_console):
>      Ask the TPM to perform all self tests to also enable full capabilities.
>      """
> 
> +    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')
> @@ -78,6 +100,9 @@ def test_tpm2_continue_self_test(u_boot_console):
>      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')
>      u_boot_console.run_command('tpm2 self_test continue')
>      output = u_boot_console.run_command('echo $?')
>      assert output.endswith('0')
> @@ -95,6 +120,9 @@ def test_tpm2_clear(u_boot_console):
>      PLATFORM hierarchies are also available.
>      """
> 
> +    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 clear TPM2_RH_LOCKOUT')
>      output = u_boot_console.run_command('echo $?')
>      assert output.endswith('0')
> --
> 2.17.1


  reply	other threads:[~2021-07-06  4:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22  5:49 [PATCH] test/py: tpm2: Skip tpm pytest based on env variable T Karthik Reddy
2021-07-06  3:59 ` T Karthik Reddy [this message]
2021-07-23 12:18 Ashok Reddy Soma
2021-08-03  6:56 ` T Karthik Reddy
2021-08-04 15:21 ` Tom Rini
2021-08-05  5:56   ` T Karthik Reddy
2021-08-05 13:22     ` Tom Rini
2021-09-17 11:49       ` T Karthik Reddy
2021-09-17 12:08         ` Tom Rini
2021-09-18  9:48           ` Ilias Apalodimas
2021-09-20 15:41             ` Michal Simek
2021-09-20 16:06               ` Ilias Apalodimas
2021-09-24 18:29 ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BY5PR02MB6739DB4131F2ED941B9FCFA8A51B9@BY5PR02MB6739.namprd02.prod.outlook.com \
    --to=tkarthik@xilinx.com \
    --cc=git-dev@xilinx.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.