aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/ktest
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2011-09-30 18:00:23 -0400
committerSteven Rostedt <rostedt@goodmis.org>2011-10-17 11:54:10 -0400
commit2b803365a6fa177ea7e1f64f645be1cb5dd39d55 (patch)
tree88065b809c9ff127329fd6e633bec2859c9719b8 /tools/testing/ktest
parente0a8742e3d4b7649be2ca6f22e7d45153505fc81 (diff)
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: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools/testing/ktest')
-rwxr-xr-xtools/testing/ktest/ktest.pl33
-rw-r--r--tools/testing/ktest/sample.conf10
2 files changed, 37 insertions, 6 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 74fb2acae18d..51ddaa5ed556 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -117,6 +117,7 @@ my $timeout;
117my $booted_timeout; 117my $booted_timeout;
118my $detect_triplefault; 118my $detect_triplefault;
119my $console; 119my $console;
120my $reboot_success_line;
120my $success_line; 121my $success_line;
121my $stop_after_success; 122my $stop_after_success;
122my $stop_after_failure; 123my $stop_after_failure;
@@ -612,6 +613,13 @@ sub wait_for_monitor;
612sub reboot { 613sub reboot {
613 my ($time) = @_; 614 my ($time) = @_;
614 615
616 if (defined($time)) {
617 start_monitor;
618 # flush out current monitor
619 # May contain the reboot success line
620 wait_for_monitor 1;
621 }
622
615 # try to reboot normally 623 # try to reboot normally
616 if (run_command $reboot) { 624 if (run_command $reboot) {
617 if (defined($powercycle_after_reboot)) { 625 if (defined($powercycle_after_reboot)) {
@@ -624,8 +632,7 @@ sub reboot {
624 } 632 }
625 633
626 if (defined($time)) { 634 if (defined($time)) {
627 start_monitor; 635 wait_for_monitor($time, $reboot_success_line);
628 wait_for_monitor $time;
629 end_monitor; 636 end_monitor;
630 } 637 }
631} 638}
@@ -706,16 +713,29 @@ sub end_monitor {
706} 713}
707 714
708sub wait_for_monitor { 715sub wait_for_monitor {
709 my ($time) = @_; 716 my ($time, $stop) = @_;
717 my $full_line = "";
710 my $line; 718 my $line;
719 my $booted = 0;
711 720
712 doprint "** Wait for monitor to settle down **\n"; 721 doprint "** Wait for monitor to settle down **\n";
713 722
714 # read the monitor and wait for the system to calm down 723 # read the monitor and wait for the system to calm down
715 do { 724 while (!$booted) {
716 $line = wait_for_input($monitor_fp, $time); 725 $line = wait_for_input($monitor_fp, $time);
717 print "$line" if (defined($line)); 726 last if (!defined($line));
718 } while (defined($line)); 727 print "$line";
728 $full_line .= $line;
729
730 if (defined($stop) && $full_line =~ /$stop/) {
731 doprint "wait for monitor detected $stop\n";
732 $booted = 1;
733 }
734
735 if ($line =~ /\n/) {
736 $full_line = "";
737 }
738 }
719 print "** Monitor flushed **\n"; 739 print "** Monitor flushed **\n";
720} 740}
721 741
@@ -2836,6 +2856,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
2836 $console = set_test_option("CONSOLE", $i); 2856 $console = set_test_option("CONSOLE", $i);
2837 $detect_triplefault = set_test_option("DETECT_TRIPLE_FAULT", $i); 2857 $detect_triplefault = set_test_option("DETECT_TRIPLE_FAULT", $i);
2838 $success_line = set_test_option("SUCCESS_LINE", $i); 2858 $success_line = set_test_option("SUCCESS_LINE", $i);
2859 $reboot_success_line = set_test_option("REBOOT_SUCCESS_LINE", $i);
2839 $stop_after_success = set_test_option("STOP_AFTER_SUCCESS", $i); 2860 $stop_after_success = set_test_option("STOP_AFTER_SUCCESS", $i);
2840 $stop_after_failure = set_test_option("STOP_AFTER_FAILURE", $i); 2861 $stop_after_failure = set_test_option("STOP_AFTER_FAILURE", $i);
2841 $stop_test_after = set_test_option("STOP_TEST_AFTER", $i); 2862 $stop_test_after = set_test_option("STOP_TEST_AFTER", $i);
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf
index b3e0dc11fc8a..67bc4e06922c 100644
--- a/tools/testing/ktest/sample.conf
+++ b/tools/testing/ktest/sample.conf
@@ -423,6 +423,14 @@
423# (default "login:") 423# (default "login:")
424#SUCCESS_LINE = login: 424#SUCCESS_LINE = login:
425 425
426# To speed up between reboots, defining a line that the
427# default kernel produces that represents that the default
428# kernel has successfully booted and can be used to pass
429# a new test kernel to it. Otherwise ktest.pl will wait till
430# SLEEP_TIME to continue.
431# (default undefined)
432#REBOOT_SUCCESS_LINE = login:
433
426# In case the console constantly fills the screen, having 434# In case the console constantly fills the screen, having
427# a specified time to stop the test after success is recommended. 435# a specified time to stop the test after success is recommended.
428# (in seconds) 436# (in seconds)
@@ -488,6 +496,8 @@
488# another test. If a reboot to the reliable kernel happens, 496# another test. If a reboot to the reliable kernel happens,
489# we wait SLEEP_TIME for the console to stop producing output 497# we wait SLEEP_TIME for the console to stop producing output
490# before starting the next test. 498# before starting the next test.
499#
500# You can speed up reboot times even more by setting REBOOT_SUCCESS_LINE.
491# (default 60) 501# (default 60)
492#SLEEP_TIME = 60 502#SLEEP_TIME = 60
493 503