All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] test: unit test for the EFI_TCG2_PROTOCOL
@ 2021-11-15 17:21 Heinrich Schuchardt
  2021-11-18 14:47 ` Ilias Apalodimas
  0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2021-11-15 17:21 UTC (permalink / raw)
  To: Ilias Apalodimas; +Cc: Alexander Graf, u-boot, Heinrich Schuchardt

Encapsulate the UEFI EFI_TCG2_PROTOCOL unit test in an Python test.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
This patch should be merged after

[PATCH 1/1] tpm: clear state post probing
https://lists.denx.de/pipermail/u-boot/2021-November/467308.html

[U-BOOT-TEST-HOOKS PATCH 1/1] Enable TPMv2 emulation
https://lists.denx.de/pipermail/u-boot/2021-November/467265.html
---
 test/py/tests/test_efi_selftest.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/test/py/tests/test_efi_selftest.py b/test/py/tests/test_efi_selftest.py
index 63218efbc2..08d4e40537 100644
--- a/test/py/tests/test_efi_selftest.py
+++ b/test/py/tests/test_efi_selftest.py
@@ -212,3 +212,23 @@ def test_efi_selftest_text_input_ex(u_boot_console):
     if m != 0:
         raise Exception('Failures occurred during the EFI selftest')
     u_boot_console.restart_uboot()
+
+@pytest.mark.buildconfigspec('cmd_bootefi_selftest')
+@pytest.mark.buildconfigspec('efi_tcg2_protocol')
+def test_efi_selftest_tcg2(u_boot_console):
+    """Test the EFI_TCG2 PROTOCOL
+
+    :param u_boot_console: U-Boot console
+
+    This function executes the 'tcg2' unit test.
+    """
+    u_boot_console.restart_uboot()
+    u_boot_console.run_command(cmd='setenv efi_selftest list')
+    output = u_boot_console.run_command('bootefi selftest')
+    assert '\'tcg2\'' in output
+    u_boot_console.run_command(cmd='setenv efi_selftest tcg2')
+    u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False)
+    m = u_boot_console.p.expect(['Summary: 0 failures', 'Press any key'])
+    if m != 0:
+        raise Exception('Failures occurred during the EFI selftest')
+    u_boot_console.restart_uboot()
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] test: unit test for the EFI_TCG2_PROTOCOL
  2021-11-15 17:21 [PATCH 1/1] test: unit test for the EFI_TCG2_PROTOCOL Heinrich Schuchardt
@ 2021-11-18 14:47 ` Ilias Apalodimas
  0 siblings, 0 replies; 2+ messages in thread
From: Ilias Apalodimas @ 2021-11-18 14:47 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: Alexander Graf, u-boot

On Mon, 15 Nov 2021 at 19:21, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> Encapsulate the UEFI EFI_TCG2_PROTOCOL unit test in an Python test.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
> This patch should be merged after
>
> [PATCH 1/1] tpm: clear state post probing
> https://lists.denx.de/pipermail/u-boot/2021-November/467308.html
>
> [U-BOOT-TEST-HOOKS PATCH 1/1] Enable TPMv2 emulation
> https://lists.denx.de/pipermail/u-boot/2021-November/467265.html
> ---
>  test/py/tests/test_efi_selftest.py | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> diff --git a/test/py/tests/test_efi_selftest.py b/test/py/tests/test_efi_selftest.py
> index 63218efbc2..08d4e40537 100644
> --- a/test/py/tests/test_efi_selftest.py
> +++ b/test/py/tests/test_efi_selftest.py
> @@ -212,3 +212,23 @@ def test_efi_selftest_text_input_ex(u_boot_console):
>      if m != 0:
>          raise Exception('Failures occurred during the EFI selftest')
>      u_boot_console.restart_uboot()
> +
> +@pytest.mark.buildconfigspec('cmd_bootefi_selftest')
> +@pytest.mark.buildconfigspec('efi_tcg2_protocol')
> +def test_efi_selftest_tcg2(u_boot_console):
> +    """Test the EFI_TCG2 PROTOCOL
> +
> +    :param u_boot_console: U-Boot console
> +
> +    This function executes the 'tcg2' unit test.
> +    """
> +    u_boot_console.restart_uboot()
> +    u_boot_console.run_command(cmd='setenv efi_selftest list')
> +    output = u_boot_console.run_command('bootefi selftest')
> +    assert '\'tcg2\'' in output
> +    u_boot_console.run_command(cmd='setenv efi_selftest tcg2')
> +    u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False)
> +    m = u_boot_console.p.expect(['Summary: 0 failures', 'Press any key'])
> +    if m != 0:
> +        raise Exception('Failures occurred during the EFI selftest')
> +    u_boot_console.restart_uboot()
> --
> 2.32.0
>

Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-18 14:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 17:21 [PATCH 1/1] test: unit test for the EFI_TCG2_PROTOCOL Heinrich Schuchardt
2021-11-18 14:47 ` Ilias Apalodimas

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.