From: David Gibson <david@gibson.dropbear.id.au>
To: Simon Glass <sjg@chromium.org>
Cc: Devicetree Compiler <devicetree-compiler@vger.kernel.org>,
Herve Codina <herve.codina@bootlin.com>
Subject: Re: [PATCH v3 17/18] tests: Check references to a generated overlay fragment
Date: Mon, 16 Nov 2026 15:15:59 +1100 [thread overview]
Message-ID: <avqDfnJY0xP6VRkV@gractus.seuss> (raw)
In-Reply-To: <20261106195159.2623314-18-sjg@chromium.org>
[-- Attachment #1: Type: text/plain, Size: 3672 bytes --]
On Fri, Nov 06, 2026 at 12:51:44PM -0700, Simon Glass wrote:
> In a plugin, a fragment can refer to an overlay fragment (a fragment@N
> node) which dtc generates for an earlier fragment, either by giving its
> name in a / { ... } fragment or by giving a path through it to
> /delete-node/. No test covers either of these.
I find that description fairly hard to follow.
> Add a test for each, checking that the / { ... } fragment adds to the
> generated fragment@N node and that the path finds the node in it.
> Neither is really desirable, since dtc generates these names and a
> plugin should not rely on them, but the tests show what changes when the
> fragment@N nodes are added after the merge.
>
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v3:
> - Add new patch to check references to a generated overlay fragment
>
> tests/merge-overlay-name.dts | 14 ++++++++++++++
> tests/merge-overlay-path.dts | 13 +++++++++++++
> tests/run_tests.sh | 10 ++++++++++
> 3 files changed, 37 insertions(+)
> create mode 100644 tests/merge-overlay-name.dts
> create mode 100644 tests/merge-overlay-path.dts
>
> diff --git a/tests/merge-overlay-name.dts b/tests/merge-overlay-name.dts
> new file mode 100644
> index 0000000..be08268
> --- /dev/null
> +++ b/tests/merge-overlay-name.dts
> @@ -0,0 +1,14 @@
> +/dts-v1/;
> +/plugin/;
> +
> +&basenode {
> + node {
> + };
> +};
> +
> +/* Refers to the overlay fragment above by the name which dtc gives it */
> +/ {
> + fragment@0 {
> + prop = <1>;
> + };
> +};
Hrm. I don't think we want to enshrine this behaviour in a test - it
kind of arises by accident. For one thing this is relying on the
order in which dtc assigns fragment numbers, which I've never thought
of as a guarantee.
> diff --git a/tests/merge-overlay-path.dts b/tests/merge-overlay-path.dts
> new file mode 100644
> index 0000000..2f4c5fc
> --- /dev/null
> +++ b/tests/merge-overlay-path.dts
> @@ -0,0 +1,13 @@
> +/dts-v1/;
> +/plugin/;
> +
> +&basenode {
> + node1 {
> + };
> +
> + node2 {
> + };
> +};
> +
> +/* Refers to a node in the overlay fragment above by its path */
> +/delete-node/ &{/fragment@0/__overlay__/node1};
Similar thoughts here.
> diff --git a/tests/run_tests.sh b/tests/run_tests.sh
> index 8391717..92e4d2c 100755
> --- a/tests/run_tests.sh
> +++ b/tests/run_tests.sh
> @@ -847,6 +847,16 @@ dtc_tests () {
> run_fdtget_test "fragment@0\nnode\n__fixups__" merge-overlay-order.test.dtb -l /
> run_fdtget_test "bar" merge-overlay-order.test.dtb -l /fragment@0/__overlay__
>
> + # In a plugin, a / { ... } fragment can add to an overlay fragment by
> + # giving the name which dtc generates for it, and a node in an overlay
> + # fragment can be deleted by its path
> + run_dtc_test -I dts -O dtb -o merge-overlay-name.test.dtb \
> + "$SRCDIR/merge-overlay-name.dts"
> + run_fdtget_test 1 merge-overlay-name.test.dtb /fragment@0 prop
> + run_dtc_test -I dts -O dtb -o merge-overlay-path.test.dtb \
> + "$SRCDIR/merge-overlay-path.dts"
> + run_fdtget_test "node2" merge-overlay-path.test.dtb -l /fragment@0/__overlay__
> +
> check_tests "$SRCDIR/bad-name-property.dts" name_properties
>
> check_tests "$SRCDIR/bad-ncells.dts" address_cells_is_cell size_cells_is_cell interrupts_extended_is_cell
> --
> 2.43.0
>
>
--
David Gibson (he or they) | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you, not the other way
| around.
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2026-11-16 4:34 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 19:51 [PATCH v3 00/18] dtc: Merge the fragments of a dts file after parsing Simon Glass
2026-11-06 19:51 ` [PATCH v3 01/18] tests: Check how the fragments of a dts file are merged Simon Glass
2026-11-13 3:20 ` David Gibson
2026-11-06 19:51 ` [PATCH v3 02/18] srcpos: Allow srcpos_string() to accept NULL Simon Glass
2026-11-11 4:56 ` David Gibson
2026-11-06 19:51 ` [PATCH v3 03/18] dtc: Add a struct for the top-level fragments of a dts file Simon Glass
2026-11-13 3:46 ` David Gibson
2026-11-06 19:51 ` [PATCH v3 04/18] dtc: Move the /delete-node/ handling out of the grammar Simon Glass
2026-11-13 3:49 ` David Gibson
2026-11-06 19:51 ` [PATCH v3 05/18] dtc: Move the /omit-if-no-ref/ " Simon Glass
2026-11-13 3:50 ` David Gibson
2026-11-06 19:51 ` [PATCH v3 06/18] dtc: Move is_ref_relative() to livetree.c Simon Glass
2026-11-13 3:55 ` David Gibson
2026-11-06 19:51 ` [PATCH v3 07/18] dtc: Move label-reference handling out of the grammar Simon Glass
2026-11-13 3:58 ` David Gibson
2026-11-06 19:51 ` [PATCH v3 08/18] dtc: Merge &{label} in a plugin as with &label Simon Glass
2026-11-13 4:01 ` David Gibson
2026-11-06 19:51 ` [PATCH v3 09/18] dtc: Move path-reference handling out of the grammar Simon Glass
2026-11-13 4:09 ` David Gibson
2026-11-16 23:49 ` Simon Glass
2026-11-16 23:55 ` David Gibson
2026-11-06 19:51 ` [PATCH v3 10/18] dtc: Move labelled-reference " Simon Glass
2026-11-13 4:13 ` David Gibson
2026-11-16 23:49 ` Simon Glass
2026-11-16 23:57 ` David Gibson
2026-11-06 19:51 ` [PATCH v3 11/18] dtc: Move first-reference " Simon Glass
2026-11-13 4:19 ` David Gibson
2026-11-06 19:51 ` [PATCH v3 12/18] dtc: Add merge_fragment() to merge any fragment Simon Glass
2026-11-13 4:24 ` David Gibson
2026-11-06 19:51 ` [PATCH v3 13/18] dtc: Add helpers for the errors when merging a fragment Simon Glass
2026-11-16 3:49 ` David Gibson
2026-11-06 19:51 ` [PATCH v3 14/18] dtc: Merge the fragments of a dts file after parsing Simon Glass
2026-11-16 4:04 ` David Gibson
2026-11-06 19:51 ` [PATCH v3 15/18] dtc: Merge the fragments of a dts file in main() Simon Glass
2026-11-16 4:08 ` David Gibson
2026-11-06 19:51 ` [PATCH v3 16/18] dtc: Add the overlay fragments from merge_fragments() Simon Glass
2026-11-16 4:12 ` David Gibson
2026-11-06 19:51 ` [PATCH v3 17/18] tests: Check references to a generated overlay fragment Simon Glass
2026-11-16 4:15 ` David Gibson [this message]
2026-11-06 19:51 ` [PATCH v3 18/18] dtc: Add the overlay fragments after merging a plugin Simon Glass
2026-11-16 4:34 ` David Gibson
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=avqDfnJY0xP6VRkV@gractus.seuss \
--to=david@gibson.dropbear.id.au \
--cc=devicetree-compiler@vger.kernel.org \
--cc=herve.codina@bootlin.com \
--cc=sjg@chromium.org \
/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.