aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2012-07-19 16:05:42 -0400
committerSteven Rostedt <rostedt@goodmis.org>2012-07-19 16:05:42 -0400
commit407b95b7a085b5c1622033edc2720bb05f973317 (patch)
treee0977a65008479b4f67b84fb6ac20b86cc70eb13 /tools
parentcf79fab676b3aa3b5fbae95aab25e2d4e26e4224 (diff)
ktest: Add MAX_MONITOR_WAIT option
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>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/ktest/ktest.pl16
-rw-r--r--tools/testing/ktest/sample.conf8
2 files changed, 23 insertions, 1 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 5ad891a08113..d10fff12bc24 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -52,6 +52,7 @@ my %default = (
52 "STOP_AFTER_SUCCESS" => 10, 52 "STOP_AFTER_SUCCESS" => 10,
53 "STOP_AFTER_FAILURE" => 60, 53 "STOP_AFTER_FAILURE" => 60,
54 "STOP_TEST_AFTER" => 600, 54 "STOP_TEST_AFTER" => 600,
55 "MAX_MONITOR_WAIT" => 1800,
55 56
56# required, and we will ask users if they don't have them but we keep the default 57# required, and we will ask users if they don't have them but we keep the default
57# value something that is common. 58# value something that is common.
@@ -98,6 +99,7 @@ my $reboot_on_success;
98my $die_on_failure; 99my $die_on_failure;
99my $powercycle_after_reboot; 100my $powercycle_after_reboot;
100my $poweroff_after_halt; 101my $poweroff_after_halt;
102my $max_monitor_wait;
101my $ssh_exec; 103my $ssh_exec;
102my $scp_to_target; 104my $scp_to_target;
103my $scp_to_target_install; 105my $scp_to_target_install;
@@ -243,6 +245,7 @@ my %option_map = (
243 "POWER_OFF" => \$power_off, 245 "POWER_OFF" => \$power_off,
244 "POWERCYCLE_AFTER_REBOOT" => \$powercycle_after_reboot, 246 "POWERCYCLE_AFTER_REBOOT" => \$powercycle_after_reboot,
245 "POWEROFF_AFTER_HALT" => \$poweroff_after_halt, 247 "POWEROFF_AFTER_HALT" => \$poweroff_after_halt,
248 "MAX_MONITOR_WAIT" => \$max_monitor_wait,
246 "SLEEP_TIME" => \$sleep_time, 249 "SLEEP_TIME" => \$sleep_time,
247 "BISECT_SLEEP_TIME" => \$bisect_sleep_time, 250 "BISECT_SLEEP_TIME" => \$bisect_sleep_time,
248 "PATCHCHECK_SLEEP_TIME" => \$patchcheck_sleep_time, 251 "PATCHCHECK_SLEEP_TIME" => \$patchcheck_sleep_time,
@@ -1133,7 +1136,10 @@ sub reboot {
1133 } 1136 }
1134 1137
1135 if (defined($time)) { 1138 if (defined($time)) {
1136 wait_for_monitor($time, $reboot_success_line); 1139 if (wait_for_monitor($time, $reboot_success_line)) {
1140 # reboot got stuck?
1141 run_command "$power_cycle";
1142 }
1137 end_monitor; 1143 end_monitor;
1138 } 1144 }
1139} 1145}
@@ -1228,6 +1234,8 @@ sub wait_for_monitor {
1228 my $full_line = ""; 1234 my $full_line = "";
1229 my $line; 1235 my $line;
1230 my $booted = 0; 1236 my $booted = 0;
1237 my $start_time = time;
1238 my $now;
1231 1239
1232 doprint "** Wait for monitor to settle down **\n"; 1240 doprint "** Wait for monitor to settle down **\n";
1233 1241
@@ -1246,8 +1254,14 @@ sub wait_for_monitor {
1246 if ($line =~ /\n/) { 1254 if ($line =~ /\n/) {
1247 $full_line = ""; 1255 $full_line = "";
1248 } 1256 }
1257 $now = time;
1258 if ($now - $start_time >= $max_monitor_wait) {
1259 doprint "Exiting monitor flush due to hitting MAX_MONITOR_WAIT\n";
1260 return 1;
1261 }
1249 } 1262 }
1250 print "** Monitor flushed **\n"; 1263 print "** Monitor flushed **\n";
1264 return 0;
1251} 1265}
1252 1266
1253sub save_logs { 1267sub save_logs {
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf
index e4a12da75ba6..de28a0a3b8fc 100644
--- a/tools/testing/ktest/sample.conf
+++ b/tools/testing/ktest/sample.conf
@@ -695,6 +695,14 @@
695# (default 60) 695# (default 60)
696#BISECT_SLEEP_TIME = 60 696#BISECT_SLEEP_TIME = 60
697 697
698# The max wait time (in seconds) for waiting for the console to finish.
699# If for some reason, the console is outputting content without
700# ever finishing, this will cause ktest to get stuck. This
701# option is the max time ktest will wait for the monitor (console)
702# to settle down before continuing.
703# (default 1800)
704#MAX_MONITOR_WAIT
705
698# The time in between patch checks to sleep (in seconds) 706# The time in between patch checks to sleep (in seconds)
699# (default 60) 707# (default 60)
700#PATCHCHECK_SLEEP_TIME = 60 708#PATCHCHECK_SLEEP_TIME = 60