[LTP] [PATCH 3/4] Add .checkpatch.conf for checkpatch.pl
Petr Vorel
pvorel@suse.cz
Fri Apr 24 11:39:18 CEST 2026
This helps to remove duplicity because checkpatch.pl is used in 'make
check' and in b4 config.
b4 uses some specific flags --mailback --showfile.
For make check use $CHECKPATCH_CONFIG_DIR (new feature from previous
commit) to pass config file in the root directory. b4 is already run
from the root directory therefore it does not need it (script uses
default search path: '.:$HOME:.scripts'.
For some reason CAMELCASE check now creates a file with camel case variables:
.checkpatch-camelcase.git.70caa71934, add it to the top level .gitignore.
Document at least some options in .checkpatch.conf.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
There should not be any functional change other that camelcase file.
Cc b4 users :)
.b4-config | 5 +++--
.checkpatch.conf | 13 +++++++++++++
.gitignore | 3 +++
include/mk/env_post.mk | 2 +-
4 files changed, 20 insertions(+), 3 deletions(-)
create mode 100644 .checkpatch.conf
diff --git a/.b4-config b/.b4-config
index da805a8a6b..ff3199624c 100644
--- a/.b4-config
+++ b/.b4-config
@@ -4,6 +4,7 @@
send-series-to = Linux Test Project <ltp@lists.linux.it>
pw-url = https://patchwork.ozlabs.org/
pw-project = ltp
- prep-perpatch-check-cmd = ./scripts/checkpatch.pl -q --terse --no-summary --mailback --showfile --no-tree --strict --ignore CONST_STRUCT,VOLATILE,SPLIT_STRING,FILE_PATH_CHANGES,PREFER_KERNEL_TYPES,LONG_LINE,MACRO_ARG_REUSE,SPACING,MULTIPLE_ASSIGNMENTS,UNNECESSARY_PARENTHESES,PARENTHESIS_ALIGNMENT,CONCATENATED_STRING,STRCPY,STRLCPY,STRNCPY
- am-perpatch-check-cmd = ./scripts/checkpatch.pl -q --terse --no-summary --mailback --no-tree --strict --ignore CONST_STRUCT,VOLATILE,SPLIT_STRING,FILE_PATH_CHANGES,PREFER_KERNEL_TYPES,LONG_LINE,MACRO_ARG_REUSE,SPACING,MULTIPLE_ASSIGNMENTS,UNNECESSARY_PARENTHESES,PARENTHESIS_ALIGNMENT,CONCATENATED_STRING,STRCPY,STRLCPY,STRNCPY
+ # other checkpatch.pl options from .checkpatch.conf are used
+ prep-perpatch-check-cmd = ./scripts/checkpatch.pl -q --mailback --showfile
+ am-perpatch-check-cmd = ./scripts/checkpatch.pl -q --mailback
diff --git a/.checkpatch.conf b/.checkpatch.conf
new file mode 100644
index 0000000000..20b92aaca9
--- /dev/null
+++ b/.checkpatch.conf
@@ -0,0 +1,13 @@
+# Not Linux, so don't expect a Linux tree.
+--no-tree
+
+-f --terse --no-summary
+
+# enable more tests
+--strict
+
+# kernel specific
+--ignore PREFER_KERNEL_TYPES,STRCPY,STRLCPY,STRNCPY
+
+# TODO: document reason
+--ignore CONST_STRUCT,VOLATILE,SPLIT_STRING,FILE_PATH_CHANGES,LONG_LINE,MACRO_ARG_REUSE,SPACING,MULTIPLE_ASSIGNMENTS,UNNECESSARY_PARENTHESES,PARENTHESIS_ALIGNMENT,CONCATENATED_STRING
diff --git a/.gitignore b/.gitignore
index 3fdfeaba03..f034ca1647 100644
--- a/.gitignore
+++ b/.gitignore
@@ -63,3 +63,6 @@ logfile.*
compile_flags.txt
compile_commands.json
+
+# added by scripts/checkpatch.pl
+.checkpatch-camelcase.*
diff --git a/include/mk/env_post.mk b/include/mk/env_post.mk
index dcb0bbc6c5..1b0d3a2a8e 100644
--- a/include/mk/env_post.mk
+++ b/include/mk/env_post.mk
@@ -73,7 +73,7 @@ CHECK_TARGETS ?= $(addprefix check-,$(notdir $(patsubst %.c,%,$(sort $(wildcar
CHECK_TARGETS := $(filter-out $(addprefix check-, $(FILTER_OUT_MAKE_TARGETS)), $(CHECK_TARGETS))
CHECK_HEADER_TARGETS ?= $(addprefix check-,$(notdir $(sort $(wildcard $(abs_srcdir)/*.h))))
CHECK ?= $(abs_top_srcdir)/tools/sparse/sparse-ltp
-CHECK_NOFLAGS ?= $(abs_top_srcdir)/scripts/checkpatch.pl -f --no-tree --terse --no-summary --strict --ignore CONST_STRUCT,VOLATILE,SPLIT_STRING,FILE_PATH_CHANGES,PREFER_KERNEL_TYPES,LONG_LINE,MACRO_ARG_REUSE,SPACING,MULTIPLE_ASSIGNMENTS,UNNECESSARY_PARENTHESES,PARENTHESIS_ALIGNMENT,CONCATENATED_STRING,STRCPY,STRLCPY,STRNCPY
+CHECK_NOFLAGS ?= CHECKPATCH_CONFIG_DIR="$(abs_top_srcdir)" $(abs_top_srcdir)/scripts/checkpatch.pl -f
SHELL_CHECK ?= $(abs_top_srcdir)/scripts/checkbashisms.pl --force --extra
SHELL_CHECK_TARGETS ?= $(addprefix check-,$(notdir $(sort $(wildcard $(abs_srcdir)/*.sh))))
--
2.53.0
More information about the ltp
mailing list