Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c58383a2 authored by Masayoshi Mizuma's avatar Masayoshi Mizuma Committed by Greg Kroah-Hartman
Browse files

ktest: introduce grub2bls REBOOT_TYPE option

[ Upstream commit ac2466456eaa0ff9b8cf647c4c52832024bc929f ]

Fedora 30 introduces Boot Loader Specification (BLS),
it changes around grub entry configuration.

kernel entries aren't in grub.cfg. We can get the entries
by "grubby --info=ALL" command.

Introduce grub2bls as REBOOT_TYPE option for BLS.

Link: http://lkml.kernel.org/r/20190509213647.6276-4-msys.mizuma@gmail.com



Signed-off-by: default avatarMasayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
Stable-dep-of: 26df05a8c142 ("kest.pl: Fix grub2 menu handling for rebooting")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 42fe7856
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ my %default = (
    "STOP_TEST_AFTER"		=> 600,
    "MAX_MONITOR_WAIT"		=> 1800,
    "GRUB_REBOOT"		=> "grub2-reboot",
    "GRUB_BLS_GET"		=> "grubby --info=ALL",
    "SYSLINUX"			=> "extlinux",
    "SYSLINUX_PATH"		=> "/boot/extlinux",
    "CONNECT_TIMEOUT"		=> 25,
@@ -123,6 +124,7 @@ my $last_grub_menu;
my $grub_file;
my $grub_number;
my $grub_reboot;
my $grub_bls_get;
my $syslinux;
my $syslinux_path;
my $syslinux_label;
@@ -292,6 +294,7 @@ my %option_map = (
    "GRUB_MENU"			=> \$grub_menu,
    "GRUB_FILE"			=> \$grub_file,
    "GRUB_REBOOT"		=> \$grub_reboot,
    "GRUB_BLS_GET"		=> \$grub_bls_get,
    "SYSLINUX"			=> \$syslinux,
    "SYSLINUX_PATH"		=> \$syslinux_path,
    "SYSLINUX_LABEL"		=> \$syslinux_label,
@@ -437,7 +440,7 @@ EOF
    ;
$config_help{"REBOOT_TYPE"} = << "EOF"
 Way to reboot the box to the test kernel.
 Only valid options so far are "grub", "grub2", "syslinux", and "script".
 Only valid options so far are "grub", "grub2", "grub2bls", "syslinux", and "script".

 If you specify grub, it will assume grub version 1
 and will search in /boot/grub/menu.lst for the title \$GRUB_MENU
@@ -451,6 +454,8 @@ $config_help{"REBOOT_TYPE"} = << "EOF"
 If you specify grub2, then you also need to specify both \$GRUB_MENU
 and \$GRUB_FILE.

 If you specify grub2bls, then you also need to specify \$GRUB_MENU.

 If you specify syslinux, then you may use SYSLINUX to define the syslinux
 command (defaults to extlinux), and SYSLINUX_PATH to specify the path to
 the syslinux install (defaults to /boot/extlinux). But you have to specify
@@ -476,6 +481,9 @@ $config_help{"GRUB_MENU"} = << "EOF"
 menu must be a non-nested menu. Add the quotes used in the menu
 to guarantee your selection, as the first menuentry with the content
 of \$GRUB_MENU that is found will be used.

 For grub2bls, \$GRUB_MENU is searched on the result of \$GRUB_BLS_GET
 command for the lines that begin with "title".
EOF
    ;
$config_help{"GRUB_FILE"} = << "EOF"
@@ -692,7 +700,7 @@ sub get_mandatory_configs {
	}
    }

    if ($rtype eq "grub") {
    if (($rtype eq "grub") or ($rtype eq "grub2bls")) {
	get_mandatory_config("GRUB_MENU");
    }

@@ -1944,6 +1952,10 @@ sub get_grub_index {
	$command = "cat $grub_file";
	$target = '^menuentry.*' . $grub_menu_qt;
	$skip = '^menuentry\s|^submenu\s';
    } elsif ($reboot_type eq "grub2bls") {
        $command = $grub_bls_get;
        $target = '^title=.*' . $grub_menu_qt;
        $skip = '^title=';
    } else {
	return;
    }
@@ -4307,7 +4319,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {

    if (!$buildonly) {
	$target = "$ssh_user\@$machine";
	if ($reboot_type eq "grub") {
	if (($reboot_type eq "grub") or ($reboot_type eq "grub2bls")) {
	    dodie "GRUB_MENU not defined" if (!defined($grub_menu));
	} elsif ($reboot_type eq "grub2") {
	    dodie "GRUB_MENU not defined" if (!defined($grub_menu));