All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Palethorpe via ltp <ltp@lists.linux.it>
To: ltp@lists.linux.it
Cc: Richard Palethorpe <rpalethorpe@suse.com>
Subject: [LTP] [PATCH] tools: Check headers with checkpatch.pl
Date: Tue, 26 Jul 2022 12:52:34 +0100	[thread overview]
Message-ID: <20220726115234.25310-1-rpalethorpe@suse.com> (raw)
In-Reply-To: <Yt+RA5chfBh54kvI@pevik>

checkpatch.pl doesn't load included headers so they must be passed to
it specifically. This change automatically includes headers from the
current directory. Manual intervention is still required if a test
author changes a header located elsewhere. However you can now write
'make check-header.h', once in the correct directory.

Note that our Sparse based tool (amongst others) loads headers and
checks at least some of the content.

Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
Suggested-by: Petr Vorel <pvorel@suse.cz>
---
 include/mk/env_post.mk             | 1 +
 include/mk/generic_leaf_target.inc | 2 +-
 include/mk/rules.mk                | 9 +++++++++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/mk/env_post.mk b/include/mk/env_post.mk
index dc4df41d3..a00f31b08 100644
--- a/include/mk/env_post.mk
+++ b/include/mk/env_post.mk
@@ -92,6 +92,7 @@ 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_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
 SHELL_CHECK			?= $(abs_top_srcdir)/scripts/checkbashisms.pl --force --extra
diff --git a/include/mk/generic_leaf_target.inc b/include/mk/generic_leaf_target.inc
index 33e9c9ea0..565a282bb 100644
--- a/include/mk/generic_leaf_target.inc
+++ b/include/mk/generic_leaf_target.inc
@@ -110,6 +110,6 @@ $(INSTALL_FILES): | $(INSTALL_DEPS)
 install: $(INSTALL_FILES)
 
 $(CHECK_TARGETS): | $(CHECK_DEPS)
-check: $(CHECK_TARGETS) $(SHELL_CHECK_TARGETS)
+check: $(CHECK_HEADER_TARGETS) $(CHECK_TARGETS) $(SHELL_CHECK_TARGETS)
 
 # vim: syntax=make
diff --git a/include/mk/rules.mk b/include/mk/rules.mk
index 32d8d05a7..517863c04 100644
--- a/include/mk/rules.mk
+++ b/include/mk/rules.mk
@@ -57,6 +57,15 @@ else
 	@-$(CHECK) $(CHECK_FLAGS) $(CPPFLAGS) $(CFLAGS) $<
 endif
 
+.PHONY: $(CHECK_HEADER_TARGETS)
+$(CHECK_HEADER_TARGETS): check-%.h: %.h
+ifdef VERBOSE
+	-$(CHECK_NOFLAGS) $<
+else
+	@echo CHECK $(target_rel_dir)$<
+	@-$(CHECK_NOFLAGS) $<
+endif
+
 .PHONY: $(SHELL_CHECK_TARGETS)
 $(SHELL_CHECK_TARGETS): check-%.sh: %.sh
 ifdef VERBOSE
-- 
2.36.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2022-07-26 11:53 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22 12:04 [LTP] [PATCH v3 0/7] Refactor mqns testing suite Andrea Cervesato via ltp
2022-07-22 12:04 ` [LTP] [PATCH v3 1/7] Add more safe macros for mqueue API Andrea Cervesato via ltp
2022-07-26  6:50   ` Petr Vorel
2022-11-01 11:36   ` Richard Palethorpe
2022-07-22 12:04 ` [LTP] [PATCH v3 2/7] Refactor mqns_01 using new LTP API Andrea Cervesato via ltp
2022-08-11  9:53   ` Richard Palethorpe
2022-08-11 11:13     ` Andrea Cervesato via ltp
2022-09-02  9:05       ` Richard Palethorpe
2022-10-11  9:17         ` Richard Palethorpe
2022-10-11  9:42           ` Andrea Cervesato via ltp
2022-10-11 10:49             ` Richard Palethorpe
2022-10-11 11:19               ` Andrea Cervesato via ltp
2022-07-22 12:04 ` [LTP] [PATCH v3 3/7] Refactor mqns_02 " Andrea Cervesato via ltp
2022-07-22 12:04 ` [LTP] [PATCH v3 4/7] Refactor mqns_03 " Andrea Cervesato via ltp
2022-07-22 12:04 ` [LTP] [PATCH v3 5/7] Refactor mqns_04 " Andrea Cervesato via ltp
2022-07-22 12:05 ` [LTP] [PATCH v3 6/7] Delete deprecated mqns header files Andrea Cervesato via ltp
2022-07-22 12:05 ` [LTP] [PATCH v3 7/7] Rename common.h into mqns.h for mqns suite Andrea Cervesato via ltp
2022-07-26  7:00   ` Petr Vorel
2022-07-26 11:52     ` Richard Palethorpe via ltp [this message]
2022-07-26 12:03       ` [LTP] [PATCH] tools: Check headers with checkpatch.pl Petr Vorel
2022-07-26 12:53         ` Richard Palethorpe
2022-07-26 14:05           ` Petr Vorel
2022-10-11 10:15 ` [LTP] [PATCH v3 0/7] Refactor mqns testing suite Richard Palethorpe

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=20220726115234.25310-1-rpalethorpe@suse.com \
    --to=ltp@lists.linux.it \
    --cc=rpalethorpe@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.