Skip to content

Commit

Permalink
ktest: Fail when grub menu not found
Browse files Browse the repository at this point in the history
Currently if the grub menu that is supplied is not found, it will
just boot into the last grub menu in menu.lst. Fail instead of
confusing the user why their kernel is not booting.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed Oct 17, 2011
1 parent 2728be4 commit eaa1fe2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tools/testing/ktest/ktest.pl
Original file line number Diff line number Diff line change
Expand Up @@ -862,9 +862,12 @@ sub get_grub_index {
open(IN, "$ssh_grub |")
or die "unable to get menu.lst";

my $found = 0;

while (<IN>) {
if (/^\s*title\s+$grub_menu\s*$/) {
$grub_number++;
$found = 1;
last;
} elsif (/^\s*title\s/) {
$grub_number++;
Expand All @@ -873,7 +876,7 @@ sub get_grub_index {
close(IN);

die "Could not find '$grub_menu' in /boot/grub/menu on $machine"
if ($grub_number < 0);
if (!$found);
doprint "$grub_number\n";
}

Expand Down

0 comments on commit eaa1fe2

Please sign in to comment.