Skip to contentSkip to conversation

ktest: Updates for v3.10

GIT PULL New Steven Rostedt 1 participant 3 messages Apr 29, 2013 Ktest

lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

Linus,

A couple of fixes to handle a config file that tests multiple machines and has conflicts it the grub menus. That is, if the machines use the same grub menu name, but they are at different locations in the menu.lst file.

Please pull the latest ktest-v3.10 tree, which can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest.git
ktest-v3.10

Head SHA1: 66566ce651763c542ef4e420335148ebe9dbc082

Steven Rostedt (Red Hat) (2):
ktest: Allow tests to use different GRUB_MENUs
ktest: Reset grub menu cache with different machines

----

 tools/testing/ktest/ktest.pl |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
author maintainer
#1 lore raw

PATCH 1/2 ktest: Allow tests to use different GRUB_MENUs

From: "Steven Rostedt (Red Hat)" <[email protected]>

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.

---
 tools/testing/ktest/ktest.pl |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
tools/testing/ktest/ktest.pl +7 -2
index 4e67d52..7958cd4 100755
@@ -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
Signature · 1 line
1.7.10.4
author maintainer
#2 lore raw

PATCH 2/2 ktest: Reset grub menu cache with different machines

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

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.

---
 tools/testing/ktest/ktest.pl |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
tools/testing/ktest/ktest.pl +7 -2
index 7958cd4..0d7fd8b 100755
@@ -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
Signature · 1 line
1.7.10.4