summaryrefslogtreecommitdiff
path: root/tools/dtoc/test_fdt.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-02-08 21:49:52 +0300
committerSimon Glass <sjg@chromium.org>2022-02-22 20:05:44 +0300
commitdd857ee7614fea27de3eb6dbd87749a9640c69b1 (patch)
tree7139166fb02e711844068a3f2ccf63b2d2402273 /tools/dtoc/test_fdt.py
parenta30c39f2f77f4fb57a22a50c6d6b477d5d2f4342 (diff)
downloadu-boot-dd857ee7614fea27de3eb6dbd87749a9640c69b1.tar.xz
dtoc: Allow deleting nodes and adding them in the same sync
This does not work at present, since the current algorithm assumes that either there are no nodes or all nodes have an offset. If a node is new, but an old node is still in the tree, then syncing fails due to this assumption. Fix it and add a test. 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 ee603cc152..5455759acf 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -272,6 +272,17 @@ class TestNode(unittest.TestCase):
self.dtb.Sync(auto_resize=True)
+ def testAddOneNode(self):
+ """Testing deleting and adding a subnode before syncing"""
+ subnode = self.node.AddSubnode('subnode')
+ self.node.AddSubnode('subnode2')
+ self.dtb.Sync(auto_resize=True)
+
+ # Delete a node and add a new one
+ subnode.Delete()
+ self.node.AddSubnode('subnode3')
+ self.dtb.Sync()
+
def testRefreshNameMismatch(self):
"""Test name mismatch when syncing nodes and properties"""
prop = self.node.AddInt('integer-a', 12)