[LTP] [PATCH] build: run make check on test sources in kernel module directories
Andrea Cervesato
andrea.cervesato@suse.de
Wed Jun 10 15:00:05 CEST 2026
From: Andrea Cervesato <andrea.cervesato@suse.com>
In directories that build a kernel module, module.mk set CHECK_TARGETS
with ':=' before env_post.mk could populate it via '?=', leaving it empty
so 'make check' never ran sparse/checkpatch on the test sources. The filter
also used a '%.ko' pattern that never matched any 'check-<name>' entry.
Drop the broken assignment from module.mk and instead exclude the kernel
module sources (MODULE_SOURCES) in env_post.mk once CHECK_TARGETS has been
populated, so test sources are checked while kernel module code is skipped.
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
include/mk/env_post.mk | 2 +-
include/mk/module.mk | 2 --
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/include/mk/env_post.mk b/include/mk/env_post.mk
index 726b9a9e7526562f4f6e8363da394485c805fa88..43983197638a2ba42a9c1a20e072fa3179e04344 100644
--- a/include/mk/env_post.mk
+++ b/include/mk/env_post.mk
@@ -70,7 +70,7 @@ endif # END $(filter-out install,$(MAKECMDGOALS)),$(MAKECMDGOALS)
endif
CHECK_TARGETS ?= $(addprefix check-,$(notdir $(patsubst %.c,%,$(sort $(wildcard $(abs_srcdir)/*.c)))))
-CHECK_TARGETS := $(filter-out $(addprefix check-, $(FILTER_OUT_MAKE_TARGETS)), $(CHECK_TARGETS))
+CHECK_TARGETS := $(filter-out $(addprefix check-, $(FILTER_OUT_MAKE_TARGETS) $(notdir $(basename $(MODULE_SOURCES)))), $(CHECK_TARGETS))
CHECK_HEADER_TARGETS ?= $(addprefix check-,$(notdir $(sort $(wildcard $(abs_srcdir)/*.h))))
CHECK ?= $(abs_top_srcdir)/tools/sparse/sparse-ltp
CHECK_NOFLAGS ?= CHECKPATCH_CONFIG_DIR="$(abs_top_srcdir)" $(abs_top_srcdir)/scripts/checkpatch.pl -f --root $(abs_top_srcdir)
diff --git a/include/mk/module.mk b/include/mk/module.mk
index 3e97f01289e2eb4f5a494c55a83022860b37a835..8949d9067ca6afdb790de122ff4ff56e38a54066 100644
--- a/include/mk/module.mk
+++ b/include/mk/module.mk
@@ -51,8 +51,6 @@ endif
CLEAN_TARGETS += .dep_modules *.mod built-in.a
-CHECK_TARGETS := $(filter-out %.ko, $(CHECK_TARGETS))
-
MODULE_SOURCES := $(patsubst %.ko,%.c,$(filter %.ko, $(MAKE_TARGETS)))
# Ignoring the exit status of commands is done to be forward compatible with
---
base-commit: c1b71bf7ebb6a58507e4998faf5c74154f595f96
change-id: 20260610-fix_buildsystem_modules-a5df16c4fdae
Best regards,
--
Andrea Cervesato <andrea.cervesato@suse.com>
More information about the ltp
mailing list