Skip to content

Commit 759a3cc

Browse files
Steven Rostedtrostedt
authored andcommitted
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>
1 parent 5158ba3 commit 759a3cc

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎tools/testing/ktest/ktest.pl‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@
183183
# do not force reboots on config problems
184184
my $no_reboot = 1;
185185

186+
# reboot on success
187+
my $reboot_success = 0;
188+
186189
my %option_map = (
187190
"MACHINE" => \$machine,
188191
"SSH_USER" => \$ssh_user,
@@ -3469,6 +3472,7 @@ sub set_test_option {
34693472

34703473
# Do not reboot on failing test options
34713474
$no_reboot = 1;
3475+
$reboot_success = 0;
34723476

34733477
$iteration = $i;
34743478

@@ -3554,9 +3558,11 @@ sub set_test_option {
35543558
die "failed to checkout $checkout";
35553559
}
35563560

3561+
$no_reboot = 0;
3562+
35573563
# A test may opt to not reboot the box
35583564
if ($reboot_on_success) {
3559-
$no_reboot = 0;
3565+
$reboot_success = 1;
35603566
}
35613567

35623568
if ($test_type eq "bisect") {
@@ -3600,7 +3606,7 @@ sub set_test_option {
36003606

36013607
if ($opt{"POWEROFF_ON_SUCCESS"}) {
36023608
halt;
3603-
} elsif ($opt{"REBOOT_ON_SUCCESS"} && !do_not_reboot) {
3609+
} elsif ($opt{"REBOOT_ON_SUCCESS"} && !do_not_reboot && $reboot_success) {
36043610
reboot_to_good;
36053611
} elsif (defined($switch_to_good)) {
36063612
# still need to get to the good kernel

0 commit comments

Comments
 (0)