summaryrefslogtreecommitdiff
path: root/tools/dtoc/test_fdt.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-03-21 08:24:39 +0300
committerSimon Glass <sjg@chromium.org>2021-03-27 06:26:48 +0300
commit5d1bec30efcd1d0e74643a54a348718e8f79fc92 (patch)
tree6ed549e1dcd9dde372b6d379267b93ac18663dd9 /tools/dtoc/test_fdt.py
parentf6176651bc1bad080d0512aeeed438e8763b951b (diff)
downloadu-boot-5d1bec30efcd1d0e74643a54a348718e8f79fc92.tar.xz
dtoc: Add new check that offsets are correct
Add a few more internal checks to make sure offsets are correct, before updating the dtb. To make this easier, update the functions which add a property to return that property,. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/dtoc/test_fdt.py')
-rwxr-xr-xtools/dtoc/test_fdt.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 49a2853f07..856392b1bd 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -265,6 +265,22 @@ class TestNode(unittest.TestCase):
self.dtb.Sync(auto_resize=True)
+ def testRefreshNameMismatch(self):
+ """Test name mismatch when syncing nodes and properties"""
+ prop = self.node.AddInt('integer-a', 12)
+
+ wrong_offset = self.dtb.GetNode('/i2c@0')._offset
+ self.node._offset = wrong_offset
+ with self.assertRaises(ValueError) as e:
+ self.dtb.Sync()
+ self.assertIn("Internal error, node '/spl-test' name mismatch 'i2c@0'",
+ str(e.exception))
+
+ with self.assertRaises(ValueError) as e:
+ self.node.Refresh(wrong_offset)
+ self.assertIn("Internal error, node '/spl-test' name mismatch 'i2c@0'",
+ str(e.exception))
+
class TestProp(unittest.TestCase):
"""Test operation of the Prop class"""