diff options
author | Simon Glass <sjg@chromium.org> | 2021-03-21 08:24:39 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2021-03-27 06:26:48 +0300 |
commit | 5d1bec30efcd1d0e74643a54a348718e8f79fc92 (patch) | |
tree | 6ed549e1dcd9dde372b6d379267b93ac18663dd9 /tools/dtoc/test_fdt.py | |
parent | f6176651bc1bad080d0512aeeed438e8763b951b (diff) | |
download | u-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-x | tools/dtoc/test_fdt.py | 16 |
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""" |