forked from os-autoinst/os-autoinst-distri-opensuse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
grub_test.pm
103 lines (86 loc) · 3.16 KB
/
grub_test.pm
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
# SUSE's openQA tests
#
# Copyright © 2009-2013 Bernhard M. Wiedemann
# Copyright © 2012-2019 SUSE LLC
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.
# Summary: Handle grub menu after reboot
# Tags: poo#9716, poo#10286, poo#10164
# Maintainer: Martin Kravec <mkravec@suse.com>
use strict;
use warnings;
use base "opensusebasetest";
use testapi;
use utils;
use version_utils 'is_sle';
use bootloader_setup qw(stop_grub_timeout boot_into_snapshot);
=head2 handle_installer_medium_bootup
Due to pre-installation setup, qemu boot order is always booting from CD-ROM.
=cut
sub handle_installer_medium_bootup {
my ($self) = @_;
return unless (check_var("BOOTFROM", "d") || (get_var('UEFI') && get_var('USBBOOT')));
assert_screen 'inst-bootmenu';
if (check_var("BOOTFROM", "d") && check_var("AUTOUPGRADE") && check_var("PATCH")) {
assert_screen 'grub2';
}
send_key_until_needlematch 'inst-bootmenu-boot-harddisk', 'up';
send_key 'ret';
# use firmware boot manager of aarch64 to boot upgraded system
$self->handle_uefi_boot_disk_workaround if (check_var('ARCH', 'aarch64'));
}
sub bug_workaround_bsc1005313 {
record_soft_failure "Running with plymouth:debug to catch bsc#1005313" if get_var('PLYMOUTH_DEBUG');
send_key 'e';
# Move to end of kernel boot parameters line
send_key_until_needlematch "linux-line-selected", "down";
send_key "end";
assert_screen "linux-line-matched";
if (get_var('PLYMOUTH_DEBUG')) {
# remove "splash=silent quiet showopts"
for (1 .. 28) { send_key "backspace" }
type_string 'plymouth:debug';
}
type_string " " . get_var('GRUB_KERNEL_OPTION_APPEND') if get_var('GRUB_KERNEL_OPTION_APPEND');
save_screenshot;
send_key 'ctrl-x';
}
sub run {
my ($self) = @_;
my $timeout = get_var('GRUB_TIMEOUT', 90);
$self->handle_installer_medium_bootup;
workaround_type_encrypted_passphrase;
# 60 due to rare slowness e.g. multipath poo#11908
# 90 as a workaround due to the qemu backend fallout
# If grub timeout was not disabled, we wait for linux-login instead
check_screen ['grub2', 'displaymanager', 'linux-login'], 120;
if (match_has_tag('displaymanager') or match_has_tag('linux-login')) {
record_soft_failure("poo#49751 - Grub2 not found, because system has already booted");
}
elsif (match_has_tag 'grub2')
{
stop_grub_timeout;
boot_into_snapshot if get_var("BOOT_TO_SNAPSHOT");
send_key_until_needlematch("bootmenu-xen-kernel", 'down', 10, 5) if get_var('XEN');
if ((check_var('ARCH', 'aarch64') && is_sle && get_var('PLYMOUTH_DEBUG'))
|| get_var('GRUB_KERNEL_OPTION_APPEND'))
{
$self->bug_workaround_bsc1005313 unless get_var("BOOT_TO_SNAPSHOT");
}
else {
# avoid timeout for booting to HDD
send_key 'ret';
}
}
else
{
die 'Neither grub, nor system found';
}
}
sub test_flags {
return {fatal => 1};
}
1;