diff options
author | Steven Rostedt <srostedt@redhat.com> | 2012-07-19 16:08:33 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2012-07-19 16:11:21 -0400 |
commit | 8a80c72711a9b78af433013067848c0a5473a484 (patch) | |
tree | fcbdbe902a4ac4d1566361a81a9a9866b28c99d7 /tools | |
parent | 407b95b7a085b5c1622033edc2720bb05f973317 (diff) |
ktest: Add check for bug or panic during reboot
Usually the target is booted into a dependable kernel when a test
starts. The test will install the test kernel and reboot the box. But
there may be a time that the kernel is running an unreliable kernel and
the reboot may crash.
Have ktest detect crashes on a reboot and force a power-cycle instead.
This can usually happen if a test kernel was installed to run manual
tests, but the user forgot to reboot to the known good kernel.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/testing/ktest/ktest.pl | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index d10fff12bc24..c8a42d5991be 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
@@ -1138,6 +1138,7 @@ sub reboot { | |||
1138 | if (defined($time)) { | 1138 | if (defined($time)) { |
1139 | if (wait_for_monitor($time, $reboot_success_line)) { | 1139 | if (wait_for_monitor($time, $reboot_success_line)) { |
1140 | # reboot got stuck? | 1140 | # reboot got stuck? |
1141 | doprint "Reboot did not finish. Forcing power cycle\n"; | ||
1141 | run_command "$power_cycle"; | 1142 | run_command "$power_cycle"; |
1142 | } | 1143 | } |
1143 | end_monitor; | 1144 | end_monitor; |
@@ -1235,6 +1236,9 @@ sub wait_for_monitor { | |||
1235 | my $line; | 1236 | my $line; |
1236 | my $booted = 0; | 1237 | my $booted = 0; |
1237 | my $start_time = time; | 1238 | my $start_time = time; |
1239 | my $skip_call_trace = 0; | ||
1240 | my $bug = 0; | ||
1241 | my $bug_ignored = 0; | ||
1238 | my $now; | 1242 | my $now; |
1239 | 1243 | ||
1240 | doprint "** Wait for monitor to settle down **\n"; | 1244 | doprint "** Wait for monitor to settle down **\n"; |
@@ -1251,6 +1255,28 @@ sub wait_for_monitor { | |||
1251 | $booted = 1; | 1255 | $booted = 1; |
1252 | } | 1256 | } |
1253 | 1257 | ||
1258 | if ($full_line =~ /\[ backtrace testing \]/) { | ||
1259 | $skip_call_trace = 1; | ||
1260 | } | ||
1261 | |||
1262 | if ($full_line =~ /call trace:/i) { | ||
1263 | if (!$bug && !$skip_call_trace) { | ||
1264 | if ($ignore_errors) { | ||
1265 | $bug_ignored = 1; | ||
1266 | } else { | ||
1267 | $bug = 1; | ||
1268 | } | ||
1269 | } | ||
1270 | } | ||
1271 | |||
1272 | if ($full_line =~ /\[ end of backtrace testing \]/) { | ||
1273 | $skip_call_trace = 0; | ||
1274 | } | ||
1275 | |||
1276 | if ($full_line =~ /Kernel panic -/) { | ||
1277 | $bug = 1; | ||
1278 | } | ||
1279 | |||
1254 | if ($line =~ /\n/) { | 1280 | if ($line =~ /\n/) { |
1255 | $full_line = ""; | 1281 | $full_line = ""; |
1256 | } | 1282 | } |
@@ -1261,7 +1287,7 @@ sub wait_for_monitor { | |||
1261 | } | 1287 | } |
1262 | } | 1288 | } |
1263 | print "** Monitor flushed **\n"; | 1289 | print "** Monitor flushed **\n"; |
1264 | return 0; | 1290 | return $bug; |
1265 | } | 1291 | } |
1266 | 1292 | ||
1267 | sub save_logs { | 1293 | sub save_logs { |