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>
diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index d08b0b5..5cde8c1 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -138,6 +138,7 @@
else:
return TYPE_INT, val
+ @classmethod
def GetEmpty(self, type):
"""Get an empty / zero value of the given type
@@ -335,12 +336,19 @@
"""
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.