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>
Fix: tests: re-add link to urcu-bp for _LGPL_SOURCE tests Tests with tracepoints defined with _LGPL_SOURCE require to be explicitly linked against urcu-bp. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> 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>
Cleanup: dlmopen detection Simplify dlmopen detection code and use a variable to store the detected lib instead of adding conditionnal code to each Makefile. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: Don't override user variables within the build system Instead use the appropriatly prefixed AM_* variables as to not interfere when a user variable is passed to a make command. The proper use of flag variables is documented at : https://www.gnu.org/software/automake/manual/automake.html#Flag-Variables-Ordering Signed-off-by: Michael Jeanson <mjeanson@efficios.com> 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>
Fix: use LIBS instead of AM_LDFLAGS for dl and c linking The change to --as-needed on linking of the tool chain on Debian based dist break the build. This fix aim to generalize the linking and be independent of the distribution choice of base parameter for the linking process. Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Build fix: Apps defining _LGPL_SOURCE must link to urcu-bp Defining _LGPL_SOURCE causes lttng-ust tracepoint headers to inline uses of userspace-rcu, which make linking against urcu necessary. Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tracepoint probes don't need extern C tracepoint.h has the proper extern C guards, so every liblttng-ust API called from the probe has the proper linkage. The rest of the symbols are only meaningful within the probe, so we don't care if they are mangled or not. This fixes all UST applications in tests/ Fixes #597 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@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>