[autotest] make test_that exit cleanly on ctrl+C, SIGINT, SIGTERM
Prior to this CL, and historically in run_remote_tests, a keyboard
interrupt (CTRL+C) or other form of kill signal sent to test_that would
leave orphaned autoserv processes around. This CL addresses that in
several ways.
It is instructive to look at the process tree that gets created when a
user starts a local test_that run at their desk, in the chroot, since it
contains several layers of test_that bootstrapping before the autoserv
processes:
bash -> test_that [shell script, in path] -> sudo ->
test_that.py [source tree version] ->
test_that.py [sysroot tree version] ->
autoserv
This CL does the following:
1) SIGINT or SIGTERM signals sent to test_that.py [source tree]
will get forwarded to test_that.py [sysroot].
2) SIGINT or SIGTERM signals sent to test_that.py [sysroot] will cause a
SIGINT signal to be sent to the currently running autoserv process, if
one is running. After 5 seconds, if autoserv has not finished cleaning
up and exiting, then it will be killed.
With these changes, sending a SIGINT or SIGTERM to any process from the
sudo process down results in no orphaned processes. Sending a SIGINT or
SIGERM to the test_that shell script is addressed by a separate CL (see
the CQ-DEPEND line below).
BUG=chromium:213051
TEST=CTRL+C after kicking of a local suite with test_that results in
autoserv processes exiting. Sending SIGINT or SIGKILL signals to any
processes up the tree as far as the sudo command results in the same.
CQ-DEPEND=CL:I2391bccbb9086582ee530a129703912690396134
Change-Id: I6bba284f28736e26e0685c9911dbaa4e82a90472
Reviewed-on: https://gerrit.chromium.org/gerrit/58475
Tested-by: Aviv Keshet <akeshet@chromium.org>
Reviewed-by: Alex Miller <milleral@chromium.org>
Commit-Queue: Aviv Keshet <akeshet@chromium.org>
1 file changed