OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Konstantin Khorenko <khorenko@virtuozzo.com>
Subject: [Devel] [PATCH RHEL10 COMMIT] selftests/livepatch: do not require a kernel build tree to run
Date: Mon, 24 Aug 2026 12:40:41 +0200	[thread overview]
Message-ID: <202608241040.67OAefOv436261@hci8VM.finist.virtuozzo.com> (raw)
In-Reply-To: <20260821150254.791935-1-eva.kurchatova@virtuozzo.com>

The commit is pushed to "branch-rh10-6.12.0-211.39.1.16.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-211.39.1.16.8.vz10
------>
commit 5d595fa3dd5206631198b5ef8369ad598adca7d5
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Date:   Fri Aug 21 18:02:51 2026 +0300

    selftests/livepatch: do not require a kernel build tree to run
    
    setup_config() calls has_kdir(), which skips every livepatch test when
    /lib/modules/$(uname -r)/build is missing.  The tests do not compile
    anything though, they insmod the pre-built modules from test_modules/,
    so the check tests a proxy rather than the thing it cares about.
    
    That proxy holds only for a source tree or a machine with kernel-devel
    installed.  A packaged testsuite ships the modules pre-built and runs on
    machines with no kernel build tree at all, and there every single test
    reports "ok ... # SKIP".  A harness that looks for "not ok" then reports
    the suite as passed, so the whole suite silently tests nothing.
    
    Test for the modules instead.  Missing modules still skip rather than
    fail, which is what the KDIR check was there for, and the tests now run
    wherever the modules are.
    
    Fixes: 54ee3526796f ("selftests: livepatch: Avoid running the tests if kernel-devel is missing")
    https://virtuozzo.atlassian.net/browse/VSTOR-139647
    Feature: fix selftests
    Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
    Reviewed-by: Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>
    Reviewed-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
 tools/testing/selftests/livepatch/functions.sh | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/tools/testing/selftests/livepatch/functions.sh b/tools/testing/selftests/livepatch/functions.sh
index 46991a029f7c..2dc4f5b4d811 100644
--- a/tools/testing/selftests/livepatch/functions.sh
+++ b/tools/testing/selftests/livepatch/functions.sh
@@ -38,14 +38,12 @@ function is_root() {
 	fi
 }
 
-# Check if we can compile the modules before loading them
-function has_kdir() {
-	if [ -z "$KDIR" ]; then
-		KDIR="/lib/modules/$(uname -r)/build"
-	fi
+# Check that the test modules are there before loading them
+function has_test_modules() {
+	local mods=(test_modules/*.ko)
 
-	if [ ! -d "$KDIR" ]; then
-		echo "skip all tests: KDIR ($KDIR) not available to compile modules."
+	if [ ! -e "${mods[0]}" ]; then
+		echo "skip all tests: test modules are not built, run make first" >&2
 		exit $ksft_skip
 	fi
 }
@@ -130,7 +128,7 @@ function cleanup() {
 #		 the ftrace_enabled sysctl.
 function setup_config() {
 	is_root
-	has_kdir
+	has_test_modules
 	push_config
 	set_dynamic_debug
 	set_ftrace_enabled 1

      parent reply	other threads:[~2026-08-24 10:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21 15:02 [Devel] [PATCH vz10] selftests: livepatch: " Eva Kurchatova
2026-08-24  7:54 ` Vasileios Almpanis
2026-08-24 10:40 ` Konstantin Khorenko [this message]

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=202608241040.67OAefOv436261@hci8VM.finist.virtuozzo.com \
    --to=khorenko@virtuozzo.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