From: Jérémie Galarneau Date: Thu, 15 Feb 2018 16:53:17 +0000 (-0500) Subject: Tests: cleanly exit from test apps on reception of SIGTERM X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=901cb87ccbcde99a10770f79df42c27f2f2d6eb7;hp=901cb87ccbcde99a10770f79df42c27f2f2d6eb7;p=lttng-tools.git 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 ---