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
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH 06/10] ktest: Add MAX_MONITOR_WAIT option
Date: Mon, 30 Jul 2012 15:23:20 -0400	[thread overview]
Message-ID: <20120730192657.122927906@goodmis.org> (raw)
In-Reply-To: 20120730192314.144253843@goodmis.org

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

From: Steven Rostedt <srostedt@redhat.com>

If the console is constantly outputting content, this can cause ktest
to get stuck waiting on the monitor to settle down.

The option MAX_MONITOR_WAIT is the maximum time (in seconds) for ktest
to wait for the console to flush.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 tools/testing/ktest/ktest.pl    |   16 +++++++++++++++-
 tools/testing/ktest/sample.conf |    8 ++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 5ad891a..d10fff1 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -52,6 +52,7 @@ my %default = (
     "STOP_AFTER_SUCCESS"	=> 10,
     "STOP_AFTER_FAILURE"	=> 60,
     "STOP_TEST_AFTER"		=> 600,
+    "MAX_MONITOR_WAIT"		=> 1800,
 
 # required, and we will ask users if they don't have them but we keep the default
 # value something that is common.
@@ -98,6 +99,7 @@ my $reboot_on_success;
 my $die_on_failure;
 my $powercycle_after_reboot;
 my $poweroff_after_halt;
+my $max_monitor_wait;
 my $ssh_exec;
 my $scp_to_target;
 my $scp_to_target_install;
@@ -243,6 +245,7 @@ my %option_map = (
     "POWER_OFF"			=> \$power_off,
     "POWERCYCLE_AFTER_REBOOT"	=> \$powercycle_after_reboot,
     "POWEROFF_AFTER_HALT"	=> \$poweroff_after_halt,
+    "MAX_MONITOR_WAIT"		=> \$max_monitor_wait,
     "SLEEP_TIME"		=> \$sleep_time,
     "BISECT_SLEEP_TIME"		=> \$bisect_sleep_time,
     "PATCHCHECK_SLEEP_TIME"	=> \$patchcheck_sleep_time,
@@ -1133,7 +1136,10 @@ sub reboot {
     }
 
     if (defined($time)) {
-	wait_for_monitor($time, $reboot_success_line);
+	if (wait_for_monitor($time, $reboot_success_line)) {
+	    # reboot got stuck?
+	    run_command "$power_cycle";
+	}
 	end_monitor;
     }
 }
@@ -1228,6 +1234,8 @@ sub wait_for_monitor {
     my $full_line = "";
     my $line;
     my $booted = 0;
+    my $start_time = time;
+    my $now;
 
     doprint "** Wait for monitor to settle down **\n";
 
@@ -1246,8 +1254,14 @@ sub wait_for_monitor {
 	if ($line =~ /\n/) {
 	    $full_line = "";
 	}
+	$now = time;
+	if ($now - $start_time >= $max_monitor_wait) {
+	    doprint "Exiting monitor flush due to hitting MAX_MONITOR_WAIT\n";
+	    return 1;
+	}
     }
     print "** Monitor flushed **\n";
+    return 0;
 }
 
 sub save_logs {
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf
index e4a12da..de28a0a 100644
--- a/tools/testing/ktest/sample.conf
+++ b/tools/testing/ktest/sample.conf
@@ -695,6 +695,14 @@
 # (default 60)
 #BISECT_SLEEP_TIME = 60
 
+# The max wait time (in seconds) for waiting for the console to finish.
+# If for some reason, the console is outputting content without
+# ever finishing, this will cause ktest to get stuck. This
+# option is the max time ktest will wait for the monitor (console)
+# to settle down before continuing.
+# (default 1800)
+#MAX_MONITOR_WAIT
+
 # The time in between patch checks to sleep (in seconds)
 # (default 60)
 #PATCHCHECK_SLEEP_TIME = 60
-- 
1.7.10.4



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

  parent reply	other threads:[~2012-07-30 19:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-30 19:23 [PATCH 00/10] [GIT PULL] ktest: changes for v3.6 Steven Rostedt
2012-07-30 19:23 ` [PATCH 01/10] ktest: Remove commented exit Steven Rostedt
2012-07-30 19:23 ` [PATCH 02/10] ktest: Add PRE/POST_KTEST and TEST options Steven Rostedt
2012-07-30 19:23 ` [PATCH 03/10] ktest: Add PRE_INSTALL option Steven Rostedt
2012-07-30 19:23 ` [PATCH 04/10] ktest: Add CONFIG_BISECT_CHECK option Steven Rostedt
2012-07-30 19:23 ` [PATCH 05/10] ktest: Fix config bisect with how make oldnoconfig works Steven Rostedt
2012-07-30 19:23 ` Steven Rostedt [this message]
2012-07-30 19:23 ` [PATCH 07/10] ktest: Add check for bug or panic during reboot Steven Rostedt
2012-07-30 19:23 ` [PATCH 08/10] ktest: Reset saved min (force) configs for each test Steven Rostedt
2012-07-30 19:23 ` [PATCH 09/10] ktest: Ignore errors it tests if IGNORE_ERRORS is set Steven Rostedt
2012-07-30 19:23 ` [PATCH 10/10] ktest: Allow perl regex expressions in conditional statements Steven Rostedt

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=20120730192657.122927906@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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