diff options
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/check-qemu-install | 74 |
1 files changed, 16 insertions, 58 deletions
diff --git a/scripts/check-qemu-install b/scripts/check-qemu-install index a9a5aa97..49cd3d54 100755 --- a/scripts/check-qemu-install +++ b/scripts/check-qemu-install @@ -585,9 +585,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 @@ -634,58 +635,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 @@ -1039,7 +995,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) if args.secure_boot_test and not sb_custom_ca: @@ -1144,7 +1100,9 @@ try: c.expect('\nWhich file would you like as boot config?.*') c.sendline('') - c.expect(op_mode_prompt) + # GRUB installation and unmounting (flushing the copied squashfs to disk) + # can take longer than the default pexpect timeout on large images + c.expect(op_mode_prompt, timeout=300) if sb_custom_ca: c.sendline('install mok') @@ -1213,7 +1171,7 @@ try: # Booting installed system ################################################# log.info('Booting installed system') - BOOTLOADERchooseSerialConsole(c, live=False, log=log) + BOOTLOADERchooseSerialConsole(c, live=False) ################################################# # Logging into VyOS system |
