binman: Move section padding to the parent

Each section is padded up to its size, if the contents are not large
enough. Move this logic from _BuildSectionData() to
GetPaddedDataForEntry() so that all the padding is in one place.

With this, the testDual test is working again, so enable it.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2020-10-26 17:40:13 -06:00
parent 4a655c9bd7
commit d1d3ad7d1f
2 changed files with 12 additions and 12 deletions

View File

@@ -708,7 +708,6 @@ class TestFunctional(unittest.TestCase):
"""Test a simple binman run with debugging enabled"""
self._DoTestFile('005_simple.dts', debug=True)
@unittest.skip('Disable for now until padding of images is supported')
def testDual(self):
"""Test that we can handle creating two images
@@ -3872,9 +3871,7 @@ class TestFunctional(unittest.TestCase):
before = tools.GetBytes(0, 8)
after = tools.GetBytes(0, 4)
all = before + U_BOOT_DATA + after
# This is not correct, but it is what binman currently produces
self.assertEqual(before + U_BOOT_DATA + tools.GetBytes(0, 16), data)
self.assertEqual(all, data)
image = control.images['image']
entries = image.GetEntries()
@@ -3882,6 +3879,7 @@ class TestFunctional(unittest.TestCase):
self.assertEqual(0, section.offset)
self.assertEqual(len(all), section.size)
self.assertIsNone(section.data)
self.assertEqual(all, section.GetPaddedData())
entry = section.GetEntries()['u-boot']
self.assertEqual(16, entry.offset)