Skip to content

Commit

Permalink
ktest: Monitor kernel while running of user tests
Browse files Browse the repository at this point in the history
Record the console of tests to both the console and the log.
Also, record the bug reports afte the test has completed.
Currently, if a kernel bug happens while running the userland
test, the test stops and will not record the kernel bug. This
makes it difficult to solve what happened.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed Mar 8, 2011
1 parent 4651920 commit 8ea0e06
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tools/testing/ktest/ktest.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,7 @@ sub do_run_test {

# we are not guaranteed to get a full line
$full_line .= $line;
doprint $line;

if ($full_line =~ /call trace:/i) {
$bug = 1;
Expand All @@ -1126,6 +1127,19 @@ sub do_run_test {
} while (!$child_done && !$bug);

if ($bug) {
my $failure_start = time;
my $now;
do {
$line = wait_for_input($monitor_fp, 1);
if (defined($line)) {
doprint $line;
}
$now = time;
if ($now - $failure_start >= $stop_after_failure) {
last;
}
} while (defined($line));

doprint "Detected kernel crash!\n";
# kill the child with extreme prejudice
kill 9, $child_pid;
Expand Down

0 comments on commit 8ea0e06

Please sign in to comment.