Fix: tests: handling of subprocesses on bail out
Observed issue
==============
Background processes of the test_notification_ust tests are present on CI
worker after the jobs is finished.
Cause
=====
The usage of BAIL_OUT during the notap version of stop lttng-sessiond
would end up preventing the normal cleanup of background processes since
we exit directly when issuing the bail out.
Solution
========
Introduce LTTNG_BAIL_OUT.
LTTNG_BAIL_OUT ensure that we call the cleanup path that is normally
used when testing is interrupted.
Add the flag `is_cleanup` to all relevant `*stop_opts` functions.
And introduce the `*_cleanup` functions for relayd, sessiond, consumerd.
While at it, a small rework on how we kill the subprocesses of the
non-iteractive shell was done. This is useful because when using the
test runner the group id of the running process performing the kill is
not valid and result in simply not propagating the SIGTERM signal.
We now use "set -m" to enable monitor mode ensuring that all background
jobs is its own process group id, facilitating the usage of kill with
negative value to ensure that each background jobs subprocesses receives
the SIGTERM signal.
Known drawbacks
=========
We introduce a new lttng specific bail out directive instead of using
the BAIL_OUT from tap.sh
We could override the BAIL_OUT function based on [1].
[1] https://mharrison.org/post/bashfunctionoverride/
References
==========
https://linux.die.net/man/1/bash#:~:text=Monitor%20mode
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I42ce8659df3e1d9078cc1a46a11a33a2df9a145e
This page took 0.025651 seconds and 4 git commands to generate.