diff options
author | Steven Rostedt <srostedt@redhat.com> | 2012-03-21 11:18:27 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2012-03-21 11:18:27 -0400 |
commit | 648a182c615272f01b5cda01dc87a16de9f695bb (patch) | |
tree | 4e54cc869f5dfc0fc8415de2708aa770649c11b8 | |
parent | 769df641cc1b870c0d7f95d6433416bf2c6c2b5e (diff) |
ktest: Allow a test to override REBOOT_ON_SUCCESS
The option REBOOT_ON_SUCCESS is global, and will have the machine reboot
the the box if all tests are successful. But a test may not want the
machine to reboot, and perhaps have the kernel it loaded be used to
install the next kernel. Or the last test may set up a kernel that the
user may want to look at. In this case, the user could have the global
option REBOOT_ON_SUCCESS be true, but if a test is defined to run at the
end, that test can override the global option and keep the kernel it
installed for the user to log in with.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rwxr-xr-x | tools/testing/ktest/ktest.pl | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index e7fed7903939..c858152f16e2 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
@@ -87,6 +87,7 @@ my $reboot_on_error; | |||
87 | my $switch_to_good; | 87 | my $switch_to_good; |
88 | my $switch_to_test; | 88 | my $switch_to_test; |
89 | my $poweroff_on_error; | 89 | my $poweroff_on_error; |
90 | my $reboot_on_success; | ||
90 | my $die_on_failure; | 91 | my $die_on_failure; |
91 | my $powercycle_after_reboot; | 92 | my $powercycle_after_reboot; |
92 | my $poweroff_after_halt; | 93 | my $poweroff_after_halt; |
@@ -213,6 +214,7 @@ my %option_map = ( | |||
213 | "SWITCH_TO_GOOD" => \$switch_to_good, | 214 | "SWITCH_TO_GOOD" => \$switch_to_good, |
214 | "SWITCH_TO_TEST" => \$switch_to_test, | 215 | "SWITCH_TO_TEST" => \$switch_to_test, |
215 | "POWEROFF_ON_ERROR" => \$poweroff_on_error, | 216 | "POWEROFF_ON_ERROR" => \$poweroff_on_error, |
217 | "REBOOT_ON_SUCCESS" => \$reboot_on_success, | ||
216 | "DIE_ON_FAILURE" => \$die_on_failure, | 218 | "DIE_ON_FAILURE" => \$die_on_failure, |
217 | "POWER_OFF" => \$power_off, | 219 | "POWER_OFF" => \$power_off, |
218 | "POWERCYCLE_AFTER_REBOOT" => \$powercycle_after_reboot, | 220 | "POWERCYCLE_AFTER_REBOOT" => \$powercycle_after_reboot, |
@@ -3552,8 +3554,10 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
3552 | die "failed to checkout $checkout"; | 3554 | die "failed to checkout $checkout"; |
3553 | } | 3555 | } |
3554 | 3556 | ||
3555 | $no_reboot = 0; | 3557 | # A test may opt to not reboot the box |
3556 | 3558 | if ($reboot_on_success) { | |
3559 | $no_reboot = 0; | ||
3560 | } | ||
3557 | 3561 | ||
3558 | if ($test_type eq "bisect") { | 3562 | if ($test_type eq "bisect") { |
3559 | bisect $i; | 3563 | bisect $i; |
@@ -3598,8 +3602,12 @@ if ($opt{"POWEROFF_ON_SUCCESS"}) { | |||
3598 | halt; | 3602 | halt; |
3599 | } elsif ($opt{"REBOOT_ON_SUCCESS"} && !do_not_reboot) { | 3603 | } elsif ($opt{"REBOOT_ON_SUCCESS"} && !do_not_reboot) { |
3600 | reboot_to_good; | 3604 | reboot_to_good; |
3605 | } elsif (defined($switch_to_good)) { | ||
3606 | # still need to get to the good kernel | ||
3607 | run_command $switch_to_good; | ||
3601 | } | 3608 | } |
3602 | 3609 | ||
3610 | |||
3603 | doprint "\n $successes of $opt{NUM_TESTS} tests were successful\n\n"; | 3611 | doprint "\n $successes of $opt{NUM_TESTS} tests were successful\n\n"; |
3604 | 3612 | ||
3605 | exit 0; | 3613 | exit 0; |