Skip to content

Commit 7c33698

Browse files
committed
Testsuite: T9214: fix GRUB auto-boot race in console-select navigation
Commit 2d525e9 ("Testsuite: T9099: harden GRUB console-select navigation with expect() check") added expect() checks after each GRUB submenu transition in BOOTLOADERchooseSerialConsole(), but did not fix the underlying race it described: on the installed system, BOOTLOADER_LOAD_TMO (5s) is slept before the first KEY_DOWN is sent, while that system's top-level GRUB menu auto-boots its default entry after the same 5s with no margin. Under host load the countdown could win, so GRUB booted straight past "Boot options" and the new child.expect('Select console type', ...) then blocked for the full BOOTLOADER_TMO waiting for text that would never appear. Send the first navigation key immediately after the GRUB banner is detected instead of sleeping first, so the auto-boot countdown is cancelled right away rather than raced against.
1 parent aee889f commit 7c33698

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

scripts/check-qemu-install

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -595,12 +595,18 @@ def BOOTLOADERchooseSerialConsole(child, live: bool) -> None:
595595

596596
# Wait for GRUB
597597
child.expect(GRUB_STRING, timeout=BOOTLOADER_TMO)
598-
time.sleep(BOOTLOADER_LOAD_TMO)
599598

599+
# Unlike the live ISO menus (10s timeout), the installed system's
600+
# top-level menu auto-boots its default entry after ~BOOTLOADER_LOAD_TMO
601+
# seconds - the same delay this script would otherwise sleep before
602+
# sending any key. Under host load that leaves no margin: GRUB can
603+
# auto-boot before "Boot options" is ever selected. Send the first
604+
# navigation key immediately to cancel the countdown, then give the
605+
# screen time to settle.
600606
# Select GRUB serial console
601607
# Boot options
602608
child.send(KEY_DOWN)
603-
time.sleep(BOOTLOADER_SLEEP)
609+
time.sleep(BOOTLOADER_LOAD_TMO)
604610
child.send(KEY_RETURN)
605611
time.sleep(BOOTLOADER_SLEEP)
606612
# GRUB submenus never time out on their own, so confirm we actually

0 commit comments

Comments
 (0)