summaryrefslogtreecommitdiff
path: root/tools/testing/ktest/ktest.pl
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2011-06-13 18:48:10 +0400
committerSteven Rostedt <rostedt@goodmis.org>2011-06-13 18:48:10 +0400
commitecaf8e521324d5a7f85976bb8689e248b8d3a2f6 (patch)
tree4ff259e374ab2f187f95d24725d4e36aa82c67b6 /tools/testing/ktest/ktest.pl
parentfcb3f16a4f4bf4e667ae4c68b1d5401824058efb (diff)
downloadlinux-ecaf8e521324d5a7f85976bb8689e248b8d3a2f6.tar.xz
ktest: Have wait on stdio honor bug timeout
After a bug is found, the STOP_AFTER_FAILURE timeout is used to determine how much output should be printed before breaking out of the monitor loop. This is to get things like call traces and enough infromation about the bug to help determine what caused it. The STOP_AFTER_FAILURE is usually much shorter than the TIMEOUT that is used to determine when to quit after no more stdio is given. But since the stdio read uses a wait on I/O, the STOP_AFTER_FAILURE is only checked after we get something from I/O. But if the I/O does not return any more data, we wait the TIMEOUT period instead, even though we already triggered a bug report. The wait on I/O should honor the STOP_AFTER_FAILURE time if a bug has been found. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools/testing/ktest/ktest.pl')
-rwxr-xr-xtools/testing/ktest/ktest.pl11
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index aa442a9075db..1e1fe835df48 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -851,7 +851,16 @@ sub monitor {
while (!$done) {
- if ($booted) {
+ if ($bug && defined($stop_after_failure) &&
+ $stop_after_failure >= 0) {
+ my $time = $stop_after_failure - (time - $failure_start);
+ $line = wait_for_input($monitor_fp, $time);
+ if (!defined($line)) {
+ doprint "bug timed out after $booted_timeout seconds\n";
+ doprint "Test forced to stop after $stop_after_failure seconds after failure\n";
+ last;
+ }
+ } elsif ($booted) {
$line = wait_for_input($monitor_fp, $booted_timeout);
if (!defined($line)) {
my $s = $booted_timeout == 1 ? "" : "s";