Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | # SPDX-License-Identifier: GPL-2.0+ # Copyright 2025 Canonical Ltd. # Written by Simon Glass <simon.glass@canonical.com> import pytest import utils # Enable early console so that the test can see if something goes wrong CONSOLE = 'earlycon=uart8250,io,0x3f8 console=uart8250,io,0x3f8' @pytest.mark.boardspec('qemu-x86_64') @pytest.mark.role('qemu-x86_64') def test_distro(ubman): """Test booting into Ubuntu 24.04""" with ubman.log.section('boot'): ubman.run_command('boot', wait_for_prompt=False) with ubman.log.section('Grub'): # Wait for grub to come up and offset a menu ubman.expect(['Try or Install Ubuntu']) # Press 'e' to edit the command line ubman.log.info("Pressing 'e'") ubman.run_command('e', wait_for_prompt=False, send_nl=False) # Wait until we see the editor appear ubman.expect(['/casper/initrd']) # Go down to the 'linux' line. Avoid using down-arrow as that includes # an Escape character, which may be parsed by Grub as such, causing it # to return to the top menu ubman.log.info("Going DOWN") ubman.ctrl('N') ubman.ctrl('N') ubman.ctrl('N') # Go to end of line ubman.log.info("Going to EOL") ubman.ctrl('E') # Backspace to remove 'quiet splash' ubman.log.info("Erasing quiet and splash") ubman.send('\b' * len('quiet splash')) # Send our noisy console ubman.log.info("Noisy console") ubman.send(CONSOLE) # Tell grub to boot ubman.log.info("boot") ubman.ctrl('X') ubman.expect(['Booting a command list']) with ubman.log.section('Linux'): # Linux should start immediately ubman.expect(['Linux version']) with ubman.log.section('Ubuntu'): # Shortly later, we should see this banner ubman.expect(['Welcome to .*Ubuntu 24.04.1 LTS.*!']) ubman.restart_uboot() @pytest.mark.boardspec('colibri-imx8x') @pytest.mark.role('colibrimx8') def test_distro_script(ubman): """Test that a selected board can boot into Llinux using a script""" with ubman.log.section('boot'): ubman.run_command('boot', wait_for_prompt=False) # This is the start of userspace ubman.expect(['Welcome to TDX Wayland']) # Shortly later, we should see this banner ubman.expect(['Colibri-iMX8X_Reference-Multimedia-Image']) ubman.restart_uboot() @pytest.mark.boardspec('efi-arm_app64') @pytest.mark.role('efi-aarch64') def test_distro_arm_app_extlinux(ubman): """Test that the ARM EFI app can boot into Ubuntu 25.04 via extlinux""" with ubman.log.section('boot'): ubman.run_command('bootmeth order extlinux') ubman.run_command('boot', wait_for_prompt=False) ubman.expect(["Booting bootflow 'efi_media_1.bootdev.part_2' with extlinux"]) ubman.expect(['Exiting EFI']) ubman.expect(['Booting Linux on physical CPU']) with ubman.log.section('initrd'): ubman.expect(['Starting systemd-udevd']) ubman.expect(['Welcome to Ubuntu 25.04!']) ubman.restart_uboot() @pytest.mark.boardspec('efi-arm_app64') @pytest.mark.role('efi-aarch64') def test_distro_arm_app_efi(ubman): """Test that the ARM EFI app can boot into Ubuntu 25.04 via EFI""" with ubman.log.section('boot'): ubman.run_command('bootmeth order efi') ubman.run_command('boot', wait_for_prompt=False) ubman.expect( ["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. 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(['grub>']) ubman.run_command('normal', wait_for_prompt=False) ubman.expect(['ESC to return previous']) # Press 'e' to edit the command line ubman.log.info("Pressing 'e'") ubman.send('e') for _ in range(10): ubman.ctrl('N') expected = '\tlinux\t/boot/vmlinuz-6.14.0-27-generic ' expected += 'root=UUID=e5665fb4-e1de-4335-86da-357ad5422319 ro ' for _ in expected: ubman.ctrl('F') to_erase = 'quiet splash' for _ in to_erase: ubman.ctrl('D') ubman.ctrl('X') ubman.expect(['Booting a command list']) with ubman.log.section('exit boot-services'): ubman.expect(['EFI stub: Exiting boot services...']) ubman.log.info("boot") ubman.expect(['Booting Linux on physical CPU']) with ubman.log.section('initrd'): ubman.expect(['Freeing initrd memory:']) ubman.expect(['Run /init as init process']) with ubman.temporary_timeout(200 * 1000): ubman.expect(['Ubuntu 25.04 qarm ttyAMA0']) ubman.restart_uboot() |