summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-03-02 17:02:43 -0700
committerSimon Glass <sjg@chromium.org>2023-03-08 13:15:14 -0800
commit033828cf34e11776913298385efac406de89dd08 (patch)
treed2af7324bdb2209f70fc8530c113b7abdae5f132 /tools
parente00197f92d8485a1285903227f6ee5058ee423df (diff)
downloadu-boot-033828cf34e11776913298385efac406de89dd08.tar.gz
binman: Handle missing bintools correctly in fit
At present these are handled as if they are allowed to be missing, but this is only true if the -M flag is provided. Fix this and add a test. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/binman/etype/fit.py2
-rw-r--r--tools/binman/ftest.py10
2 files changed, 11 insertions, 1 deletions
diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py
index 9def443361..39aa792b10 100644
--- a/tools/binman/etype/fit.py
+++ b/tools/binman/etype/fit.py
@@ -453,6 +453,8 @@ class Entry_fit(Entry_section):
args.update({'align': fdt_util.fdt32_to_cpu(align.value)})
if self.mkimage.run(reset_timestamp=True, output_fname=output_fname,
**args) is None:
+ if not self.GetAllowMissing():
+ self.Raise("Missing tool: 'mkimage'")
# Bintool is missing; just use empty data as the output
self.record_missing_bintool(self.mkimage)
return tools.get_bytes(0, 1024)
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 59085804c2..934c8dd26f 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -3999,9 +3999,17 @@ class TestFunctional(unittest.TestCase):
self.assertEqual(expected, data[image_pos:image_pos+size])
def testFitMissing(self):
+ """Test that binman complains if mkimage is missing"""
+ with self.assertRaises(ValueError) as e:
+ self._DoTestFile('162_fit_external.dts',
+ force_missing_bintools='mkimage')
+ self.assertIn("Node '/binman/fit': Missing tool: 'mkimage'",
+ str(e.exception))
+
+ def testFitMissingOK(self):
"""Test that binman still produces a FIT image if mkimage is missing"""
with test_util.capture_sys_output() as (_, stderr):
- self._DoTestFile('162_fit_external.dts',
+ self._DoTestFile('162_fit_external.dts', allow_missing=True,
force_missing_bintools='mkimage')
err = stderr.getvalue()
self.assertRegex(err, "Image 'image'.*missing bintools.*: mkimage")