From 752d96657cf4844793ac4d62d02a0733396ef16c Mon Sep 17 00:00:00 2001 From: "Steven Rostedt (Red Hat)" Date: Fri, 8 Mar 2013 09:33:35 -0500 Subject: ktest: Allow tests to use different GRUB_MENUs To save connecting and searching for a given grub menu for each test, ktest.pl will cache the grub number it found. The problem is that different tests might use a different grub menu, but ktest.pl will ignore it. Instead, have ktest.pl check if the grub menu it used to cache the content is the same as when it grabbed the menu. If not, grab it again, otherwise just return the cached value. Signed-off-by: Steven Rostedt --- tools/testing/ktest/ktest.pl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 4e67d52eb3a2..7958cd4d6567 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl @@ -108,6 +108,7 @@ my $scp_to_target; my $scp_to_target_install; my $power_off; my $grub_menu; +my $last_grub_menu; my $grub_file; my $grub_number; my $grub_reboot; @@ -1538,7 +1539,8 @@ sub run_scp_mod { sub get_grub2_index { - return if (defined($grub_number)); + return if (defined($grub_number) && defined($last_grub_menu) && + $last_grub_menu eq $grub_menu); doprint "Find grub2 menu ... "; $grub_number = -1; @@ -1565,6 +1567,7 @@ sub get_grub2_index { die "Could not find '$grub_menu' in $grub_file on $machine" if (!$found); doprint "$grub_number\n"; + $last_grub_menu = $grub_menu; } sub get_grub_index { @@ -1577,7 +1580,8 @@ sub get_grub_index { if ($reboot_type ne "grub") { return; } - return if (defined($grub_number)); + return if (defined($grub_number) && defined($last_grub_menu) && + $last_grub_menu eq $grub_menu); doprint "Find grub menu ... "; $grub_number = -1; @@ -1604,6 +1608,7 @@ sub get_grub_index { die "Could not find '$grub_menu' in /boot/grub/menu on $machine" if (!$found); doprint "$grub_number\n"; + $last_grub_menu = $grub_menu; } sub wait_for_input -- cgit v1.2.3 From df5f7c66013c46cec9aa8156af257bc5eb29b5c5 Mon Sep 17 00:00:00 2001 From: "Steven Rostedt (Red Hat)" Date: Wed, 24 Apr 2013 16:03:30 -0400 Subject: ktest: Reset grub menu cache with different machines Different tests may use a different machine. In such cases, we need to try to get the current grub menu index. If the same grub menu is used for two different machines, it may not be at the same index on the second machine. A search for the index must be performed again. Signed-off-by: Steven Rostedt --- tools/testing/ktest/ktest.pl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 7958cd4d6567..0d7fd8b51544 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl @@ -73,6 +73,7 @@ my $ktest_config; my $version; my $have_version = 0; my $machine; +my $last_machine; my $ssh_user; my $tmpdir; my $builddir; @@ -1540,7 +1541,8 @@ sub run_scp_mod { sub get_grub2_index { return if (defined($grub_number) && defined($last_grub_menu) && - $last_grub_menu eq $grub_menu); + $last_grub_menu eq $grub_menu && defined($last_machine) && + $last_machine eq $machine); doprint "Find grub2 menu ... "; $grub_number = -1; @@ -1568,6 +1570,7 @@ sub get_grub2_index { if (!$found); doprint "$grub_number\n"; $last_grub_menu = $grub_menu; + $last_machine = $machine; } sub get_grub_index { @@ -1581,7 +1584,8 @@ sub get_grub_index { return; } return if (defined($grub_number) && defined($last_grub_menu) && - $last_grub_menu eq $grub_menu); + $last_grub_menu eq $grub_menu && defined($last_machine) && + $last_machine eq $machine); doprint "Find grub menu ... "; $grub_number = -1; @@ -1609,6 +1613,7 @@ sub get_grub_index { if (!$found); doprint "$grub_number\n"; $last_grub_menu = $grub_menu; + $last_machine = $machine; } sub wait_for_input -- cgit v1.2.3