From: Kienan Stewart Date: Wed, 19 Feb 2025 20:23:49 +0000 (-0500) Subject: tests: Avoid failing on loaded modules when kernel tests are skipped X-Git-Url: http://git.lttng.org./?a=commitdiff_plain;h=3821394295d4cf08b696dbc29e9d44d20f657ae1;p=lttng-tools.git tests: Avoid failing on loaded modules when kernel tests are skipped 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 Signed-off-by: Jérémie Galarneau --- diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 190199a9f..69d8c8936 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -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