Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 285896
b: refs/heads/master
c: bc7c580
h: refs/heads/master
v: v3
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed Dec 23, 2011
1 parent ac1149d commit 30b6d6f
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c5dacb88f0a6410b3270f77e3d1e1b159afc4adc
refs/heads/master: bc7c580377195f9f4da31b63fbbf52293cb4c861
33 changes: 26 additions & 7 deletions trunk/tools/testing/ktest/ktest.pl
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
my $power_cycle;
my $reboot;
my $reboot_on_error;
my $switch_to_good;
my $switch_to_test;
my $poweroff_on_error;
my $die_on_failure;
my $powercycle_after_reboot;
Expand Down Expand Up @@ -964,6 +966,17 @@ sub reboot {
}
}

sub reboot_to_good {
my ($time) = @_;

if (defined($switch_to_good)) {
run_command $switch_to_good;
return;
}

reboot $time;
}

sub do_not_reboot {
my $i = $iteration;

Expand All @@ -980,7 +993,7 @@ sub dodie {
if ($reboot_on_error && !do_not_reboot) {

doprint "REBOOTING\n";
reboot;
reboot_to_good;

} elsif ($poweroff_on_error && defined($power_off)) {
doprint "POWERING OFF\n";
Expand Down Expand Up @@ -1116,7 +1129,7 @@ sub fail {
# no need to reboot for just building.
if (!do_not_reboot) {
doprint "REBOOTING\n";
reboot $sleep_time;
reboot_to_good $sleep_time;
}

my $name = "";
Expand Down Expand Up @@ -1269,6 +1282,10 @@ sub wait_for_input
}

sub reboot_to {
if (defined($switch_to_test)) {
run_command $switch_to_test;
}

if ($reboot_type eq "grub") {
run_ssh "'(echo \"savedefault --default=$grub_number --once\" | grub --batch)'";
reboot;
Expand Down Expand Up @@ -1754,7 +1771,7 @@ sub success {

if ($i != $opt{"NUM_TESTS"} && !do_not_reboot) {
doprint "Reboot and wait $sleep_time seconds\n";
reboot $sleep_time;
reboot_to_good $sleep_time;
}
}

Expand Down Expand Up @@ -1935,7 +1952,7 @@ sub run_git_bisect {

sub bisect_reboot {
doprint "Reboot and sleep $bisect_sleep_time seconds\n";
reboot $bisect_sleep_time;
reboot_to_good $bisect_sleep_time;
}

# returns 1 on success, 0 on failure, -1 on skip
Expand Down Expand Up @@ -2528,7 +2545,7 @@ sub config_bisect {

sub patchcheck_reboot {
doprint "Reboot and sleep $patchcheck_sleep_time seconds\n";
reboot $patchcheck_sleep_time;
reboot_to_good $patchcheck_sleep_time;
}

sub patchcheck {
Expand Down Expand Up @@ -3145,7 +3162,7 @@ sub make_min_config {
}

doprint "Reboot and wait $sleep_time seconds\n";
reboot $sleep_time;
reboot_to_good $sleep_time;
}

success $i;
Expand Down Expand Up @@ -3314,6 +3331,8 @@ sub set_test_option {
$no_install = set_test_option("NO_INSTALL", $i);
$reboot_script = set_test_option("REBOOT_SCRIPT", $i);
$reboot_on_error = set_test_option("REBOOT_ON_ERROR", $i);
$switch_to_good = set_test_option("SWITCH_TO_GOOD", $i);
$switch_to_test = set_test_option("SWITCH_TO_TEST", $i);
$poweroff_on_error = set_test_option("POWEROFF_ON_ERROR", $i);
$die_on_failure = set_test_option("DIE_ON_FAILURE", $i);
$power_off = set_test_option("POWER_OFF", $i);
Expand Down Expand Up @@ -3472,7 +3491,7 @@ sub set_test_option {
if ($opt{"POWEROFF_ON_SUCCESS"}) {
halt;
} elsif ($opt{"REBOOT_ON_SUCCESS"} && !do_not_reboot) {
reboot;
reboot_to_good;
}

doprint "\n $successes of $opt{NUM_TESTS} tests were successful\n\n";
Expand Down
21 changes: 21 additions & 0 deletions trunk/tools/testing/ktest/sample.conf
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,27 @@
# The test will not modify that file.
#REBOOT_TYPE = grub

# If you are using a machine that doesn't boot with grub, and
# perhaps gets its kernel from a remote server (tftp), then
# you can use this option to update the target image with the
# test image.
#
# You could also do the same with POST_INSTALL, but the difference
# between that option and this option is that POST_INSTALL runs
# after the install, where this one runs just before a reboot.
# (default undefined)
#SWITCH_TO_TEST = cp ${OUTPUT_DIR}/${BUILD_TARGET} ${TARGET_IMAGE}

# If you are using a machine that doesn't boot with grub, and
# perhaps gets its kernel from a remote server (tftp), then
# you can use this option to update the target image with the
# the known good image to reboot safely back into.
#
# This option holds a command that will execute before needing
# to reboot to a good known image.
# (default undefined)
#SWITCH_TO_GOOD = ssh ${SSH_USER}/${MACHINE} cp good_image ${TARGET_IMAGE}

# The min config that is needed to build for the machine
# A nice way to create this is with the following:
#
Expand Down

0 comments on commit 30b6d6f

Please sign in to comment.