From 82b3f4cb46ce8ef49b6b887233be0b409056d6c4 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Vincent=20Stehl=C3=A9?= <vincent.stehle@arm.com>
Date: Tue, 31 May 2022 09:55:33 +0200
Subject: [PATCH] test/py: efi_capsule: repair image authentication test
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

Repair the python tests for authenticated EFI capsules, which can be run
with sandbox_defconfig plus CONFIG_EFI_CAPSULE_AUTHENTICATE=y.

- Account for the reset changes done by commit 3e6f81000672 ("efi_loader:
  test/py: Reset system after capsule update on disk").
- Fix the capsule GUID typo introduced by commit 2e9c3c6965ba ("test:
  capsule: Modify the capsule tests to use GUID values for sandbox").

Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 test/py/tests/test_efi_capsule/conftest.py                  | 4 ++--
 .../tests/test_efi_capsule/test_capsule_firmware_signed.py  | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/test/py/tests/test_efi_capsule/conftest.py b/test/py/tests/test_efi_capsule/conftest.py
index d757415c88..5a8826a5a6 100644
--- a/test/py/tests/test_efi_capsule/conftest.py
+++ b/test/py/tests/test_efi_capsule/conftest.py
@@ -101,7 +101,7 @@ def efi_capsule_data(request, u_boot_config):
             check_call('cd %s; '
                        '%s/tools/mkeficapsule --index 1 --monotonic-count 1 '
                             '--private-key SIGNER.key --certificate SIGNER.crt '
-                            '--guid 09D7DF52-0720-4710-91D1-08469B7FE9C8 '
+                            '--guid 09D7CF52-0720-4710-91D1-08469B7FE9C8 '
                             'u-boot.bin.new Test11'
                        % (data_dir, u_boot_config.build_dir),
                        shell=True)
@@ -110,7 +110,7 @@ def efi_capsule_data(request, u_boot_config):
                        '%s/tools/mkeficapsule --index 1 --monotonic-count 1 '
                             '--private-key SIGNER2.key '
                             '--certificate SIGNER2.crt '
-                            '--guid 09D7DF52-0720-4710-91D1-08469B7FE9C8 '
+                            '--guid 09D7CF52-0720-4710-91D1-08469B7FE9C8 '
                             'u-boot.bin.new Test12'
                        % (data_dir, u_boot_config.build_dir),
                        shell=True)
diff --git a/test/py/tests/test_efi_capsule/test_capsule_firmware_signed.py b/test/py/tests/test_efi_capsule/test_capsule_firmware_signed.py
index 593b032e90..a0b6a1ac86 100644
--- a/test/py/tests/test_efi_capsule/test_capsule_firmware_signed.py
+++ b/test/py/tests/test_efi_capsule/test_capsule_firmware_signed.py
@@ -85,7 +85,7 @@ class TestEfiCapsuleFirmwareSigned(object):
 
                 # need to run uefi command to initiate capsule handling
                 output = u_boot_console.run_command(
-                    'env print -e Capsule0000')
+                    'env print -e Capsule0000', wait_for_reboot = True)
 
             output = u_boot_console.run_command_list([
                 'host bind 0 %s' % disk_img,
@@ -160,7 +160,7 @@ class TestEfiCapsuleFirmwareSigned(object):
 
                 # need to run uefi command to initiate capsule handling
                 output = u_boot_console.run_command(
-                    'env print -e Capsule0000')
+                    'env print -e Capsule0000', wait_for_reboot = True)
 
             # deleted any way
             output = u_boot_console.run_command_list([
@@ -237,7 +237,7 @@ class TestEfiCapsuleFirmwareSigned(object):
 
                 # need to run uefi command to initiate capsule handling
                 output = u_boot_console.run_command(
-                    'env print -e Capsule0000')
+                    'env print -e Capsule0000', wait_for_reboot = True)
 
             # deleted any way
             output = u_boot_console.run_command_list([
-- 
2.39.5