public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Subject: [PATCH 07/17][RFC] ktest: Add option REBOOT_SUCCESS_LINE to stop waiting after a reboot
Date: Mon, 17 Oct 2011 12:05:02 -0400	[thread overview]
Message-ID: <20111017165950.152955930@goodmis.org> (raw)
In-Reply-To: 20111017160455.498567257@goodmis.org

[-- Attachment #1: Type: text/plain, Size: 3805 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

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>
---
 tools/testing/ktest/ktest.pl    |   33 +++++++++++++++++++++++++++------
 tools/testing/ktest/sample.conf |   10 ++++++++++
 2 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 74fb2ac..51ddaa5 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -117,6 +117,7 @@ my $timeout;
 my $booted_timeout;
 my $detect_triplefault;
 my $console;
+my $reboot_success_line;
 my $success_line;
 my $stop_after_success;
 my $stop_after_failure;
@@ -612,6 +613,13 @@ sub wait_for_monitor;
 sub reboot {
     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
     if (run_command $reboot) {
 	if (defined($powercycle_after_reboot)) {
@@ -624,8 +632,7 @@ sub reboot {
     }
 
     if (defined($time)) {
-	start_monitor;
-	wait_for_monitor $time;
+	wait_for_monitor($time, $reboot_success_line);
 	end_monitor;
     }
 }
@@ -706,16 +713,29 @@ sub end_monitor {
 }
 
 sub wait_for_monitor {
-    my ($time) = @_;
+    my ($time, $stop) = @_;
+    my $full_line = "";
     my $line;
+    my $booted = 0;
 
     doprint "** Wait for monitor to settle down **\n";
 
     # read the monitor and wait for the system to calm down
-    do {
+    while (!$booted) {
 	$line = wait_for_input($monitor_fp, $time);
-	print "$line" if (defined($line));
-    } while (defined($line));
+	last if (!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";
 }
 
@@ -2836,6 +2856,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
     $console = set_test_option("CONSOLE", $i);
     $detect_triplefault = set_test_option("DETECT_TRIPLE_FAULT", $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_failure = set_test_option("STOP_AFTER_FAILURE", $i);
     $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 b3e0dc1..67bc4e0 100644
--- a/tools/testing/ktest/sample.conf
+++ b/tools/testing/ktest/sample.conf
@@ -423,6 +423,14 @@
 # (default "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
 # a specified time to stop the test after success is recommended.
 # (in seconds)
@@ -488,6 +496,8 @@
 # another test. If a reboot to the reliable kernel happens,
 # we wait SLEEP_TIME for the console to stop producing output
 # before starting the next test.
+#
+# You can speed up reboot times even more by setting REBOOT_SUCCESS_LINE.
 # (default 60)
 #SLEEP_TIME = 60
 
-- 
1.7.6.3



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2011-10-17 17:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-17 16:04 [PATCH 00/17][RFC] ktest updates for v3.2 Steven Rostedt
2011-10-17 16:04 ` [PATCH 01/17][RFC] ktest: Add TEST_TYPE install option Steven Rostedt
2011-10-17 16:04 ` [PATCH 02/17][RFC] ktest: Create outputdir if it does not exist Steven Rostedt
2011-10-17 16:04 ` [PATCH 03/17][RFC] ktest: Only need to save .config when doing mrproper Steven Rostedt
2011-10-17 16:04 ` [PATCH 04/17][RFC] ktest: Include monitor in reboot code Steven Rostedt
2011-10-17 16:05 ` [PATCH 05/17][RFC] ktest: Fail when grub menu not found Steven Rostedt
2011-10-17 16:05 ` [PATCH 06/17][RFC] ktest: Add NO_INSTALL option to not install for a test Steven Rostedt
2011-10-17 16:05 ` Steven Rostedt [this message]
2011-10-17 16:05 ` [PATCH 08/17][RFC] ktest: Do not reboot on config or build issues Steven Rostedt
2011-10-17 16:05 ` [PATCH 09/17][RFC] ktest: Add IF and ELSE to config sections Steven Rostedt
2011-10-17 16:05 ` [PATCH 10/17][RFC] ktest: Let IF keyword take comparisons Steven Rostedt
2011-10-17 16:05 ` [PATCH 11/17][RFC] ktest: Add INCLUDE keyword to include other config files Steven Rostedt
2011-10-17 16:05 ` [PATCH 12/17][RFC] ktest: Consolidate TEST_TYPE and DEFAULT code Steven Rostedt
2011-10-17 16:05 ` [PATCH 13/17][RFC] ktest: Add OVERRIDE keyword to DEFAULTS section Steven Rostedt
2011-10-17 16:05 ` [PATCH 14/17][RFC] ktest: Add DEFINED keyword for IF statements Steven Rostedt
2011-10-17 16:05 ` [PATCH 15/17][RFC] ktest: Sort make_min_config configs by dependecies Steven Rostedt
2011-10-17 16:05 ` [PATCH 16/17][RFC] ktest: Fix parsing of config section lines Steven Rostedt
2011-10-17 16:05 ` [PATCH 17/17][RFC] ktest: Add processing of complex conditionals Steven Rostedt
2011-10-20 14:31 ` [PATCH 00/17][RFC] ktest updates for v3.2 Andrew Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111017165950.152955930@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox