OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Konstantin Khorenko <khorenko@virtuozzo.com>
Subject: [Devel] [PATCH vz10 v3 1/2] selftests: do not hide a missing kernel build tree
Date: Thu, 13 Aug 2026 19:58:05 +0200	[thread overview]
Message-ID: <20260813175806.236084-2-khorenko@virtuozzo.com> (raw)
In-Reply-To: <20260813175806.236084-1-khorenko@virtuozzo.com>

The livepatch and cgroup test module Makefiles wrap their recipes into a
KDIR existence test:

	# Ensure that KDIR exists, otherwise skip the compilation
	modules:
	ifneq ("$(wildcard $(KDIR))", "")
		$(Q)$(MAKE) -C $(KDIR) modules KBUILD_EXTMOD=$(TESTMODS_DIR)
	endif

so the test modules are silently not built when KDIR is not there: the
target simply loses its recipe and make reports success. The test comes
from commit 54ee3526796f ("selftests: livepatch: Avoid running the tests
if kernel-devel is missing"), which was a reaction to a kernel test robot
build failure report, and the cgroup Makefile copied the pattern later.
bpf/test_kmods and mm/page_frag never had such a test and simply fail, so
the tree is not consistent about it either.

A silent skip is the worst possible outcome for a packaged testsuite: the
test modules are missing from the rpm, the build log says nothing about
it, and the failure only surfaces on a test node as a test which cannot
find its module, far away from the cause.

Nothing is lost by dropping it, because the selftests framework already
implements the "do not fail everything because of one target" policy and
kernel packaging passes FORCE_TARGETS=1 exactly because it wants to know
whether every test module has been built:

  all:
	@ret=1;							\
	for TARGET in $(TARGETS); do				\
		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET	\
				O=$(abs_objtree)		\
				$(if $(FORCE_TARGETS),|| exit);	\
		ret=$$((ret * $$?));				\
	done; exit $$ret;

So drop the tests and let make -C fail and say why. This also puts the
two Makefiles back in line with bpf/test_kmods and mm/page_frag.

https://virtuozzo.atlassian.net/browse/VSTOR-139647
Feature: fix selftests
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
 tools/testing/selftests/cgroup/test_modules/Makefile    | 6 ------
 tools/testing/selftests/livepatch/test_modules/Makefile | 6 ------
 2 files changed, 12 deletions(-)

diff --git a/tools/testing/selftests/cgroup/test_modules/Makefile b/tools/testing/selftests/cgroup/test_modules/Makefile
index 3f39eeda3a92b..38121d783d921 100644
--- a/tools/testing/selftests/cgroup/test_modules/Makefile
+++ b/tools/testing/selftests/cgroup/test_modules/Makefile
@@ -4,14 +4,8 @@ KDIR ?= /lib/modules/$(shell uname -r)/build
 obj-m += cg_freezer_hang.o \
 	cg_freezer_kthread.o
 
-# Ensure that KDIR exists, otherwise skip the compilation
 modules:
-ifneq ("$(wildcard $(KDIR))", "")
 	$(Q)$(MAKE) -C $(KDIR) modules KBUILD_EXTMOD=$(TESTMODS_DIR)
-endif
 
-# Ensure that KDIR exists, otherwise skip the clean target
 clean:
-ifneq ("$(wildcard $(KDIR))", "")
 	$(Q)$(MAKE) -C $(KDIR) clean KBUILD_EXTMOD=$(TESTMODS_DIR)
-endif
diff --git a/tools/testing/selftests/livepatch/test_modules/Makefile b/tools/testing/selftests/livepatch/test_modules/Makefile
index 939230e571f5d..34e2f76fb4cec 100644
--- a/tools/testing/selftests/livepatch/test_modules/Makefile
+++ b/tools/testing/selftests/livepatch/test_modules/Makefile
@@ -14,14 +14,8 @@ obj-m += test_klp_atomic_replace.o \
 	test_klp_state3.o \
 	test_klp_syscall.o
 
-# Ensure that KDIR exists, otherwise skip the compilation
 modules:
-ifneq ("$(wildcard $(KDIR))", "")
 	$(Q)$(MAKE) -C $(KDIR) modules KBUILD_EXTMOD=$(TESTMODS_DIR)
-endif
 
-# Ensure that KDIR exists, otherwise skip the clean target
 clean:
-ifneq ("$(wildcard $(KDIR))", "")
 	$(Q)$(MAKE) -C $(KDIR) clean KBUILD_EXTMOD=$(TESTMODS_DIR)
-endif
-- 
2.43.0


  reply	other threads:[~2026-08-13 17:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12  9:49 [Devel] [PATCH vz10 v2] selftests: build test modules against the kernel tree Eva Kurchatova
2026-08-13 17:58 ` [Devel] [PATCH vz10 v3 0/2] selftests: build test modules for the packaged kernel Konstantin Khorenko
2026-08-13 17:58   ` Konstantin Khorenko [this message]
2026-08-14 11:11     ` [Devel] [PATCH RHEL10 COMMIT] selftests: do not hide a missing kernel build tree Konstantin Khorenko
2026-08-13 17:58   ` [Devel] [PATCH vz10 v3 2/2] selftests: build test modules against the kernel tree Konstantin Khorenko
2026-08-14 11:11     ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko

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=20260813175806.236084-2-khorenko@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