summaryrefslogtreecommitdiff
path: root/tools/binman/ftest.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-03-21 18:24:33 +1300
committerSimon Glass <sjg@chromium.org>2021-03-27 16:26:48 +1300
commit5ff9fedc9bc02e01d73d57e9c7d7eac9fd6320d4 (patch)
tree0fc99fe53f99d7f97011a990ddf452454ad7b15b /tools/binman/ftest.py
parent631f752de5b8dccbf9a0d4824213e9e6e0d96167 (diff)
binman: Support default alignment for sections
Sometimes it is useful to specify the default alignment for all entries in a section, such as when word-alignment is necessary, for example. It is tedious and error-prone to specify this individually for each section. Add a property to control this for a section. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/ftest.py')
-rw-r--r--tools/binman/ftest.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 043b1b037c4..89fe6612e1b 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -4496,6 +4496,18 @@ class TestFunctional(unittest.TestCase):
section + tools.GetBytes(0xfe, 3) + U_BOOT_DATA,
data)
+ def testAlignDefault(self):
+ """Test that default alignment works on sections"""
+ data = self._DoReadFile('200_align_default.dts')
+ expected = (U_BOOT_DATA + tools.GetBytes(0, 8 - len(U_BOOT_DATA)) +
+ U_BOOT_DATA)
+ # Special alignment for section
+ expected += tools.GetBytes(0, 32 - len(expected))
+ # No alignment within the nested section
+ expected += U_BOOT_DATA + U_BOOT_NODTB_DATA;
+ # Now the final piece, which should be default-aligned
+ expected += tools.GetBytes(0, 88 - len(expected)) + U_BOOT_NODTB_DATA
+ self.assertEqual(expected, data)
if __name__ == "__main__":
unittest.main()