ktest: Fail when grub menu not found
[linux-2.6-block.git] / tools / testing / ktest / ktest.pl
index debc6898e60b9de4e240409c2356790600c1a94a..ca6ff99ab1a5b786f3689bb3cec4d7f380e6c0d0 100755 (executable)
@@ -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++;
@@ -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";
 }