mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 15:14:43 +00:00
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>
This commit is contained in:
parent
a30c39f2f7
commit
dd857ee761
2 changed files with 13 additions and 0 deletions
|
@ -356,6 +356,8 @@ class Node:
|
|||
|
||||
offset = fdt_obj.first_subnode(self._offset, QUIET_NOTFOUND)
|
||||
for subnode in self.subnodes:
|
||||
if subnode._offset is None:
|
||||
continue
|
||||
if subnode.name != fdt_obj.get_name(offset):
|
||||
raise ValueError('Internal error, node name mismatch %s != %s' %
|
||||
(subnode.name, fdt_obj.get_name(offset)))
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue