pylibfdt: Add support for fdt_node_offset_by_phandle()

Add this into the class to simplify use of this function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Simon Glass 2017-08-19 11:17:59 -06:00 committed by David Gibson
parent a3ae437236
commit 46f31b65b3
2 changed files with 24 additions and 0 deletions

View file

@ -308,5 +308,15 @@ class PyLibfdtTests(unittest.TestCase):
node2 = self.fdt.path_offset('/subnode@2/subsubnode@0')
self.assertEquals(node1, self.fdt.parent_offset(node2))
def testNodeOffsetByPhandle(self):
"""Test for the node_offset_by_phandle() method"""
self.assertEquals(-libfdt.NOTFOUND,
self.fdt.node_offset_by_phandle(1, QUIET_NOTFOUND))
node1 = self.fdt.path_offset('/subnode@2')
self.assertEquals(node1, self.fdt.node_offset_by_phandle(0x2000))
node2 = self.fdt.path_offset('/subnode@2/subsubnode@0')
self.assertEquals(node2, self.fdt.node_offset_by_phandle(0x2001))
if __name__ == "__main__":
unittest.main()