summaryrefslogtreecommitdiff
path: root/tools/dtoc/test_fdt.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-01-12 02:10:18 +0300
committerSimon Glass <sjg@chromium.org>2023-01-19 00:55:41 +0300
commit8f5afe21aed8b8ed4d75678a4e8972e7d8a23a6b (patch)
treea28c83d09df5ad37e1cbcddb65daa21dbada467c /tools/dtoc/test_fdt.py
parentc1157860c5e9ca45e41859e013ed83919e7397f0 (diff)
downloadu-boot-8f5afe21aed8b8ed4d75678a4e8972e7d8a23a6b.tar.xz
dtoc: Add a way to read a phandle with params
Add a function to read a phandle and associated name and offset. This is useful for binman. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/dtoc/test_fdt.py')
-rwxr-xr-xtools/dtoc/test_fdt.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index a3e36ea363..3b8ee00d4e 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -795,6 +795,17 @@ class TestFdtUtil(unittest.TestCase):
finally:
tools.outdir= old_outdir
+ def test_get_phandle_name_offset(self):
+ val = fdt_util.GetPhandleNameOffset(self.node, 'missing')
+ self.assertIsNone(val)
+
+ dtb = fdt.FdtScan(find_dtb_file('dtoc_test_phandle.dts'))
+ node = dtb.GetNode('/phandle-source')
+ node, name, offset = fdt_util.GetPhandleNameOffset(node,
+ 'phandle-name-offset')
+ self.assertEqual('phandle3-target', node.name)
+ self.assertEqual('fred', name)
+ self.assertEqual(123, offset)
def run_test_coverage(build_dir):
"""Run the tests and check that we get 100% coverage