Tests: cleanly exit from test apps on reception of SIGTERM
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 15 Feb 2018 16:53:17 +0000 (11:53 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 15 Feb 2018 20:37:23 +0000 (15:37 -0500)
commit901cb87ccbcde99a10770f79df42c27f2f2d6eb7
tree2e684a678e13e8a744afb694a4155dc4893ad4c5
parentba0fd12e76b350b27788610eb64b6b5fab2215f9
Tests: cleanly exit from test apps on reception of SIGTERM

There is a known lttng-ust limitation that can cause a buffer
to become unreadable if an application is killed or preempted
indefinitely between the reserve and commit operations in
while trying to record to a subbuffer.

A buffer being unreadable will cause some tests to fail since
events that are expected to be visible in a given stream
may not be shown by the trace viewers as the consumer was
unable to "get" that subbuffer.

It was fairly easy to reproduce this failure scenario using
the test_ust_fast snapshot test, in the "post_mortem" case.

This test case performs the following sequence of operations:

* setup a tracing session in snapshot mode
* launch an app
* kill(1) it after one event is known to have been produced
* record a snapshot
* try to read the resulting snapshot

Adding logging allowed the confirmation that the "get"
operation was indeed failing on the subbuffer to which the
application had run. This resulted in an empty stream
(file size == 0) being produced by the snapshot record operation.
The test was then failing because babeltrace reported that no
events were contained in the resulting trace.

Since there are no concrete solution to this limitation yet,
the test suite must ensure that the applications exit cleanly
on reception of a signal.

This patch introduces a SIGTERM signal handler in the test
applications which sets a "should_quit" flag to 1 and is
tested between every iteration of their event production loop.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/utils/testapp/Makefile.am
tests/utils/testapp/gen-ust-events/Makefile.am
tests/utils/testapp/gen-ust-events/gen-ust-events.c
tests/utils/testapp/gen-ust-nevents/Makefile.am
tests/utils/testapp/gen-ust-nevents/gen-ust-nevents.c
tests/utils/testapp/gen-ust-tracef/Makefile.am
tests/utils/testapp/gen-ust-tracef/gen-ust-tracef.c
tests/utils/testapp/signal-helper.h [new file with mode: 0644]
This page took 0.027865 seconds and 5 git commands to generate.