tests: add check_skip_kernel_test to check root user and lttng kernel modules The current tests will run both userspace and kernel testing. Some of use cases only use lttng for one kind of tracing on an embedded device (e.g. userspace), so in this scenario, the kernel modules might not install to target rootfs, the test cases would be fail and exit. Add LTTNG_TOOLS_DISABLE_KERNEL_TESTS to skip the lttng kernel features test, this flag can be set via "make": make check LTTNG_TOOLS_DISABLE_KERNEL_TESTS=1 When this flag was set, all kernel related testcases would be marked as SKIP in result. Since the the LTTNG_TOOLS_DISABLE_KERNEL_TESTS was checked in function check_skip_kernel_test, lots of testcases also need to check root permission, so merging the root permission checking into check_skip_kernel_test. Change-Id: I49a1f642a9869c21a69e0186c296fd917bd7b525 Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com> Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
port: add support for BSD mktemp Use '-t' which is portable instead of the GNU specific '--tmpdir'. Change-Id: I430af6b96c27c2766a2cc4b5574af8563297d717 Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Cleanup: tests: name all temporary files to better identify leakage When using a template, we need to add `--tmpdir` to the `mktemp` arguments to place the tmp files in `/tmp` or `$TMPDIR`. Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com> Change-Id: Id107530578d91700b726ceec016a8cef772e94b0
Fix: Tests: leftover temporary files after tests Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com> Change-Id: Ie0c66d45a00e890c1f1e8dc8db7b1baa2cca50f1
Fix: tests: `pgrep -f` flags unrelated process as lttng-sessiond Observed issue ============== lttng-sessiond is not started by start_lttng_sessiond_opt and a vim process is killed on stop_lttng_sessiond_opt. Cause ===== We uses "pgrep -f" with the interested pattern to gather the pids that should be the lttng processes we are interested in. `pgrep -f` yields false positives since it matches against the complete cmdline including parent directory of the command and all arguments. For example, the following will currently match for the sessiond pattern: vim src/bin/lttng-sessiond/notification-thread-internal.h This prevents the launch of sessiond by start_lttng_sessiond_opt and end up killing the vim process on stop_lttng_sessiond_opt. Solution ======== To alleviate this, we propose a two stage lookup. The first stage uses "pgrep -f" yielding potential candidates. The second stage performs grep on the basename of the first field of the /proc/[pid]/cmdline for each pid candidates. The first field of /proc/[pid]/cmdline corresponds to the actual command. We use the basename to ensure that we do not match on the path to the executable. Known drawbacks ========= None References ========== https://review.lttng.org/c/lttng-tools/+/3043 Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com> Change-Id: I479ebad27f4965ae16d4442a6fe58ff3157d76fa
Tests: fix: test_relayd_working_directory fails as user A formating issue introduced by 15da468cd causes the temporary directory of the a test to be initialized incorrectly, causing it to fail when it is not skipped (executed as a non-root user). Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com> Change-Id: Idd09f27fa2ce0f5991056ab52bc1718080122151
Tests: fix: test_relayd_working_directory fails as root From the original bug report: This test succeeds as user, but fails as root: not ok 23 - Warning about missing write permission is present Failed test 'Warning about missing write permission is present' in tools/working-directory/test_relayd_working_directory:test_relayd_debug_permission() at line 182. The warning does not trigger because root always has access. Skip this test since the permission check will succeed and the relay daemon won't produce the expected error message. Reported-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com> Change-Id: I4eb29958aaca78405e1fdd2392d73472af0d5912
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>
Introduce LTTNG_RELAYD_WORKING_DIRECTORY environment variable LTTNG_RELAYD_WORKING_DIRECTORY is equivalent to the --working-directory command line options. Note: when using --working-directory, the command line option always overwrite the environment configuration, LTTNG_RELAYD_WORKING_DIRECTORY in this case. Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>