U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rasmus Villemoes <ravi@prevas.dk>
To: u-boot@lists.denx.de
Cc: Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>,
	Quentin Schulz <quentin.schulz@cherry.de>,
	Rasmus Villemoes <ravi@prevas.dk>
Subject: [PATCH 2/2] test: hook up test of allowing control DTB to act as FIT image
Date: Tue, 12 May 2026 18:16:31 +0200	[thread overview]
Message-ID: <20260512161631.284143-3-ravi@prevas.dk> (raw)
In-Reply-To: <20260512161631.284143-1-ravi@prevas.dk>

Add a test demonstrating how one can embed various scripts in the
control DTB and verifying that the source command can be used with
${fdtcontroladdr}.

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
---
 arch/sandbox/dts/sandbox-test1.sh     |  4 ++++
 arch/sandbox/dts/sandbox-test2.sh     |  4 ++++
 arch/sandbox/dts/sandbox_scripts.dtsi | 18 ++++++++++++++++++
 configs/sandbox_defconfig             |  1 +
 test/py/tests/test_source.py          | 12 ++++++++++++
 5 files changed, 39 insertions(+)
 create mode 100644 arch/sandbox/dts/sandbox-test1.sh
 create mode 100644 arch/sandbox/dts/sandbox-test2.sh
 create mode 100644 arch/sandbox/dts/sandbox_scripts.dtsi

diff --git a/arch/sandbox/dts/sandbox-test1.sh b/arch/sandbox/dts/sandbox-test1.sh
new file mode 100644
index 00000000000..9d65a71bd7b
--- /dev/null
+++ b/arch/sandbox/dts/sandbox-test1.sh
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+echo "aaa"
+source ${fdtcontroladdr}:test2
+echo "ccc"
diff --git a/arch/sandbox/dts/sandbox-test2.sh b/arch/sandbox/dts/sandbox-test2.sh
new file mode 100644
index 00000000000..c84a0a3b97d
--- /dev/null
+++ b/arch/sandbox/dts/sandbox-test2.sh
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+# Some comment.
+echo "bbb"
diff --git a/arch/sandbox/dts/sandbox_scripts.dtsi b/arch/sandbox/dts/sandbox_scripts.dtsi
new file mode 100644
index 00000000000..f54c95b72b3
--- /dev/null
+++ b/arch/sandbox/dts/sandbox_scripts.dtsi
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/ {
+	images {
+		default = "test";
+		test1 {
+			description = "Testscript";
+			data = /incbin/("sandbox-test1.sh");
+			type = "script";
+			compression = "none";
+		};
+		test2 {
+			description = "Another testscript";
+			data = /incbin/("sandbox-test2.sh");
+			type = "script";
+			compression = "none";
+		};
+	};
+};
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 55dc7845544..083383eea2b 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -154,6 +154,7 @@ CONFIG_CMD_SPAWN=y
 CONFIG_MAC_PARTITION=y
 CONFIG_OF_CONTROL=y
 CONFIG_OF_LIVE=y
+CONFIG_DEVICE_TREE_INCLUDES="sandbox_scripts.dtsi"
 CONFIG_ENV_IS_NOWHERE=y
 CONFIG_ENV_IS_IN_FAT=y
 CONFIG_ENV_IS_IN_EXT4=y
diff --git a/test/py/tests/test_source.py b/test/py/tests/test_source.py
index 970d8c79869..315aaee3fd6 100644
--- a/test/py/tests/test_source.py
+++ b/test/py/tests/test_source.py
@@ -34,3 +34,15 @@ def test_source(ubman):
     ubman.run_command('fdt rm /images default')
     assert 'Fail' in ubman.run_command('source || echo Fail')
     assert 'Fail' in ubman.run_command('source \\# || echo Fail')
+
+    output = ubman.run_command('source ${fdtcontroladdr}:test1')
+    assert 'aaa' in output
+    assert 'bbb' in output
+    assert 'ccc' in output
+
+    output = ubman.run_command('source ${fdtcontroladdr}:test2')
+    assert 'aaa' not in output
+    assert 'bbb' in output
+    assert 'ccc' not in output
+
+    assert 'Fail' in ubman.run_command('source ${fdtcontroladdr}:no-such-script || echo Fail')
-- 
2.54.0


  parent reply	other threads:[~2026-05-12 16:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12 16:16 [PATCH 0/2] allow control DTB to double as "FIT image" Rasmus Villemoes
2026-05-12 16:16 ` [PATCH 1/2] image-board.c: exempt gd->fdt_blob from fit_check_format() check Rasmus Villemoes
2026-05-15 13:06   ` Simon Glass
2026-05-12 16:16 ` Rasmus Villemoes [this message]
2026-05-15 13:06   ` [PATCH 2/2] test: hook up test of allowing control DTB to act as FIT image Simon Glass
2026-05-12 16:39 ` [PATCH 0/2] allow control DTB to double as "FIT image" Quentin Schulz
2026-05-13  8:03   ` Rasmus Villemoes
2026-05-15 13:33 ` [0/2] " Simon Glass

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=20260512161631.284143-3-ravi@prevas.dk \
    --to=ravi@prevas.dk \
    --cc=quentin.schulz@cherry.de \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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