summaryrefslogtreecommitdiff
path: root/tools/dtoc/test_fdt.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-07-17 13:25:40 -0600
committerSimon Glass <sjg@chromium.org>2018-08-01 16:30:48 -0600
commit3af8e49ceff044021725fc547b19ebac22d0b0f7 (patch)
treee0d82e9e4a9e94f1ffe36da7fa4ba78a4da213c7 /tools/dtoc/test_fdt.py
parentec127af0429ad6f9818297f9c3ee77edb2154182 (diff)
downloadu-boot-3af8e49ceff044021725fc547b19ebac22d0b0f7.tar.gz
binman: Add an entry filled with a repeating byte
It is sometimes useful to have an area of the image which is all zeroes, or all 0xff. This can often be achieved by padding the size of an an existing entry and setting the pad byte for an entry or image. But it is useful to have an explicit means of adding blocks of repeating data to the image. Add a 'fill' entry type to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/dtoc/test_fdt.py')
-rwxr-xr-xtools/dtoc/test_fdt.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 03cf4b4f7c..38e1732f52 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -380,6 +380,20 @@ class TestFdtUtil(unittest.TestCase):
self.assertEqual(True, fdt_util.GetBool(self.node, 'missing', True))
self.assertEqual(False, fdt_util.GetBool(self.node, 'missing', False))
+ def testGetByte(self):
+ self.assertEqual(5, fdt_util.GetByte(self.node, 'byteval'))
+ self.assertEqual(3, fdt_util.GetByte(self.node, 'missing', 3))
+
+ with self.assertRaises(ValueError) as e:
+ fdt_util.GetByte(self.node, 'longbytearray')
+ self.assertIn("property 'longbytearray' has list value: expecting a "
+ 'single byte', str(e.exception))
+
+ with self.assertRaises(ValueError) as e:
+ fdt_util.GetByte(self.node, 'intval')
+ self.assertIn("property 'intval' has length 4, expecting 1",
+ str(e.exception))
+
def testGetDataType(self):
self.assertEqual(1, fdt_util.GetDatatype(self.node, 'intval', int))
self.assertEqual('message', fdt_util.GetDatatype(self.node, 'stringval',
@@ -387,7 +401,6 @@ class TestFdtUtil(unittest.TestCase):
with self.assertRaises(ValueError) as e:
self.assertEqual(3, fdt_util.GetDatatype(self.node, 'boolval',
bool))
-
def testFdtCellsToCpu(self):
val = self.node.props['intarray'].value
self.assertEqual(0, fdt_util.fdt_cells_to_cpu(val, 0))