devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ayush Singh <ayush@beagleboard.org>
To: David Gibson <david@gibson.dropbear.id.au>,
	 Andreas Gnau <andreas.gnau@iopsys.eu>,
	d-gole@ti.com,  lorforlinux@beagleboard.org,
	jkridner@beagleboard.org,  robertcnelson@beagleboard.org,
	Andrew Davis <afd@ti.com>,
	 Geert Uytterhoeven <geert@linux-m68k.org>,
	Simon Glass <sjg@chromium.org>,
	 Herve Codina <herve.codina@bootlin.com>,
	 Luca Ceresoli <luca.ceresoli@bootlin.com>,
	 Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: devicetree-compiler@vger.kernel.org,
	 Ayush Singh <ayush@beagleboard.org>
Subject: [PATCH 3/3] tests: Add test for fdtoverlay target argument
Date: Thu, 13 Mar 2025 01:12:02 +0530	[thread overview]
Message-ID: <20250313-fdtoverlay-target-v1-3-dd5924e12bd3@beagleboard.org> (raw)
In-Reply-To: <20250313-fdtoverlay-target-v1-0-dd5924e12bd3@beagleboard.org>

A simple test that using target argument works for both the base node
overlay contents as well as any additions to subnodes.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
---
 tests/overlay_target.dts | 18 ++++++++++++++++++
 tests/run_tests.sh       | 14 ++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/tests/overlay_target.dts b/tests/overlay_target.dts
new file mode 100644
index 0000000000000000000000000000000000000000..41b32e2c48e83bda85a3482083a9509e3721a0ba
--- /dev/null
+++ b/tests/overlay_target.dts
@@ -0,0 +1,18 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+	fragment@1 {
+		target-path = "";
+		__overlay__ {
+			test-str-property = "1";
+		};
+	};
+
+	fragment@2 {
+		target-path = "sub-test-node";
+		__overlay__ {
+			test-str-property = "2";
+		};
+	};
+};
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 937b128864d03a2aaa8edc171d7ec7bd8fa28569..1b0819271d796a73a73849e192f1af6bde557b1f 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -1057,6 +1057,20 @@ fdtoverlay_tests() {
 
     run_fdtoverlay_test baz "/foonode/barnode/baznode" "baz-property" "-ts" ${stacked_base_nolabeldtb} ${stacked_addlabel_targetdtb} ${stacked_addlabeldtb} ${stacked_bardtb} ${stacked_bazdtb}
 
+    # test applying overlay to a target
+    overlay_base="$SRCDIR/overlay_base.dts"
+    overlay_basedtb=overlay_base.test.dtb
+    overlay_target="$SRCDIR/overlay_target.dts"
+    overlay_targetdtb=overlay_target.test.dtb
+
+    run_dtc_test -@ -I dts -O dtb -o $overlay_basedtb $overlay_base
+    run_dtc_test -@ -I dts -O dtb -o $overlay_targetdtb $overlay_target
+
+    run_wrap_test $FDTOVERLAY -t "/test-node" -i $overlay_basedtb -o overlay_base0.test.dtb $overlay_targetdtb
+
+    run_fdtget_test "1" overlay_base0.test.dtb "/test-node" "test-str-property"
+    run_fdtget_test "2" overlay_base0.test.dtb "/test-node/sub-test-node" "test-str-property"
+
     # verify that phandles are not overwritten
     run_dtc_test -@ -I dts -O dtb -o overlay_base_phandle.test.dtb "$SRCDIR/overlay_base_phandle.dts"
     run_dtc_test -@ -I dts -O dtb -o overlay_overlay_phandle.test.dtb "$SRCDIR/overlay_overlay_phandle.dts"

-- 
2.48.1


      parent reply	other threads:[~2025-03-12 19:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-12 19:41 [PATCH 0/3] Allow specifying target node in fdtoverlay Ayush Singh
2025-03-12 19:42 ` [PATCH 1/3] libfdt: Add fdt_relative_path_offset Ayush Singh
2025-03-12 19:42 ` [PATCH 2/3] fdtoverlay: Add target option Ayush Singh
2025-03-12 19:42 ` Ayush Singh [this message]

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=20250313-fdtoverlay-target-v1-3-dd5924e12bd3@beagleboard.org \
    --to=ayush@beagleboard.org \
    --cc=afd@ti.com \
    --cc=andreas.gnau@iopsys.eu \
    --cc=d-gole@ti.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=devicetree-compiler@vger.kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=herve.codina@bootlin.com \
    --cc=jkridner@beagleboard.org \
    --cc=lorforlinux@beagleboard.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=robertcnelson@beagleboard.org \
    --cc=sjg@chromium.org \
    --cc=thomas.petazzoni@bootlin.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).