[Concept,4/4] test: Deal with the silent menu in grub

Message ID 20250923193833.1506358-4-sjg@u-boot.org
State New
Headers
Series [Concept,1/4] colibri-imx8x: Increase the boot delay |

Commit Message

Simon Glass Sept. 23, 2025, 7:38 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

The distro test for EFI in the EFI ARM app is currently flaky.

If the test does not send an 'escape' character, then the board may boot
straight into Ubuntu. If it does, but didn't need to, then grub sits at
the command prompt.

Handle this by pressing escape twice (which should always go to the grub
command line), then using the 'normal' command to start the menu.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 test/py/tests/test_distro.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
  

Patch

diff --git a/test/py/tests/test_distro.py b/test/py/tests/test_distro.py
index cc4aa265d90..d9bc9b18648 100644
--- a/test/py/tests/test_distro.py
+++ b/test/py/tests/test_distro.py
@@ -106,13 +106,21 @@  def test_distro_arm_app_efi(ubman):
             ["Booting bootflow 'efi_media_1.bootdev.part_1' with efi"])
 
         # Press Escape to force GRUB to appear, even if the silent menu was
-        # enabled by a previous boot
+        # enabled by a previous boot. If the menu is already set to appear, this
+        # will exit to the grub> prompt
+        ubman.send('\x1b')
+
+        # Press Escape again, to force it to the grub> prompt
         ubman.send('\x1b')
 
     # Wait until we see the editor appear
     with ubman.log.section('grub'):
-        ubman.expect(['ESC to return previous'])
-        # ubman.expect(['The highlighted entry will be executed automatically in 29s'])
+        ubman.expect(['grub>'])
+
+        ubman.run_command('normal', wait_for_prompt=False)
+
+        # exp = ubman.expect(['ESC to return previous', 'grub>'])
+        ubman.expect(['The highlighted entry will be executed automatically in'])
 
         # Press 'e' to edit the command line
         ubman.log.info("Pressing 'e'")