From: Jeffrey Hugo <jhugo@codeaurora.org>
To: Rob Herring <robh@kernel.org>, devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Masahiro Yamada <yamada.masahiro@socionext.com>
Subject: Re: [PATCH] dt-bindings: Improve validation build error handling
Date: Thu, 14 Nov 2019 08:21:35 -0700 [thread overview]
Message-ID: <30b73f89-1ba1-6052-53bd-414ebdfa142c@codeaurora.org> (raw)
In-Reply-To: <20191113210544.1894-1-robh@kernel.org>
On 11/13/2019 2:05 PM, Rob Herring wrote:
> Schema errors can cause make to exit before useful information is
> printed. This leaves developers wondering what's wrong. It can be
> overcome passing '-k' to make, but that's not an obvious solution.
> There's 2 scenarios where this happens.
>
> When using DT_SCHEMA_FILES to validate with a single schema, any error
> in the schema results in processed-schema.yaml being empty causing a
> make error. The result is the specific errors in the schema are never
> shown because processed-schema.yaml is the first target built. Simply
> making processed-schema.yaml last in extra-y ensures the full schema
> validation with detailed error messages happen first.
>
> The 2nd problem is while schema errors are ignored for
> processed-schema.yaml, full validation of the schema still runs in
> parallel and any schema validation errors will still stop the build when
> running validation of dts files. The fix is to not add the schema
> examples to extra-y in this case. This means 'dtbs_check' is no longer a
> superset of 'dt_binding_check'. Update the documentation to make this
> clear.
>
> Cc: Jeffrey Hugo <jhugo@codeaurora.org>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Signed-off-by: Rob Herring <robh@kernel.org>
I injected a syntax error into a random binding file, and compared the
output with and without this patch. This patch makes a massive
improvement in giving the user the necessary information to identify and
fix issues. Thanks!
Tested-by: Jeffrey Hugo <jhugo@codeaurora.org>
> ---
> Documentation/devicetree/bindings/Makefile | 5 ++++-
> Documentation/devicetree/writing-schema.rst | 6 ++++--
> 2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile
> index 5138a2f6232a..646cb3525373 100644
> --- a/Documentation/devicetree/bindings/Makefile
> +++ b/Documentation/devicetree/bindings/Makefile
> @@ -12,7 +12,6 @@ $(obj)/%.example.dts: $(src)/%.yaml FORCE
> $(call if_changed,chk_binding)
>
> DT_TMP_SCHEMA := processed-schema.yaml
> -extra-y += $(DT_TMP_SCHEMA)
>
> quiet_cmd_mk_schema = SCHEMA $@
> cmd_mk_schema = $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) -o $@ $(real-prereqs)
> @@ -26,8 +25,12 @@ DT_DOCS = $(shell \
>
> DT_SCHEMA_FILES ?= $(addprefix $(src)/,$(DT_DOCS))
>
> +ifeq ($(CHECK_DTBS),)
> extra-y += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES))
> extra-y += $(patsubst $(src)/%.yaml,%.example.dt.yaml, $(DT_SCHEMA_FILES))
> +endif
>
> $(obj)/$(DT_TMP_SCHEMA): $(DT_SCHEMA_FILES) FORCE
> $(call if_changed,mk_schema)
> +
> +extra-y += $(DT_TMP_SCHEMA)
> diff --git a/Documentation/devicetree/writing-schema.rst b/Documentation/devicetree/writing-schema.rst
> index 3fce61cfd649..efcd5d21dc2b 100644
> --- a/Documentation/devicetree/writing-schema.rst
> +++ b/Documentation/devicetree/writing-schema.rst
> @@ -133,11 +133,13 @@ binding schema. All of the DT binding documents can be validated using the
>
> make dt_binding_check
>
> -In order to perform validation of DT source files, use the `dtbs_check` target::
> +In order to perform validation of DT source files, use the ``dtbs_check`` target::
>
> make dtbs_check
>
> -This will first run the `dt_binding_check` which generates the processed schema.
> +Note that ``dtbs_check`` will skip any binding schema files with errors. It is
> +necessary to use ``dt_binding_check`` to get all the validation errors in the
> +binding schema files.
>
> It is also possible to run checks with a single schema file by setting the
> ``DT_SCHEMA_FILES`` variable to a specific schema file.
>
--
Jeffrey Hugo
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
next prev parent reply other threads:[~2019-11-14 15:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-13 21:05 [PATCH] dt-bindings: Improve validation build error handling Rob Herring
2019-11-14 15:21 ` Jeffrey Hugo [this message]
2019-11-14 16:34 ` Rob Herring
2019-11-15 5:58 ` Masahiro Yamada
2019-11-15 14:52 ` Rob Herring
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=30b73f89-1ba1-6052-53bd-414ebdfa142c@codeaurora.org \
--to=jhugo@codeaurora.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=yamada.masahiro@socionext.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).