Loading tools/testing/ktest/ktest.pl +17 −33 Original line number Diff line number Diff line Loading @@ -1946,46 +1946,30 @@ sub get_grub2_index { sub get_grub_index { if ($reboot_type eq "grub2") { get_grub2_index; return; } my $command; my $target; my $skip; my $grub_menu_qt; if ($reboot_type ne "grub") { if ($reboot_type !~ /^grub/) { return; } return if (defined($grub_number) && defined($last_grub_menu) && $last_grub_menu eq $grub_menu && defined($last_machine) && $last_machine eq $machine); doprint "Find grub menu ... "; $grub_number = -1; $grub_menu_qt = quotemeta($grub_menu); my $ssh_grub = $ssh_exec; $ssh_grub =~ s,\$SSH_COMMAND,cat /boot/grub/menu.lst,g; open(IN, "$ssh_grub |") or dodie "unable to get menu.lst"; my $found = 0; my $grub_menu_qt = quotemeta($grub_menu); while (<IN>) { if (/^\s*title\s+$grub_menu_qt\s*$/) { $grub_number++; $found = 1; last; } elsif (/^\s*title\s/) { $grub_number++; } if ($reboot_type eq "grub") { $command = "cat /boot/grub/menu.lst"; $target = '^\s*title\s+' . $grub_menu_qt . '\s*$'; $skip = '^\s*title\s'; } elsif ($reboot_type eq "grub2") { $command = "cat $grub_file"; $target = '^menuentry.*' . $grub_menu_qt; $skip = '^menuentry\s|^submenu\s'; } else { return; } close(IN); dodie "Could not find '$grub_menu' in /boot/grub/menu on $machine" if (!$found); doprint "$grub_number\n"; $last_grub_menu = $grub_menu; $last_machine = $machine; _get_grub_index($command, $target, $skip); } sub wait_for_input Loading Loading
tools/testing/ktest/ktest.pl +17 −33 Original line number Diff line number Diff line Loading @@ -1946,46 +1946,30 @@ sub get_grub2_index { sub get_grub_index { if ($reboot_type eq "grub2") { get_grub2_index; return; } my $command; my $target; my $skip; my $grub_menu_qt; if ($reboot_type ne "grub") { if ($reboot_type !~ /^grub/) { return; } return if (defined($grub_number) && defined($last_grub_menu) && $last_grub_menu eq $grub_menu && defined($last_machine) && $last_machine eq $machine); doprint "Find grub menu ... "; $grub_number = -1; $grub_menu_qt = quotemeta($grub_menu); my $ssh_grub = $ssh_exec; $ssh_grub =~ s,\$SSH_COMMAND,cat /boot/grub/menu.lst,g; open(IN, "$ssh_grub |") or dodie "unable to get menu.lst"; my $found = 0; my $grub_menu_qt = quotemeta($grub_menu); while (<IN>) { if (/^\s*title\s+$grub_menu_qt\s*$/) { $grub_number++; $found = 1; last; } elsif (/^\s*title\s/) { $grub_number++; } if ($reboot_type eq "grub") { $command = "cat /boot/grub/menu.lst"; $target = '^\s*title\s+' . $grub_menu_qt . '\s*$'; $skip = '^\s*title\s'; } elsif ($reboot_type eq "grub2") { $command = "cat $grub_file"; $target = '^menuentry.*' . $grub_menu_qt; $skip = '^menuentry\s|^submenu\s'; } else { return; } close(IN); dodie "Could not find '$grub_menu' in /boot/grub/menu on $machine" if (!$found); doprint "$grub_number\n"; $last_grub_menu = $grub_menu; $last_machine = $machine; _get_grub_index($command, $target, $skip); } sub wait_for_input Loading