build: run make check on test sources in kernel module directories
PATCH 1/1 build: run make check on test sources in kernel module directories
From: Andrea Cervesato <[email protected]>
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.
--- include/mk/env_post.mk | 2 +- include/mk/module.mk | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)
include/mk/env_post.mk +1 -1
@@ -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)
include/mk/module.mk +0 -2
@@ -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,
Signature · 5 lines
Andrea Cervesato <[email protected]> -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Andrea,
Quoted 1 line · Andrea Cervesato
build: run make check on test sources in kernel module directories
Verdict: Reviewed
---
Note:
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 8 lines
In directories that build a kernel module, module.mk set
CHECK_TARGETSwith ':=' 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 onceCHECK_TARGETShas been populated, so test sources are checked while kernel module code is skipped.
Also I guess that we may want to run vanilla checkpatch for the module sources, but that would require a bigger changes I suppose.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Andrea Cervesato via ltp
AppliedMerged, Thanks!
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp