mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
pylibfdt: Support setting the name of a node
Add a method to call fdt_set_name(). Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
2f0d07e678
commit
b770f3d1c1
2 changed files with 32 additions and 0 deletions
|
@ -465,6 +465,21 @@ class PyLibfdtTests(unittest.TestCase):
|
|||
self.assertEquals(TEST_STRING_3,
|
||||
self.fdt.getprop(node, prop).as_str())
|
||||
|
||||
def testSetName(self):
|
||||
"""Test that we can update a node name"""
|
||||
node = self.fdt.path_offset('/subnode@1')
|
||||
old_val = self.fdt.get_name(node)
|
||||
self.fdt.set_name(node, 'test')
|
||||
self.assertEquals('test', self.fdt.get_name(node))
|
||||
|
||||
with self.assertRaises(ValueError) as e:
|
||||
self.fdt.set_name(node, 'some\0name')
|
||||
self.assertIn('embedded nul', str(e.exception))
|
||||
|
||||
with self.assertRaises(ValueError) as e:
|
||||
self.fdt.set_name(node, 'name\0')
|
||||
self.assertIn('embedded nul', str(e.exception))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue