[LTP] [PATCH 1/2] make check: b3: Use --strict when run checkpatch.pl
Andrea Cervesato
andrea.cervesato@suse.com
Tue Jan 6 11:48:45 CET 2026
Hi!
On Mon Jan 5, 2026 at 2:03 PM CET, Petr Vorel wrote:
> The main motivation is to show typos on 'make check' which require --strict:
>
> * TYPO_SPELLING
> tst_cgroup.h:127: CHECK: 'libary' may be misspelled - perhaps 'library'?
+1
>
> Other checks included:
>
> * LINE_SPACING
> tst_test.h:174: CHECK: Please don't use multiple blank lines
+1
>
> * MACRO_ARG_REUSE:
> tst_test.h:69: CHECK: Macro argument reuse 'ttype' - possible side-effects?
> #define tst_res(ttype, arg_fmt, ...) \
> ({ \
> TST_RES_SUPPORTS_TCONF_TDEBUG_TFAIL_TINFO_TPASS_TWARN(\
> !((TTYPE_RESULT(ttype) ?: TCONF) & \
> ...
+1
>
> * LONG_LINE:
> tst_test.h:73: CHECK: line length of 105 exceeds 100 columns
> => enforced by --strict because we miss kernel fix from v6.11:
> d6bb39519aafe ("checkpatch: really skip LONG_LINE_* when LONG_LINE is ignored")
> (will be fixed by checkpatch.pl update in next commit).
Tricky, I would leave this choice to reviewers.
>
> Whitelist all other checks added by --strict.
> Update also b4 config.
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> NOTE: here are checked whitelisted. Do we want to add some of these?
>
> Kind regards,
> Petr
>
> * LONG_LINE:
> tst_test.h:73: CHECK: line length of 105 exceeds 100 columns
Like above.
>
> * SPACING
> tst_test.c:1239: CHECK: spaces preferred around that '|' (ctx:VxV)
+1
>
> * MULTIPLE_ASSIGNMENTS
> tst_test.c:1419: CHECK: multiple assignments should be avoided
> TCID = tcid = get_tcid(argv);
+1
>
> * UNNECESSARY_PARENTHESES
> tst_test.c:802: CHECK: Unnecessary parentheses around toptions[i].arg
> *(toptions[i].arg) = optarg ? optarg : "";
Also tricky, sometimes parentheses are useful to clarify certain
concepts.
>
> * PARENTHESIS_ALIGNMENT
> tst_test.c:1300: CHECK: Alignment should match open parenthesis
> mnt_data = limit_tmpfs_mount_size(fs->mnt_data,
> buf, sizeof(buf), tdev.fs_type);
>
It really depends, for me it's too strick.
> * BRACES
> tst_test.c:2069: CHECK: Blank lines aren't necessary before a close brace '}'
> tst_test.c:1560: CHECK: Blank lines aren't necessary after an open brace '{'
> if (!tst_test->all_filesystems && count_fs_descs() <= 1) {
>
> if (!tst_fs_is_supported(tdev.fs_type))
+1
>
> * CONCATENATED_STRING
> tst_test.c:200: CHECK: Concatenated strings should use spaces between elements
> tst_brk(TBROK, IPC_ENV_VAR" is not defined");
+1
>
> * PREFER_KERNEL_TYPES
> tst_test.c:74: CHECK: Prefer kernel type 's32' over 'int32_t'
> => obviously kernel related
This is kernel related and I would use stdint.h definitions instead,
otherwise we need to import linux headers to use types and we don't
need that.
>
> .b4-config | 4 ++--
> include/mk/env_post.mk | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/.b4-config b/.b4-config
> index 36aa15c38f..5ff045b55b 100644
> --- a/.b4-config
> +++ b/.b4-config
> @@ -4,6 +4,6 @@
> 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 --ignore CONST_STRUCT,VOLATILE,SPLIT_STRING,FILE_PATH_CHANGES
> - am-perpatch-check-cmd = ./scripts/checkpatch.pl -q --terse --no-summary --mailback --no-tree --ignore CONST_STRUCT,VOLATILE,SPLIT_STRING,FILE_PATH_CHANGES
> + 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,BRACES,CONCATENATED_STRING
> + 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,BRACES,CONCATENATED_STRING
>
> diff --git a/include/mk/env_post.mk b/include/mk/env_post.mk
> index ab31da73af..947151457b 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 --ignore CONST_STRUCT,VOLATILE,SPLIT_STRING,FILE_PATH_CHANGES
> +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,BRACES,CONCATENATED_STRING
> SHELL_CHECK ?= $(abs_top_srcdir)/scripts/checkbashisms.pl --force --extra
> SHELL_CHECK_TARGETS ?= $(addprefix check-,$(notdir $(sort $(wildcard $(abs_srcdir)/*.sh))))
>
Thanks for checking this.
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
More information about the ltp
mailing list