
From: Simon Glass <sjg@chromium.org> EFI capsule updates cause a reboot of U-Boot on startup. This is the only case of this behaviour, so create a separate function for it, rather than having a parameter for the function that every board uses. This will make it easier to adjust how restart_uboot() works. Signed-off-by: Simon Glass <sjg@chromium.org> --- test/py/console_base.py | 13 +++++++++++-- test/py/console_sandbox.py | 2 +- .../test_efi_capsule/test_capsule_firmware_fit.py | 10 ++++++++-- .../test_efi_capsule/test_capsule_firmware_raw.py | 5 ++++- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/test/py/console_base.py b/test/py/console_base.py index 56201052283..3e8f2cda1c6 100644 --- a/test/py/console_base.py +++ b/test/py/console_base.py @@ -542,10 +542,19 @@ class ConsoleBase(object): pass self.p = None - def restart_uboot(self, expect_reset=False): + def restart_uboot(self): """Shut down and restart U-Boot.""" self.cleanup_spawn() - self.ensure_spawned(expect_reset) + self.ensure_spawned(False) + + def restart_and_expect_reset(self): + """Shut down and restart U-Boot, expecting it to reset itself! + + The reset is itself expected to cause another reset after the U-Boot + banner appears + """ + self.cleanup_spawn() + self.ensure_spawned(True) def get_spawn_output(self): """Return the start-up output from U-Boot diff --git a/test/py/console_sandbox.py b/test/py/console_sandbox.py index dd721067f8f..5430323b6f1 100644 --- a/test/py/console_sandbox.py +++ b/test/py/console_sandbox.py @@ -74,7 +74,7 @@ class ConsoleSandbox(ConsoleBase): try: self.sandbox_flags = flags self.use_dtb = use_dtb - return self.restart_uboot(False) + return self.restart_uboot() finally: self.sandbox_flags = [] self.use_dtb = True diff --git a/test/py/tests/test_efi_capsule/test_capsule_firmware_fit.py b/test/py/tests/test_efi_capsule/test_capsule_firmware_fit.py index 016274533cd..71c2c47f1f9 100644 --- a/test/py/tests/test_efi_capsule/test_capsule_firmware_fit.py +++ b/test/py/tests/test_efi_capsule/test_capsule_firmware_fit.py @@ -58,7 +58,10 @@ class TestEfiCapsuleFirmwareFit(): 'config_efi_capsule_on_disk_early') # reboot - ubman.restart_uboot(expect_reset = capsule_early) + if capsule_early: + ubman.restart_and_expect_reset() + else: + ubman.restart_uboot() with ubman.log.section('Test Case 1-b, after reboot'): if not capsule_early: @@ -92,7 +95,10 @@ class TestEfiCapsuleFirmwareFit(): 'config_efi_capsule_authenticate') # reboot - ubman.restart_uboot(expect_reset = capsule_early) + if capsule_early: + ubman.restart_and_expect_reset() + else: + ubman.restart_uboot() with ubman.log.section('Test Case 2-b, after reboot'): if not capsule_early: diff --git a/test/py/tests/test_efi_capsule/test_capsule_firmware_raw.py b/test/py/tests/test_efi_capsule/test_capsule_firmware_raw.py index b8cb483b380..8f548ca4d5a 100644 --- a/test/py/tests/test_efi_capsule/test_capsule_firmware_raw.py +++ b/test/py/tests/test_efi_capsule/test_capsule_firmware_raw.py @@ -133,7 +133,10 @@ class TestEfiCapsuleFirmwareRaw: 'config_efi_capsule_authenticate') # reboot - ubman.restart_uboot(expect_reset = capsule_early) + if capsule_early: + ubman.restart_and_expect_reset() + else: + ubman.restart_uboot() with ubman.log.section('Test Case 3-b, after reboot'): if not capsule_early: -- 2.43.0