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:13:28 +0000 (15:13 -0500)
commit95170e51ab1938d82b929549e2d4d813a56c163e
treeac8bf137e013363c24c2b635cc33bfa134160ada
parent54a3f90379492bcfa90e261922232d1a24372fd5
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-str/Makefile.am
tests/utils/testapp/gen-ust-nevents-str/gen-ust-nevents-str.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.025921 seconds and 4 git commands to generate.