aboutsummaryrefslogtreecommitdiff
path: root/tools/binman/ftest.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-11-09 19:14:42 -0700
committerSimon Glass <sjg@chromium.org>2022-11-22 15:13:34 -0700
commitb38da15a054c4ce5ac7c46147995f1387ab24d3b (patch)
tree3a93d7a4d18329d34be85fb1459c09e2e3d52aeb /tools/binman/ftest.py
parent921b0a6ce2aef19299c702dd4653889189ed81b6 (diff)
binman: Use an exit code when blobs are missing
At present binman returns success when told to handle missing/faked blobs or missing bintools. This is confusing since in fact the resulting image cannot work. Use exit code 103 to signal this problem, with a -W option to convert it to a warning. Rename the flag to --ignore-missing since it controls bintools also. Add documentation about exit codes while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/ftest.py')
-rw-r--r--tools/binman/ftest.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index e849d96587..62ee86b9b7 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -340,7 +340,7 @@ class TestFunctional(unittest.TestCase):
use_expanded=False, verbosity=None, allow_missing=False,
allow_fake_blobs=False, extra_indirs=None, threads=None,
test_section_timeout=False, update_fdt_in_elf=None,
- force_missing_bintools=''):
+ force_missing_bintools='', ignore_missing=False):
"""Run binman with a given test file
Args:
@@ -403,6 +403,8 @@ class TestFunctional(unittest.TestCase):
args.append('-a%s=%s' % (arg, value))
if allow_missing:
args.append('-M')
+ if ignore_missing:
+ args.append('-W')
if allow_fake_blobs:
args.append('--fake-ext-blobs')
if force_missing_bintools:
@@ -3725,9 +3727,22 @@ class TestFunctional(unittest.TestCase):
def testExtblobMissingOk(self):
"""Test an image with an missing external blob that is allowed"""
with test_util.capture_sys_output() as (stdout, stderr):
- self._DoTestFile('158_blob_ext_missing.dts', allow_missing=True)
+ ret = self._DoTestFile('158_blob_ext_missing.dts',
+ allow_missing=True)
+ self.assertEqual(103, ret)
err = stderr.getvalue()
self.assertRegex(err, "Image 'main-section'.*missing.*: blob-ext")
+ self.assertIn('Some images are invalid', err)
+
+ def testExtblobMissingOkFlag(self):
+ """Test an image with an missing external blob allowed with -W"""
+ with test_util.capture_sys_output() as (stdout, stderr):
+ ret = self._DoTestFile('158_blob_ext_missing.dts',
+ allow_missing=True, ignore_missing=True)
+ self.assertEqual(0, ret)
+ err = stderr.getvalue()
+ self.assertRegex(err, "Image 'main-section'.*missing.*: blob-ext")
+ self.assertIn('Some images are invalid', err)
def testExtblobMissingOkSect(self):
"""Test an image with an missing external blob that is allowed"""