Commit 407b95b7 authored by Steven Rostedt's avatar Steven Rostedt Committed by Steven Rostedt

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: default avatarSteven Rostedt <rostedt@goodmis.org>
parent cf79fab6
...@@ -52,6 +52,7 @@ my %default = ( ...@@ -52,6 +52,7 @@ my %default = (
"STOP_AFTER_SUCCESS" => 10, "STOP_AFTER_SUCCESS" => 10,
"STOP_AFTER_FAILURE" => 60, "STOP_AFTER_FAILURE" => 60,
"STOP_TEST_AFTER" => 600, "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 # required, and we will ask users if they don't have them but we keep the default
# value something that is common. # value something that is common.
...@@ -98,6 +99,7 @@ my $reboot_on_success; ...@@ -98,6 +99,7 @@ my $reboot_on_success;
my $die_on_failure; my $die_on_failure;
my $powercycle_after_reboot; my $powercycle_after_reboot;
my $poweroff_after_halt; my $poweroff_after_halt;
my $max_monitor_wait;
my $ssh_exec; my $ssh_exec;
my $scp_to_target; my $scp_to_target;
my $scp_to_target_install; my $scp_to_target_install;
...@@ -243,6 +245,7 @@ my %option_map = ( ...@@ -243,6 +245,7 @@ my %option_map = (
"POWER_OFF" => \$power_off, "POWER_OFF" => \$power_off,
"POWERCYCLE_AFTER_REBOOT" => \$powercycle_after_reboot, "POWERCYCLE_AFTER_REBOOT" => \$powercycle_after_reboot,
"POWEROFF_AFTER_HALT" => \$poweroff_after_halt, "POWEROFF_AFTER_HALT" => \$poweroff_after_halt,
"MAX_MONITOR_WAIT" => \$max_monitor_wait,
"SLEEP_TIME" => \$sleep_time, "SLEEP_TIME" => \$sleep_time,
"BISECT_SLEEP_TIME" => \$bisect_sleep_time, "BISECT_SLEEP_TIME" => \$bisect_sleep_time,
"PATCHCHECK_SLEEP_TIME" => \$patchcheck_sleep_time, "PATCHCHECK_SLEEP_TIME" => \$patchcheck_sleep_time,
...@@ -1133,7 +1136,10 @@ sub reboot { ...@@ -1133,7 +1136,10 @@ sub reboot {
} }
if (defined($time)) { 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; end_monitor;
} }
} }
...@@ -1228,6 +1234,8 @@ sub wait_for_monitor { ...@@ -1228,6 +1234,8 @@ sub wait_for_monitor {
my $full_line = ""; my $full_line = "";
my $line; my $line;
my $booted = 0; my $booted = 0;
my $start_time = time;
my $now;
doprint "** Wait for monitor to settle down **\n"; doprint "** Wait for monitor to settle down **\n";
...@@ -1246,8 +1254,14 @@ sub wait_for_monitor { ...@@ -1246,8 +1254,14 @@ sub wait_for_monitor {
if ($line =~ /\n/) { if ($line =~ /\n/) {
$full_line = ""; $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"; print "** Monitor flushed **\n";
return 0;
} }
sub save_logs { sub save_logs {
......
...@@ -695,6 +695,14 @@ ...@@ -695,6 +695,14 @@
# (default 60) # (default 60)
#BISECT_SLEEP_TIME = 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) # The time in between patch checks to sleep (in seconds)
# (default 60) # (default 60)
#PATCHCHECK_SLEEP_TIME = 60 #PATCHCHECK_SLEEP_TIME = 60
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment