summaryrefslogtreecommitdiff
path: root/tools/binman/ftest.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-10-27 02:40:09 +0300
committerSimon Glass <sjg@chromium.org>2020-10-29 23:42:59 +0300
commitf90d906a275f85e7077d9a30ab82b20676b54645 (patch)
treeecce3b12a7a78d5ebcd90223e330719f9c2f6872 /tools/binman/ftest.py
parentef439ed191a0655a86f5b4035cec9cc57e97d8b1 (diff)
downloadu-boot-f90d906a275f85e7077d9a30ab82b20676b54645.tar.xz
binman: Expand docs and test for padding
Padding becomes part of the entry once the image is written out, but within binman the entry contents does not include the padding. Add documentation to make this clear, as well as a test. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/ftest.py')
-rw-r--r--tools/binman/ftest.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 481b8fd03c..35c1420681 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -3548,12 +3548,39 @@ class TestFunctional(unittest.TestCase):
def testPadInSections(self):
"""Test pad-before, pad-after for entries in sections"""
- data = self._DoReadFile('166_pad_in_sections.dts')
+ data, _, _, out_dtb_fname = self._DoReadFileDtb(
+ '166_pad_in_sections.dts', update_dtb=True)
expected = (U_BOOT_DATA + tools.GetBytes(ord('!'), 12) +
U_BOOT_DATA + tools.GetBytes(ord('!'), 6) +
U_BOOT_DATA)
self.assertEqual(expected, data)
+ dtb = fdt.Fdt(out_dtb_fname)
+ dtb.Scan()
+ props = self._GetPropTree(dtb, ['size', 'image-pos', 'offset'])
+ expected = {
+ 'image-pos': 0,
+ 'offset': 0,
+ 'size': 12 + 6 + 3 * len(U_BOOT_DATA),
+
+ 'section:image-pos': 0,
+ 'section:offset': 0,
+ 'section:size': 12 + 6 + 3 * len(U_BOOT_DATA),
+
+ 'section/before:image-pos': 0,
+ 'section/before:offset': 0,
+ 'section/before:size': len(U_BOOT_DATA),
+
+ 'section/u-boot:image-pos': 4,
+ 'section/u-boot:offset': 4,
+ 'section/u-boot:size': 12 + len(U_BOOT_DATA) + 6,
+
+ 'section/after:image-pos': 26,
+ 'section/after:offset': 26,
+ 'section/after:size': len(U_BOOT_DATA),
+ }
+ self.assertEqual(expected, props)
+
def testFitImageSubentryAlignment(self):
"""Test relative alignability of FIT image subentries"""
entry_args = {