diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-10-05 20:50:14 +0200 |
|---|---|---|
| committer | Christian Breunig <christian@breunig.cc> | 2026-10-05 20:50:14 +0200 |
| commit | 1abdc8757e997bb2487b463fc3964267c1bc3de0 (patch) | |
| tree | c453c186907f115d3b0585785c92fa1266d401ef /scripts | |
| parent | c3becfea464e18a49912eb70f2923ef310d21fa6 (diff) | |
| download | vyos-build-1abdc8757e997bb2487b463fc3964267c1bc3de0.tar.gz vyos-build-1abdc8757e997bb2487b463fc3964267c1bc3de0.zip | |
smoketest: T9402: stop navigating the installed system's GRUB menu
The QEMU smoketest selected the serial console on the installed system by
sending timed arrow keys and Enter through the GRUB menus. Under host load
those keys raced the five second auto-boot countdown or got lost, so tests
failed at random.
Earlier fixes only treated symptoms. T8147 doubled the menu timeout. T9099
added checks after each submenu to fail fast. T9214 first sent the first key
earlier and then ignored a lost race on the top menu.
The installer already makes the serial console the default, and raw images
take it from the build flavor, so the default entry boots the right console.
The harness now only waits for GRUB and lets it boot. The existing console
checks still verify the setting. Live ISO menus are unchanged.
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/check-qemu-install | 70 |
1 files changed, 13 insertions, 57 deletions
diff --git a/scripts/check-qemu-install b/scripts/check-qemu-install index 08e36142..7a66e5a9 100755 --- a/scripts/check-qemu-install +++ b/scripts/check-qemu-install @@ -567,9 +567,10 @@ def toggleUEFISecureBoot(c): UEFIKeyPress(c, KEY_DOWN) UEFIKeyPress(c, KEY_RETURN) -def BOOTLOADERchooseSerialConsole(child, live: bool, log=None) -> None: - """ Select GRUB boot entry that uses the serial console. This differs - between a LIVE ISO image and an already installed system. """ +def BOOTLOADERchooseSerialConsole(child, live: bool) -> None: + """ Select the boot entry that uses the serial console on a LIVE ISO image. + An already installed system boots its default entry, which already + uses the serial console. """ BOOTLOADER_TMO = 40 BOOTLOADER_SLEEP = 1.5 BOOTLOADER_LOAD_TMO = 5 # let GRUB screen load @@ -616,58 +617,13 @@ def BOOTLOADERchooseSerialConsole(child, live: bool, log=None) -> None: # Wait for GRUB child.expect(GRUB_STRING, timeout=BOOTLOADER_TMO) - # The installed system's top-level menu auto-boots its default - # entry after ~BOOTLOADER_LOAD_TMO seconds, timed from when GRUB - # itself draws the menu - not from when this script's regex match - # on GRUB_STRING returns. Under host load the menu text can reach - # us well after that internal countdown already started, so there - # is no reliable amount of "send a key fast enough" that wins this - # race every time. - # - # That's fine to lose: the installer always answers 'S' (serial) - # to "What console should be used by default?", so the default - # entry GRUB auto-boots already targets the right console. - # waitForLogin()/loginVM(), called after this function returns, - # already tolerate landing straight on the GRUB countdown or the - # login prompt. So treat this submenu navigation as best-effort: - # if we don't land in "Boot options" in time, stop navigating and - # let the default entry (which is already auto-booting) carry on, - # instead of raising and aborting the whole test. - try: - # Select GRUB serial console - # Boot options - child.send(KEY_DOWN) - time.sleep(BOOTLOADER_LOAD_TMO) - child.send(KEY_RETURN) - time.sleep(BOOTLOADER_SLEEP) - # GRUB submenus never time out on their own, so confirm we actually - # landed on this submenu before navigating further - otherwise a - # dropped keypress leaves the VM stuck here until the login wait - # elsewhere expires - child.expect('Select console type', timeout=BOOTLOADER_TMO) - except pexpect.TIMEOUT: - if log is not None: - log.warning('GRUB auto-booted the default entry before "Boot ' - 'options" navigation completed; continuing since ' - 'the default entry already boots the serial ' - 'console selected during install') - else: - # We're inside the submenu, so a timeout past this point is a - # real navigation bug, not the auto-boot race - let it propagate. - # Select console type - child.send(KEY_DOWN) - time.sleep(BOOTLOADER_SLEEP) - child.send(KEY_RETURN) - time.sleep(BOOTLOADER_SLEEP) - child.expect(r'ttyS \(serial\)', timeout=BOOTLOADER_TMO) - - # *ttyS (serial) - child.send(KEY_DOWN) - time.sleep(BOOTLOADER_SLEEP) - child.send(KEY_RETURN) - time.sleep(BOOTLOADER_SLEEP) - # Boot - child.send(KEY_RETURN) + # Do not navigate the installed system's GRUB menu. The installer + # already made the serial console the default (we answer 'S' to + # "What console should be used by default?", raw images get it from + # the build flavor), so the default entry boots the right console. + # Steering the menu with timed keypresses raced GRUB's auto-boot + # countdown and lost keypresses under host load (T8147, T9099, + # T9214). basic_cli_tests() verifies the console settings. return None @@ -1021,7 +977,7 @@ try: log.info('Disable UEFI Secure Boot for initial installation') toggleUEFISecureBoot(c) - BOOTLOADERchooseSerialConsole(c, live=(not args.cloud_init), log=log) + BOOTLOADERchooseSerialConsole(c, live=(not args.cloud_init)) loginVM(c, log) ################################################# @@ -1191,7 +1147,7 @@ try: # Booting installed system ################################################# log.info('Booting installed system') - BOOTLOADERchooseSerialConsole(c, live=False, log=log) + BOOTLOADERchooseSerialConsole(c, live=False) ################################################# # Logging into VyOS system |
