瀏覽代碼

ktest: Fix reboot on success stopping all reboots

The change to let individual tests decide to reboot the machine on
success of the entire test also prevented errors from rebooting
when an error was detected.

The "no_reboot" variable was only cleared if the test had
reboot_on_success set. But the no_reboot variable also prevents the test
rebooting when an error was detected even when REBOOT_ON_ERROR was set.

Add a new "reboot_success" variable that is used to determine if the
test should reboot on success and not touch the no_reboot variable.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Steven Rostedt 13 年之前
父節點
當前提交
759a3cc625
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. 8 2
      tools/testing/ktest/ktest.pl

+ 8 - 2
tools/testing/ktest/ktest.pl

@@ -183,6 +183,9 @@ my %force_config;
 # do not force reboots on config problems
 # do not force reboots on config problems
 my $no_reboot = 1;
 my $no_reboot = 1;
 
 
+# reboot on success
+my $reboot_success = 0;
+
 my %option_map = (
 my %option_map = (
     "MACHINE"			=> \$machine,
     "MACHINE"			=> \$machine,
     "SSH_USER"			=> \$ssh_user,
     "SSH_USER"			=> \$ssh_user,
@@ -3469,6 +3472,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
 
 
     # Do not reboot on failing test options
     # Do not reboot on failing test options
     $no_reboot = 1;
     $no_reboot = 1;
+    $reboot_success = 0;
 
 
     $iteration = $i;
     $iteration = $i;
 
 
@@ -3554,9 +3558,11 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
 	    die "failed to checkout $checkout";
 	    die "failed to checkout $checkout";
     }
     }
 
 
+    $no_reboot = 0;
+
     # A test may opt to not reboot the box
     # A test may opt to not reboot the box
     if ($reboot_on_success) {
     if ($reboot_on_success) {
-	$no_reboot = 0;
+	$reboot_success = 1;
     }
     }
 
 
     if ($test_type eq "bisect") {
     if ($test_type eq "bisect") {
@@ -3600,7 +3606,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
 
 
 if ($opt{"POWEROFF_ON_SUCCESS"}) {
 if ($opt{"POWEROFF_ON_SUCCESS"}) {
     halt;
     halt;
-} elsif ($opt{"REBOOT_ON_SUCCESS"} && !do_not_reboot) {
+} elsif ($opt{"REBOOT_ON_SUCCESS"} && !do_not_reboot && $reboot_success) {
     reboot_to_good;
     reboot_to_good;
 } elsif (defined($switch_to_good)) {
 } elsif (defined($switch_to_good)) {
     # still need to get to the good kernel
     # still need to get to the good kernel