summaryrefslogtreecommitdiff
path: root/tools/binman/ftest.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-07-23 06:43:57 +0300
committerSimon Glass <sjg@chromium.org>2023-08-02 21:05:57 +0300
commitd4d97661d255571118b6fdee0cf082a75f29af29 (patch)
tree98c7f6ba5cc84a5c9e139b0d5ca858222d07cadc /tools/binman/ftest.py
parentaf41b24ebac86f25145f39f4eec4467d4c501bed (diff)
downloadu-boot-d4d97661d255571118b6fdee0cf082a75f29af29.tar.xz
binman: Support templates containing phandles
This provides support for phandles to be copied over from templates. This is not quite safe, since if the template is instantiated twice (i.e. in two different nodes), then duplicate phandles will be found. This will result in an error. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/ftest.py')
-rw-r--r--tools/binman/ftest.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index ecada41833..36428ec343 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -6969,6 +6969,33 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
# Move to next
spl_data = content[:0x18]
+ def testTemplatePhandle(self):
+ """Test using a template in a node containing a phandle"""
+ entry_args = {
+ 'atf-bl31-path': 'bl31.elf',
+ }
+ data = self._DoReadFileDtb('291_template_phandle.dts',
+ entry_args=entry_args)
+ fname = tools.get_output_filename('image.bin')
+ out = tools.run('dumpimage', '-l', fname)
+
+ # We should see the FIT description and one for each of the two images
+ lines = out.splitlines()
+ descs = [line.split()[-1] for line in lines if 'escription' in line]
+ self.assertEqual(['test-desc', 'atf', 'fdt'], descs)
+
+ def testTemplatePhandleDup(self):
+ """Test using a template in a node containing a phandle"""
+ entry_args = {
+ 'atf-bl31-path': 'bl31.elf',
+ }
+ with self.assertRaises(ValueError) as e:
+ self._DoReadFileDtb('292_template_phandle_dup.dts',
+ entry_args=entry_args)
+ self.assertIn(
+ 'Duplicate phandle 1 in nodes /binman/image/fit/images/atf/atf-bl31 and /binman/image-2/fit/images/atf/atf-bl31',
+ str(e.exception))
+
def testTIBoardConfig(self):
"""Test that a schema validated board config file can be generated"""
data = self._DoReadFile('293_ti_board_cfg.dts')