lttng-tools: skip kernel tests if no kernel modules present

The current tests will run both userspace and kernel testing. Some of use cases
only use lttng for one kind of tracing (e.g. userspace). If the lttng
modules(.ko files) is not present during the test,it would end up with lots of
failing.

Add a check in ptest script, if current system doesn't contain lttng kernel
modules, passing LTTNG_TOOLS_DISABLE_KERNEL_TESTS=1 to make to skip all lttng
kernel related testing.

(From OE-Core rev: e0d8494b569bc5fb45d9a4bafa25527a0ee3d970)

Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Xiangyu Chen
2024-03-07 20:32:21 -08:00
committed by Richard Purdie
parent 8139216000
commit 276332d289
3 changed files with 1272 additions and 0 deletions

View File

@@ -1,8 +1,33 @@
#!/bin/sh
# Without --ignore-exit, the tap harness causes any FAILs within a
# test plan to raise ERRORs; this is just noise.
#Detecting whether current system has lttng kernel modules
LTTNG_KMOD_PATH=/lib/modules/$(uname -r)/kernel/lttng-modules/lttng-tracer.ko
function validate_lttng_modules_present()
{
# Check for loadable modules.
if [ -f "$LTTNG_KMOD_PATH" ]; then
return 0
fi
# Check for builtin modules.
ls /proc/lttng > /dev/null 2>&1
if [ $? -eq 0 ]; then
return 0
fi
return 1
}
export LD_LIBRARY_PATH=FIXMEPTESTPATH/tests/utils/testapp/userspace-probe-elf-binary/.libs
makeargs="LOG_DRIVER_FLAGS=--ignore-exit top_srcdir=FIXMEPTESTPATH top_builddir=FIXMEPTESTPATH"
#If current system doesn't have lttng kernel modules, disable lttng kernel related tests.
validate_lttng_modules_present || {
makeargs="$makeargs LTTNG_TOOLS_DISABLE_KERNEL_TESTS=1"
}
make -k -t all >error.log 2>&1
# Can specify a test e.g.:
# -C tests/regression/ check TESTS='kernel/test_callstack'

View File

@@ -37,6 +37,7 @@ SRC_URI = "https://lttng.org/files/lttng-tools/lttng-tools-${PV}.tar.bz2 \
file://lttng-sessiond.service \
file://disable-tests.patch \
file://0001-compat-Define-off64_t-as-off_t-on-linux.patch \
file://0001-tests-add-check_skip_kernel_test-to-check-root-user-.patch \
"
SRC_URI[sha256sum] = "ac5baeef9fa690936b1ca01ecd1742da762c2c08511ff1b4e923938d94d0f979"