return dtb.GetContents()
def _DoReadFileDtb(self, fname, use_real_dtb=False, use_expanded=False,
- verbosity=None, map=False, update_dtb=False,
- entry_args=None, reset_dtbs=True, extra_indirs=None,
- threads=None):
+ verbosity=None, allow_fake_blobs=True, map=False,
+ update_dtb=False, entry_args=None, reset_dtbs=True,
+ extra_indirs=None, threads=None):
"""Run binman and return the resulting image
This runs binman with a given test file and then reads the resulting
use_expanded: True to use expanded entries where available, e.g.
'u-boot-expanded' instead of 'u-boot'
verbosity: Verbosity level to use (0-3, None=don't set it)
+ allow_fake_blobs: whether binman should fake missing ext blobs
map: True to output map files for the images
update_dtb: Update the offset and size of each entry in the device
tree before packing it into the image
retcode = self._DoTestFile(fname, map=map, update_dtb=update_dtb,
entry_args=entry_args, use_real_dtb=use_real_dtb,
use_expanded=use_expanded, verbosity=verbosity,
- extra_indirs=extra_indirs,
+ allow_fake_blobs=allow_fake_blobs, extra_indirs=extra_indirs,
threads=threads)
self.assertEqual(0, retcode)
out_dtb_fname = tools.get_output_filename('u-boot.dtb.out')
def testExtblobList(self):
"""Test an image with an external blob list"""
- data = self._DoReadFile('215_blob_ext_list.dts')
- self.assertEqual(REFCODE_DATA + FSP_M_DATA, data)
+ data = self._DoReadFileDtb('215_blob_ext_list.dts',
+ allow_fake_blobs=False)
+ self.assertEqual(REFCODE_DATA + FSP_M_DATA, data[0])
def testExtblobListMissing(self):
"""Test an image with a missing external blob"""
with self.assertRaises(ValueError) as e:
- self._DoReadFile('216_blob_ext_list_missing.dts')
+ self._DoReadFileDtb('216_blob_ext_list_missing.dts',
+ allow_fake_blobs=False)
self.assertIn("Filename 'missing-file' not found in input path",
str(e.exception))
"""Test an image with an missing external blob that is allowed"""
with terminal.capture() as (stdout, stderr):
self._DoTestFile('216_blob_ext_list_missing.dts',
- allow_missing=True)
+ allow_missing=True, allow_fake_blobs=False)
err = stderr.getvalue()
self.assertRegex(err, "Image 'image'.*missing.*: blob-ext")
def testFitSplitElfMissing(self):
- """Test an split-elf FIT with a missing ELF file"""
+ """Test an split-elf FIT with a missing ELF file. Don't fake the file."""
if not elf.ELF_TOOLS:
self.skipTest('Python elftools not available')
- out, err = self.checkFitSplitElf(allow_missing=True)
+ out, err = self.checkFitSplitElf(allow_missing=True, allow_fake_blobs=False)
self.assertRegex(
err,
"Image '.*' is missing external blobs and is non-functional: .*")
def testExtblobMissingOptional(self):
"""Test an image with an external blob that is optional"""
with terminal.capture() as (stdout, stderr):
- data = self._DoReadFile('266_blob_ext_opt.dts')
+ data = self._DoReadFileDtb('266_blob_ext_opt.dts',
+ allow_fake_blobs=False)[0]
self.assertEqual(REFCODE_DATA, data)
self.assertNotIn(MISSING_DATA, data)