summaryrefslogtreecommitdiff
path: root/tools/dtoc/test_fdt.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-02-08 21:49:50 +0300
committerSimon Glass <sjg@chromium.org>2022-02-22 20:05:44 +0300
commitbc116029c0ad25b2631629062a70a4d36157d43c (patch)
treea3b0077787d02615613999e33b8ed548f2266dd0 /tools/dtoc/test_fdt.py
parent38c04d8e065c42254dbaca760a9e6d200321c15b (diff)
downloadu-boot-bc116029c0ad25b2631629062a70a4d36157d43c.tar.xz
dtoc: Support adding a string list to a device tree
Add a new function to add a string list. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/dtoc/test_fdt.py')
-rwxr-xr-xtools/dtoc/test_fdt.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index c789822afa..5a5333b134 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -531,6 +531,14 @@ class TestProp(unittest.TestCase):
self.node.AddData('data', tools.get_bytes(65, 20000))
self.dtb.Sync(auto_resize=True)
+ def test_string_list(self):
+ """Test adding string-list property to a node"""
+ val = ['123', '456']
+ self.node.AddStringList('stringlist', val)
+ self.dtb.Sync(auto_resize=True)
+ data = self.fdt.getprop(self.node.Offset(), 'stringlist')
+ self.assertEqual(b'123\x00456\0', data)
+
def testFromData(self):
dtb2 = fdt.Fdt.FromData(self.dtb.GetContents())
self.assertEqual(dtb2.GetContents(), self.dtb.GetContents())