Openembedded Core Discussions
 help / color / mirror / Atom feed
From: OOHehir <oo.hehir@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: raj.khem@gmail.com, tgamblin@baylibre.com,
	mathieu.dubois-briand@bootlin.com, OOHehir <oo.hehir@gmail.com>
Subject: [PATCH v2 4/8] lttng-tools: skip kernel cases when kernel tests are disabled
Date: Sat, 17 Oct 2026 12:23:53 +0100	[thread overview]
Message-ID: <20261017112358.77434-5-oo.hehir@gmail.com> (raw)
In-Reply-To: <20261017112358.77434-1-oo.hehir@gmail.com>

run-ptest sets LTTNG_TOOLS_DISABLE_KERNEL_TESTS when lttng-modules is not
installed, as on riscv64, but kernel/test_event_disable.py &
tools/save-load/test_save_load.py check only for root & fail with "Kernel
tracer not available". Carry the fix sent upstream.

Signed-off-by: OOHehir <oo.hehir@gmail.com>
---
 ...our-LTTNG_TOOLS_DISABLE_KERNEL_TESTS.patch | 108 ++++++++++++++++++
 .../lttng/lttng-tools_2.16.0.bb               |   1 +
 2 files changed, 109 insertions(+)
 create mode 100644 meta/recipes-kernel/lttng/lttng-tools/0001-tests-honour-LTTNG_TOOLS_DISABLE_KERNEL_TESTS.patch

diff --git a/meta/recipes-kernel/lttng/lttng-tools/0001-tests-honour-LTTNG_TOOLS_DISABLE_KERNEL_TESTS.patch b/meta/recipes-kernel/lttng/lttng-tools/0001-tests-honour-LTTNG_TOOLS_DISABLE_KERNEL_TESTS.patch
new file mode 100644
index 0000000000..ca041e8da8
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-tools/0001-tests-honour-LTTNG_TOOLS_DISABLE_KERNEL_TESTS.patch
@@ -0,0 +1,108 @@
+From f56f36ecd7481d96c99876e8a6f4a609197e7132 Mon Sep 17 00:00:00 2001
+From: OOHehir <oo.hehir@gmail.com>
+Date: Tue, 13 Oct 2026 09:41:51 +0100
+Subject: [PATCH] Fix: tests: honour LTTNG_TOOLS_DISABLE_KERNEL_TESTS in two
+ Python tests
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+OBSERVED ISSUE
+━━━━━━━━━━━━━━
+On a target without lttng-modules, kernel/test_event_disable.py & the
+kernel cases of tools/save-load/test_save_load.py fail with "Kernel tracer
+not available", although the test run sets LTTNG_TOOLS_DISABLE_KERNEL_TESTS=1.
+Observed with the Yocto Project ptest on riscv64, which ships no lttng-modules.
+
+CAUSE
+━━━━━
+Both scripts only check that they run as root before running kernel cases,
+while the other Python tests use lttngtest._Environment.run_kernel_tests(),
+which also honours LTTNG_TOOLS_DISABLE_KERNEL_TESTS.
+
+SOLUTION
+━━━━━━━━
+Use run_kernel_tests() in both scripts. It checks for root as before, & also
+honours LTTNG_TOOLS_DISABLE_KERNEL_TESTS.
+
+Under review on Gerrit: https://review.lttng.org/c/lttng-tools/+/18903
+
+Upstream-Status: Submitted [https://lists.lttng.org/pipermail/lttng-dev/2026-October/031100.html]
+Signed-off-by: OOHehir <oo.hehir@gmail.com>
+---
+ tests/regression/kernel/test_event_disable.py      | 7 ++-----
+ tests/regression/tools/save-load/test_save_load.py | 9 ++++-----
+ 2 files changed, 6 insertions(+), 10 deletions(-)
+
+diff --git a/tests/regression/kernel/test_event_disable.py b/tests/regression/kernel/test_event_disable.py
+index da9f146..a373544 100755
+--- a/tests/regression/kernel/test_event_disable.py
++++ b/tests/regression/kernel/test_event_disable.py
+@@ -15,7 +15,6 @@ Validates that disabling events works correctly:
+ - Disabling by name disables all matching rules regardless of filters
+ """
+ 
+-import os
+ import pathlib
+ import sys
+ import traceback
+@@ -307,11 +306,9 @@ if __name__ == "__main__":
+         ),
+     ]
+ 
+-    is_root = os.getuid() == 0
+-
+-    if not is_root:
++    if not lttngtest._Environment.run_kernel_tests():
+         tap = lttngtest.TapGenerator(len(kernel_tests))
+-        tap.skip_all_remaining("Kernel tests require root privileges")
++        tap.skip_all_remaining("Kernel tests not enabled")
+         sys.exit(0)
+ 
+     tap = lttngtest.TapGenerator(len(kernel_tests))
+diff --git a/tests/regression/tools/save-load/test_save_load.py b/tests/regression/tools/save-load/test_save_load.py
+index 9dd8042..1983263 100755
+--- a/tests/regression/tools/save-load/test_save_load.py
++++ b/tests/regression/tools/save-load/test_save_load.py
+@@ -13,7 +13,6 @@ through save/load cycles, including:
+ - Kernel syscalls and tracepoints
+ """
+ 
+-import os
+ import pathlib
+ import sys
+ import traceback
+@@ -953,11 +952,11 @@ if __name__ == "__main__":
+         ),
+     ]
+ 
+-    is_root = os.getuid() == 0
++    run_kernel_tests = lttngtest._Environment.run_kernel_tests()
+     allows_destructive = lttngtest._Environment.allows_destructive()
+ 
+     total_tests = len(user_tests) + len(agent_tests)
+-    if is_root:
++    if run_kernel_tests:
+         total_tests += len(kernel_tests)
+         if allows_destructive:
+             total_tests += len(destructive_kernel_tests)
+@@ -971,7 +970,7 @@ if __name__ == "__main__":
+         for test_name, test_func, kwargs in agent_tests:
+             run_test(tap, test_env, test_func, test_name, **kwargs)
+ 
+-    if is_root:
++    if run_kernel_tests:
+         with lttngtest.test_environment(
+             with_sessiond=True, log=tap.diagnostic, enable_kernel_domain=True
+         ) as test_env:
+@@ -986,6 +985,6 @@ if __name__ == "__main__":
+                     "Skipping destructive kernel tests (LTTNG_ENABLE_DESTRUCTIVE_TESTS not set)"
+                 )
+     else:
+-        tap.diagnostic("Skipping kernel tests (not running as root)")
++        tap.diagnostic("Skipping kernel tests (not enabled)")
+ 
+     sys.exit(0 if tap.is_successful else 1)
+-- 
+2.43.0
+
diff --git a/meta/recipes-kernel/lttng/lttng-tools_2.16.0.bb b/meta/recipes-kernel/lttng/lttng-tools_2.16.0.bb
index cfc16ed6c7..347bdcc273 100644
--- a/meta/recipes-kernel/lttng/lttng-tools_2.16.0.bb
+++ b/meta/recipes-kernel/lttng/lttng-tools_2.16.0.bb
@@ -72,6 +72,7 @@ SRC_URI = "https://lttng.org/files/lttng-tools/lttng-tools-${PV}.tar.bz2 \
            file://disable-tests2.patch \
            file://0001-m4-ax_am_macros_static.m4-do-not-write-generation-da.patch \
            file://muslfix.patch \
+           file://0001-tests-honour-LTTNG_TOOLS_DISABLE_KERNEL_TESTS.patch \
            "
 
 SRC_URI[sha256sum] = "b8b3244894e49e773d4942b8899f768057974edf75c18dbb48b65bb123c7b2c7"
-- 
2.43.0



  parent reply	other threads:[~2026-10-17 11:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16 20:45 [PATCH 0/7] riscv64 ptest fixes OOHehir
2026-10-16 20:45 ` [PATCH 1/7] strace: skip qual_fault-syscall.test on riscv64 OOHehir
2026-10-16 20:45 ` [PATCH 2/7] ptest-packagelists.inc: re-enable strace for riscv64 OOHehir
2026-10-16 20:45 ` [PATCH 3/7] ptest-packagelists.inc: re-enable python3 " OOHehir
2026-10-16 20:45 ` [PATCH 4/7] lttng-tools: skip kernel cases when kernel tests are disabled OOHehir
2026-10-16 20:45 ` [PATCH 5/7] tcl, tcl8: skip binary-40.3 on RISC-V OOHehir
2026-10-17 10:29   ` [OE-core] " Mathieu Dubois-Briand
2026-10-17 11:21     ` Owen O'Hehir
2026-10-16 20:45 ` [PATCH 6/7] ptest-packagelists.inc: re-enable tcl8 for riscv64 OOHehir
2026-10-16 20:45 ` [PATCH 7/7] python3-numpy: call libm for ceil/floor/trunc on riscv64 OOHehir
2026-10-17 11:23 ` [PATCH v2 0/8] riscv64 ptest fixes OOHehir
2026-10-17 11:23   ` [PATCH v2 1/8] strace: skip qual_fault-syscall.test on riscv64 OOHehir
2026-10-17 11:23   ` [PATCH v2 2/8] ptest-packagelists.inc: re-enable strace for riscv64 OOHehir
2026-10-17 11:23   ` [PATCH v2 3/8] ptest-packagelists.inc: re-enable python3 " OOHehir
2026-10-17 11:23   ` OOHehir [this message]
2026-10-17 11:23   ` [PATCH v2 5/8] tcl, tcl8: anchor the musl unixInit-3 skip to top-level SKIP lines OOHehir
2026-10-17 11:23   ` [PATCH v2 6/8] tcl, tcl8: skip binary-40.3 on RISC-V OOHehir
2026-10-17 11:23   ` [PATCH v2 7/8] ptest-packagelists.inc: re-enable tcl8 for riscv64 OOHehir
2026-10-17 11:23   ` [PATCH v2 8/8] python3-numpy: call libm for ceil/floor/trunc on riscv64 OOHehir

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261017112358.77434-5-oo.hehir@gmail.com \
    --to=oo.hehir@gmail.com \
    --cc=mathieu.dubois-briand@bootlin.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=raj.khem@gmail.com \
    --cc=tgamblin@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox