summaryrefslogtreecommitdiff
path: root/tools/dtoc/fdt.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-07-06 10:27:24 -0600
committerSimon Glass <sjg@chromium.org>2018-07-09 09:11:00 -0600
commit2ba987531254dfacb299e88406b3da73ea2d7915 (patch)
tree9a29cd19b78caeee72b29dd55ccba788279c1cd4 /tools/dtoc/fdt.py
parentff1fd6ccde3d166213d1277fa6b6b9685d45044f (diff)
downloadu-boot-2ba987531254dfacb299e88406b3da73ea2d7915.tar.gz
dtoc: Add some tests for the fdt module
At present this module is tested via the dtoc tests. This is a bit painful since the tests are at a higher level and so failures are more difficult to diagnose. Add some tests that exercise the fdt module directly. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/dtoc/fdt.py')
-rw-r--r--tools/dtoc/fdt.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index d08b0b53e6..5cde8c125a 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -138,6 +138,7 @@ class Prop:
else:
return TYPE_INT, val
+ @classmethod
def GetEmpty(self, type):
"""Get an empty / zero value of the given type
@@ -335,12 +336,19 @@ class Fdt:
"""
return self._fdt
- def CheckErr(errnum, msg):
+ def GetFdtObj(self):
+ """Get the contents of the FDT
+
+ Returns:
+ The FDT contents as a libfdt.Fdt object
+ """
+ return self._fdt_obj
+
+ def CheckErr(self, errnum, msg):
if errnum:
raise ValueError('Error %d: %s: %s' %
(errnum, libfdt.fdt_strerror(errnum), msg))
-
def GetProps(self, node):
"""Get all properties from a node.