Commit 2b803365 authored by Steven Rostedt's avatar Steven Rostedt Committed by Steven Rostedt

ktest: Add option REBOOT_SUCCESS_LINE to stop waiting after a reboot

When ktest.pl reboots, it will usuall wait SLEEP_TIME seconds of idle
console before starting the next test. By setting the
REBOOT_SUCCESS_LINE, ktest will not wait SLEEP_TIME when it detects the
line while rebooting to a new kernel.
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent e0a8742e
...@@ -117,6 +117,7 @@ my $timeout; ...@@ -117,6 +117,7 @@ my $timeout;
my $booted_timeout; my $booted_timeout;
my $detect_triplefault; my $detect_triplefault;
my $console; my $console;
my $reboot_success_line;
my $success_line; my $success_line;
my $stop_after_success; my $stop_after_success;
my $stop_after_failure; my $stop_after_failure;
...@@ -612,6 +613,13 @@ sub wait_for_monitor; ...@@ -612,6 +613,13 @@ sub wait_for_monitor;
sub reboot { sub reboot {
my ($time) = @_; my ($time) = @_;
if (defined($time)) {
start_monitor;
# flush out current monitor
# May contain the reboot success line
wait_for_monitor 1;
}
# try to reboot normally # try to reboot normally
if (run_command $reboot) { if (run_command $reboot) {
if (defined($powercycle_after_reboot)) { if (defined($powercycle_after_reboot)) {
...@@ -624,8 +632,7 @@ sub reboot { ...@@ -624,8 +632,7 @@ sub reboot {
} }
if (defined($time)) { if (defined($time)) {
start_monitor; wait_for_monitor($time, $reboot_success_line);
wait_for_monitor $time;
end_monitor; end_monitor;
} }
} }
...@@ -706,16 +713,29 @@ sub end_monitor { ...@@ -706,16 +713,29 @@ sub end_monitor {
} }
sub wait_for_monitor { sub wait_for_monitor {
my ($time) = @_; my ($time, $stop) = @_;
my $full_line = "";
my $line; my $line;
my $booted = 0;
doprint "** Wait for monitor to settle down **\n"; doprint "** Wait for monitor to settle down **\n";
# read the monitor and wait for the system to calm down # read the monitor and wait for the system to calm down
do { while (!$booted) {
$line = wait_for_input($monitor_fp, $time); $line = wait_for_input($monitor_fp, $time);
print "$line" if (defined($line)); last if (!defined($line));
} while (defined($line)); print "$line";
$full_line .= $line;
if (defined($stop) && $full_line =~ /$stop/) {
doprint "wait for monitor detected $stop\n";
$booted = 1;
}
if ($line =~ /\n/) {
$full_line = "";
}
}
print "** Monitor flushed **\n"; print "** Monitor flushed **\n";
} }
...@@ -2836,6 +2856,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { ...@@ -2836,6 +2856,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
$console = set_test_option("CONSOLE", $i); $console = set_test_option("CONSOLE", $i);
$detect_triplefault = set_test_option("DETECT_TRIPLE_FAULT", $i); $detect_triplefault = set_test_option("DETECT_TRIPLE_FAULT", $i);
$success_line = set_test_option("SUCCESS_LINE", $i); $success_line = set_test_option("SUCCESS_LINE", $i);
$reboot_success_line = set_test_option("REBOOT_SUCCESS_LINE", $i);
$stop_after_success = set_test_option("STOP_AFTER_SUCCESS", $i); $stop_after_success = set_test_option("STOP_AFTER_SUCCESS", $i);
$stop_after_failure = set_test_option("STOP_AFTER_FAILURE", $i); $stop_after_failure = set_test_option("STOP_AFTER_FAILURE", $i);
$stop_test_after = set_test_option("STOP_TEST_AFTER", $i); $stop_test_after = set_test_option("STOP_TEST_AFTER", $i);
......
...@@ -423,6 +423,14 @@ ...@@ -423,6 +423,14 @@
# (default "login:") # (default "login:")
#SUCCESS_LINE = login: #SUCCESS_LINE = login:
# To speed up between reboots, defining a line that the
# default kernel produces that represents that the default
# kernel has successfully booted and can be used to pass
# a new test kernel to it. Otherwise ktest.pl will wait till
# SLEEP_TIME to continue.
# (default undefined)
#REBOOT_SUCCESS_LINE = login:
# In case the console constantly fills the screen, having # In case the console constantly fills the screen, having
# a specified time to stop the test after success is recommended. # a specified time to stop the test after success is recommended.
# (in seconds) # (in seconds)
...@@ -488,6 +496,8 @@ ...@@ -488,6 +496,8 @@
# another test. If a reboot to the reliable kernel happens, # another test. If a reboot to the reliable kernel happens,
# we wait SLEEP_TIME for the console to stop producing output # we wait SLEEP_TIME for the console to stop producing output
# before starting the next test. # before starting the next test.
#
# You can speed up reboot times even more by setting REBOOT_SUCCESS_LINE.
# (default 60) # (default 60)
#SLEEP_TIME = 60 #SLEEP_TIME = 60
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment