]> git.lttng.org Git - lttng-tools.git/commitdiff
tests: Avoid failing on loaded modules when kernel tests are skipped
authorKienan Stewart <kstewart@efficios.com>
Wed, 19 Feb 2025 20:23:49 +0000 (15:23 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 21 Feb 2025 22:24:53 +0000 (22:24 +0000)
In the future I would like to be able to run lttng-sessiond of the
container host for various reasons. When loaded on the host as the
root user, the lttng-modules are loaded when available - and this is
visible inside the containers which share the kernel. Some tests
validate that the modules are unloaded even if the kernel testing has
been skipped.

The second part of this change limits the possible PID search space to
those started by the current user. This avoids situations where a
non-privileged user tries to kill the lttng-sessiond run by root.

Change-Id: I0cec2e385f37c62d8961488751805b1248ce2687
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/utils/utils.sh

index 190199a9f556c1715a0ddc80737c358c125b483d..69d8c89363800b1d4f7f25d09496fac0ce1a08f9 100644 (file)
@@ -211,7 +211,7 @@ function lttng_pgrep ()
        local full_command_no_argument
        local command_basename
 
-       possible_pids=$($PGREP -f "$pattern")
+       possible_pids=$($PGREP -f "$pattern" -u "${UID}")
        if [ -z "$possible_pids" ]; then
                return 0
        fi
@@ -486,6 +486,7 @@ function _lttng_modules_loaded_opt
        local ret
        local message="%d LTTng modules loaded, expected count "
 
+       check_skip_kernel_test 1 && return
        if [[ "${fail_when_present}" -eq "1" ]] ; then
                message+="= 0"
        else
This page took 0.030042 seconds and 4 git commands to generate.