ktest.pl: Add RUN_TIMEOUT option with default unlimited
authorSteven Rostedt <rostedt@goodmis.org>
Wed, 18 Jan 2023 21:37:25 +0000 (16:37 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:40:10 +0000 (09:40 +0100)
commit145999aed74fba94a620b3e79858346b990feac0
tree18dce208b307042cf3236151dd02f54e98bbcd6a
parentaab7db9e1e08879f64a4b935fc83e851f0c8d4d7
ktest.pl: Add RUN_TIMEOUT option with default unlimited

commit 4e7d2a8f0b52abf23b1dc13b3d88bc0923383cd5 upstream.

There is a disconnect between the run_command function and the
wait_for_input. The wait_for_input has a default timeout of 2 minutes. But
if that happens, the run_command loop will exit out to the waitpid() of
the executing command. This fails in that it no longer monitors the
command, and also, the ssh to the test box can hang when its finished, as
it's waiting for the pipe it's writing to to flush, but the loop that
reads that pipe has already exited, leaving the command stuck, and the
test hangs.

Instead, make the default "wait_for_input" of the run_command infinite,
and allow the user to override it if they want with a default timeout
option "RUN_TIMEOUT".

But this fixes the hang that happens when the pipe is full and the ssh
session never exits.

Cc: stable@vger.kernel.org
Fixes: 6e98d1b4415fe ("ktest: Add timeout to ssh command")
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/testing/ktest/ktest.pl
tools/testing/ktest/sample.conf