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: check for dtrace and sdt.h before enabling SDT uprobe tests Add a configure switch '--enable-sdt-uprobe / --disable-sdt-uprobe', the default behavior of enabling the test if the requirements are found is kept but it's now possible to explicitly disable it. Also add the detection of the dtrace binary and its override trough the DTRACE environment variable. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Implement userspace-probe regression tests This adds regression testcases for the following userspace probe features and should-fail scenarios. Features: * ELF function location tracing works, * ELF C++ mangled function and method location tracing works, * SDT tracepoint location tracing works, * Implicit location type defaults to ELF location, * Binary found $PATH, * Binary found using full path, * Binary with colon in file name, * Disabling of all location types, * Listing of all location types, * Saving and loading of all location types, * SDT probe with one or more callsites, * SDT probe with arguments, * SDT probe in shared object, * SDT probe in dlopen()ed and ldpreload()ed shared object. Should-fail: * Target binary does not exist, * Target binary not ELF file, * ELF symbol not found in target binary, * ELF symbol not a function, * SDT provider name not found, * SDT probe name not found, * SDT probe guarded by a semaphore. We also make sure to disable testcases when the necessary files/tools for them are not found: * Disables C++ testcases if no C++ compiler is found. * Disables SDT testcases if the Systemtap header files are not found. This is tested by trying to compile a simple C program with a SDT probe. If it fails, it will only disable the testcases and not the feature since the SDT userspace probe feature does not use this header for parsing. Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com> Signed-off-by: Erica Bugden <ebugden@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tests: Add callstack contexts tests Tests callstack-user and callstack-kernel contexts by tracing with those contexts an application that calls multiple functions in chain before executing a system call. callstack-user addresses are tested against the output of coreutils' addr2line. callstack-kernel addresses are tested against the addresses of kernel symbols available in the /proc/kallsyms procfile. Both these tests need to be run by root because those contexts are made available by the kernel tracer. The callstack-kernel test also need to access /proc/kallsyms. Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tests: Add test app to generate syscalls This app launches and waits for the creation of a file specified in the arguments before executing syscalls. This can be used with the PID tracker feature of LTTng to only trace the syscalls made by the test process and thus makes the tests more reliable. Signed-off-by: Francis Deslauriers <francis.deslauriers@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>
Tests: utils: add gen-ust-nevents-str util This program generates a given number of UST events, each one having in its payload the next command-line argument string in a cycle: gen-ust-nevents-str 10 hello world its me will generate 10 events with the following strings: hello world its me hello world its me hello world Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com> 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>
Tests: Cleanup and move gen-ust-events testapp under utils This will improve the maintainability and stop the copying madness going on in each test needing a UST sample application. Application under test should go in tests/utils/testapp/<testapp_name>/. Signed-off-by: Christian Babeux <christian.babeux@efficios.com> Signed-off-by: David Goulet <dgoulet@efficios.com>