Updates to ktest.pl:

- Fix three instances that the tty is not given back to the console on exit.
   Forcing the user to do a "reset" to get the console back.
 
 - Fix the console monitor to not hang when too much data is given by the ssh
   output.
 -----BEGIN PGP SIGNATURE-----
 
 iIoEABYIADIWIQRRSw7ePDh/lE+zeZMp5XQQmuv6qgUCY/OmkhQccm9zdGVkdEBn
 b29kbWlzLm9yZwAKCRAp5XQQmuv6qlfKAP9ijinbEXt+fuuhjB0HqmERelUBKH9g
 9HiQl+yzKh2LiQEAgnOKK8j3MO1VUOlmVso38+Kc3Tp1jEr0KbooTqKiPAU=
 =aoI2
 -----END PGP SIGNATURE-----

Merge tag 'ktest-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest

Pull ktest updates from Steven Rostedt:

 - Fix three instances that the tty is not given back to the console on
   exit. Forcing the user to do a "reset" to get the console back.

 - Fix the console monitor to not hang when too much data is given by
   the ssh output.

* tag 'ktest-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest:
  ktest: Restore stty setting at first in dodie
  ktest.pl: Add RUN_TIMEOUT option with default unlimited
  ktest.pl: Give back console on Ctrt^C on monitor
  ktest.pl: Fix missing "end_monitor" when machine check fails
This commit is contained in:
Linus Torvalds 2023-02-23 09:49:00 -08:00
commit 2562af68f0
2 changed files with 31 additions and 10 deletions

View File

@ -178,6 +178,7 @@ my $store_failures;
my $store_successes;
my $test_name;
my $timeout;
my $run_timeout;
my $connect_timeout;
my $config_bisect_exec;
my $booted_timeout;
@ -340,6 +341,7 @@ my %option_map = (
"STORE_SUCCESSES" => \$store_successes,
"TEST_NAME" => \$test_name,
"TIMEOUT" => \$timeout,
"RUN_TIMEOUT" => \$run_timeout,
"CONNECT_TIMEOUT" => \$connect_timeout,
"CONFIG_BISECT_EXEC" => \$config_bisect_exec,
"BOOTED_TIMEOUT" => \$booted_timeout,
@ -1495,7 +1497,8 @@ sub reboot {
# Still need to wait for the reboot to finish
wait_for_monitor($time, $reboot_success_line);
}
if ($powercycle || $time) {
end_monitor;
}
}
@ -1535,6 +1538,11 @@ sub dodie {
return if ($in_die);
$in_die = 1;
if ($monitor_cnt) {
# restore terminal settings
system("stty $stty_orig");
}
my $i = $iteration;
doprint "CRITICAL FAILURE... [TEST $i] ", @_, "\n";
@ -1581,11 +1589,6 @@ sub dodie {
"Your test started at $script_start_time has failed with:\n@_\n", $log_file);
}
if ($monitor_cnt) {
# restore terminal settings
system("stty $stty_orig");
}
if (defined($post_test)) {
run_command $post_test;
}
@ -1857,6 +1860,14 @@ sub run_command {
$command =~ s/\$SSH_USER/$ssh_user/g;
$command =~ s/\$MACHINE/$machine/g;
if (!defined($timeout)) {
$timeout = $run_timeout;
}
if (!defined($timeout)) {
$timeout = -1; # tell wait_for_input to wait indefinitely
}
doprint("$command ... ");
$start_time = time;
@ -1883,13 +1894,10 @@ sub run_command {
while (1) {
my $fp = \*CMD;
if (defined($timeout)) {
doprint "timeout = $timeout\n";
}
my $line = wait_for_input($fp, $timeout);
if (!defined($line)) {
my $now = time;
if (defined($timeout) && (($now - $start_time) >= $timeout)) {
if ($timeout >= 0 && (($now - $start_time) >= $timeout)) {
doprint "Hit timeout of $timeout, killing process\n";
$hit_timeout = 1;
kill 9, $pid;
@ -2061,6 +2069,11 @@ sub wait_for_input {
$time = $timeout;
}
if ($time < 0) {
# Negative number means wait indefinitely
undef $time;
}
$rin = '';
vec($rin, fileno($fp), 1) = 1;
vec($rin, fileno(\*STDIN), 1) = 1;
@ -4200,6 +4213,9 @@ sub send_email {
}
sub cancel_test {
if ($monitor_cnt) {
end_monitor;
}
if ($email_when_canceled) {
my $name = get_test_name;
send_email("KTEST: Your [$name] test was cancelled",

View File

@ -817,6 +817,11 @@
# is issued instead of a reboot.
# CONNECT_TIMEOUT = 25
# The timeout in seconds for how long to wait for any running command
# to timeout. If not defined, it will let it go indefinitely.
# (default undefined)
#RUN_TIMEOUT = 600
# In between tests, a reboot of the box may occur, and this
# is the time to wait for the console after it stops producing
# output. Some machines may not produce a large lag on reboot