summaryrefslogtreecommitdiff
path: root/tools/dtoc/test_fdt.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-09-14 04:57:17 -0600
committerSimon Glass <sjg@chromium.org>2018-09-28 11:09:01 -0600
commit746aee3f2f8c0c7534ad7ac7d438ccec35c6c99c (patch)
tree6a06834c228d21ea5e15ced9751d095fb75c8568 /tools/dtoc/test_fdt.py
parent6434961b2b2099b458e7dc9dcced5d450b45cbb4 (diff)
dtoc: Add a way to create an Fdt object from a data block
Support creating an Fdt object without having to write the data to a file first. 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 22a075d6c57..d2597020500 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -407,6 +407,14 @@ class TestProp(unittest.TestCase):
self.node.SetData('empty', '123')
self.assertEqual('123', prop.bytes)
+ def testFromData(self):
+ dtb2 = fdt.Fdt.FromData(self.dtb.GetContents())
+ self.assertEqual(dtb2.GetContents(), self.dtb.GetContents())
+
+ self.node.AddEmptyProp('empty', 5)
+ self.dtb.Sync(auto_resize=True)
+ self.assertTrue(dtb2.GetContents() != self.dtb.GetContents())
+
class TestFdtUtil(unittest.TestCase):
"""Tests for the fdt_util module