aboutsummaryrefslogtreecommitdiff
path: root/tools/binman/ftest.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-01-06 21:35:16 -0700
committerSimon Glass <sjg@chromium.org>2021-01-30 14:25:41 -0700
commit939d1062d05fb4990ca7898613bcc753574f7c56 (patch)
tree7e7ac0cb10123e23424ec8c1acc8577806516f88 /tools/binman/ftest.py
parent870a9ead569ce8ee1f9fc03d178b56e012465582 (diff)
binman: Support reading an image with entry args
Normally when an entry is created, any entry arguments it has are required to be provided, so it can actually generate its contents correctly. However when an existing image is read, Entry objects are created for each of the entries in the image. This happens as part of the process of reading the image into binman. In this case we don't need the entry arguments, since we do not intend to regenerate the entries, or at least not unless requested. So there is no sense in reporting an error for missing entry arguments. Add a new property for the Image to handle this case. Update the error reporting to be conditional on this property. 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, 19 insertions, 0 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 5016060ea6..8b928eb406 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -4154,6 +4154,25 @@ class TestFunctional(unittest.TestCase):
U_BOOT_SPL_DATA[20:])
self.assertEqual(expected, data)
+ def testReadImageEntryArg(self):
+ """Test reading an image that would need an entry arg to generate"""
+ entry_args = {
+ 'cros-ec-rw-path': 'ecrw.bin',
+ }
+ data = self.data = self._DoReadFileDtb(
+ '188_image_entryarg.dts',use_real_dtb=True, update_dtb=True,
+ entry_args=entry_args)
+
+ image_fname = tools.GetOutputFilename('image.bin')
+ orig_image = control.images['image']
+
+ # This should not generate an error about the missing 'cros-ec-rw-path'
+ # since we are reading the image from a file. Compare with
+ # testEntryArgsRequired()
+ image = Image.FromFile(image_fname)
+ self.assertEqual(orig_image.GetEntries().keys(),
+ image.GetEntries().keys())
+
if __name__ == "__main__":
unittest.main()