tests: compile some tools/tests as C++ These tests use things from the common libs, or at least include header files from src/common. These files are going to contain C++-specific things in a following commit, so it's easier if we compile them tools/tests as C++. Change-Id: Ib99f2373beb414c50eaa10b35e0d895bc37e4e64 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tests: `gen-ust-nevents`: add syncpoints Adds two sync points: `--sync-in-main`: create a file when `gen-ust-nevents` when app is in main, `--sync-before-first-event`: wait on a file before starting to generate any events. Those two sync points allow for tests to do work when the testapp has reached main BUT before any events are generated. This is useful to perform actions on a UST channel once tracing has started and is active on a particular app. For example, we want to test a scenario where events are enabled once an app is already generating other events. Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com> Change-Id: Id501c8b373e1a9b43aad6caef11672fe6c30a55a
Fix: Tests: `gen-ust-events` doesn't error out on invalid option Issue ===== When running `gen-ust-events` with an invalid option: ./gen-ust-events -h The `getopt_long()` function prints the following error: ./gen-ust-events: invalid option -- 'h' which is very kind of it. The problem is that the process keep running and go on to generate events. It should exit right away. Solution ======== Remove the `break` statement and so that we execute the `goto end` right away. Apply the same changes to `gen-ust-nevents`. Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com> Change-Id: Ib1c96f4c9ed8f98395bf842215f858a69db2bbf0 Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tests: gen-ust-nevents: use options instead of arguments Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com> Change-Id: I59c648c650304e12b30bf8a3eaedaf9727c48700 Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests: Move to kernel style SPDX license identifiers The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. See https://spdx.org/ids-how for details. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Change-Id: I89cd4b4b7440f71f52426a5508252932bb46e796 Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
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: Switch test apps to use usleep_safe() usleep_safe() ensures that usleep honors its timing guarantees (which it, according to the man pages, does not strictly enforce). Some tests need to make ensure no events are emitted at the same timestamp since Babeltrace does not define an ordering which can be relied upon in such a case. Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Add test application with large metadata This application generates 5 tracepoints with a lot of parameters. The resulting metadata is >12kB which is useful to test the behaviour of the UST metadata cache and the flushing mechanism when there is more than one metadata packet. Signed-off-by: Julien Desfossez <jdesfossez@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>