Skip to content

Commit

Permalink
ktest: introduce grub2bls REBOOT_TYPE option
Browse files Browse the repository at this point in the history
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/[email protected]

Signed-off-by: Masayoshi Mizuma <[email protected]>
Signed-off-by: Steven Rostedt (VMware) <[email protected]>
  • Loading branch information
mmizuma authored and rostedt committed May 10, 2019
1 parent 3889139 commit ac24664
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions tools/testing/ktest/ktest.pl
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"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,
Expand Down Expand Up @@ -125,6 +126,7 @@
my $grub_file;
my $grub_number;
my $grub_reboot;
my $grub_bls_get;
my $syslinux;
my $syslinux_path;
my $syslinux_label;
Expand Down Expand Up @@ -295,6 +297,7 @@
"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,
Expand Down Expand Up @@ -440,7 +443,7 @@
;
$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
Expand All @@ -454,6 +457,8 @@
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
Expand All @@ -479,6 +484,9 @@
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"
Expand Down Expand Up @@ -695,7 +703,7 @@ sub get_mandatory_configs {
}
}

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

Expand Down Expand Up @@ -1965,6 +1973,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;
}
Expand Down Expand Up @@ -4324,7 +4336,7 @@ sub cancel_test {

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));
Expand Down

0 comments on commit ac24664

Please sign in to comment.