summaryrefslogtreecommitdiff
path: root/tools/binman/ftest.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-08-07 09:46:46 -0600
committerSimon Glass <sjg@chromium.org>2022-08-20 18:07:32 -0600
commit7960a0a289506890474db0703344a87ac2f295db (patch)
treeb6670586ae72982851b6bdd3dc8a7611b203f9a1 /tools/binman/ftest.py
parent3212be5e24c5861c4209785fd5f654f43fe9d409 (diff)
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>
Diffstat (limited to 'tools/binman/ftest.py')
-rw-r--r--tools/binman/ftest.py30
1 files changed, 24 insertions, 6 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index fa1f421c052..c8bab5c9416 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -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"""