From patchwork Tue Jul 26 11:52:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Palethorpe X-Patchwork-Id: 1660768 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=susede1 header.b=j/4DY897; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LsZzb2WW1z9sB4 for ; Tue, 26 Jul 2022 21:52:59 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 024B03C9ACC for ; Tue, 26 Jul 2022 13:52:57 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 9C55A3C04EF for ; Tue, 26 Jul 2022 13:52:55 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id A3F3A600701 for ; Tue, 26 Jul 2022 13:52:54 +0200 (CEST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 8D76C375CB; Tue, 26 Jul 2022 11:52:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1658836373; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4RuF7aGkBcQrRfahPYqO/o6qlOZMEFnYDHJzSbO2qxk=; b=j/4DY8977Z475lhyBoYQ68ru7+kdcvJg0e3qhIJVf2cxqj6BdYBpxM+Dzq/FIej/Tgt+iw NQXhY+S3qIB5M9dVNhYGRbbbux1Yt+yACFMFYdWwgu7H+FE7DnyisXR5LEOuTTkSMI4X3Z AeeKCWecrSuobpfIp8rP6V2Lt5tdpac= Received: from g78.suse.de (unknown [10.163.24.226]) by relay2.suse.de (Postfix) with ESMTP id 5144F2C15D; Tue, 26 Jul 2022 11:52:53 +0000 (UTC) To: ltp@lists.linux.it Date: Tue, 26 Jul 2022 12:52:34 +0100 Message-Id: <20220726115234.25310-1-rpalethorpe@suse.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: References: MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH] tools: Check headers with checkpatch.pl X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Palethorpe via ltp From: Richard Palethorpe Reply-To: Richard Palethorpe Cc: Richard Palethorpe Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" 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 Suggested-by: Petr Vorel Reviewed-by: Petr Vorel --- 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