1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-25 04:21:18 +02:00

binman: Put fake files in a subdirectory

At present fake files from a previous build appear to be real files for
a subsequent build, since they sit in the output directory.

This can cause problems, since binman may need to parse the file, e.g.
with the Intel description.bin files.

Fix this by putting them in a 'binman-fake' subdirectory. Keep a track
of the fake filename so we only create it once. Subsequent builds will
still see that the file is missing and mark it as fake.

Update a few tests to check the behaviour.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2022-08-07 09:46:46 -06:00
parent 3212be5e24
commit 7960a0a289
4 changed files with 53 additions and 14 deletions

View File

@@ -5453,7 +5453,16 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
err)
def checkFitSplitElf(self, **kwargs):
"""Test an split-elf FIT with a missing ELF file"""
"""Test an split-elf FIT with a missing ELF file
Args:
kwargs (dict of str): Arguments to pass to _DoTestFile()
Returns:
tuple:
str: stdout result
str: stderr result
"""
entry_args = {
'of-list': 'test-fdt1 test-fdt2',
'default-dt': 'test-fdt2',
@@ -5464,23 +5473,32 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
with test_util.capture_sys_output() as (stdout, stderr):
self._DoTestFile(
'226_fit_split_elf.dts', entry_args=entry_args,
extra_indirs=[test_subdir], **kwargs)
err = stderr.getvalue()
return err
extra_indirs=[test_subdir], verbosity=3, **kwargs)
out = stdout.getvalue()
err = stderr.getvalue()
return out, err
def testFitSplitElfMissing(self):
"""Test an split-elf FIT with a missing ELF file"""
err = self.checkFitSplitElf(allow_missing=True)
out, err = self.checkFitSplitElf(allow_missing=True)
self.assertRegex(
err,
"Image '.*' is missing external blobs and is non-functional: .*")
self.assertNotRegex(out, '.*Faked blob.*')
fname = tools.get_output_filename('binman-fake/missing.elf')
self.assertFalse(os.path.exists(fname))
def testFitSplitElfFaked(self):
"""Test an split-elf FIT with faked ELF file"""
err = self.checkFitSplitElf(allow_missing=True, allow_fake_blobs=True)
out, err = self.checkFitSplitElf(allow_missing=True, allow_fake_blobs=True)
self.assertRegex(
err,
"Image '.*' is missing external blobs and is non-functional: .*")
self.assertRegex(
out,
"Entry '/binman/fit/images/@tee-SEQ/tee-os': Faked blob '.*binman-fake/missing.elf")
fname = tools.get_output_filename('binman-fake/missing.elf')
self.assertTrue(os.path.exists(fname))
def testPreLoad(self):
"""Test an image with a pre-load header"""