aboutsummaryrefslogtreecommitdiff
path: root/tools/binman/etype/_testing.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-07-08 14:25:37 -0600
committerSimon Glass <sjg@chromium.org>2019-07-24 12:54:08 -0700
commitc52c9e7da809e36001d125891e594c4740235055 (patch)
treeb2a206a5487a5cd7b156659e2358ccf0ccc92f98 /tools/binman/etype/_testing.py
parentbf6906bab4129660a74639e3fafb463917778d2b (diff)
downloadu-boot-c52c9e7da809e36001d125891e594c4740235055.zip
u-boot-c52c9e7da809e36001d125891e594c4740235055.tar.gz
u-boot-c52c9e7da809e36001d125891e594c4740235055.tar.bz2
binman: Allow entries to expand after packing
Add support for detecting entries that change size after they have already been packed, and re-running packing when it happens. This removes the limitation that entry size cannot change after PackEntries() is called. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/etype/_testing.py')
-rw-r--r--tools/binman/etype/_testing.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/binman/etype/_testing.py b/tools/binman/etype/_testing.py
index 2204362..ae24fe8 100644
--- a/tools/binman/etype/_testing.py
+++ b/tools/binman/etype/_testing.py
@@ -50,6 +50,8 @@ class Entry__testing(Entry):
'bad-update-contents')
self.return_contents_once = fdt_util.GetBool(self._node,
'return-contents-once')
+ self.bad_update_contents_twice = fdt_util.GetBool(self._node,
+ 'bad-update-contents-twice')
# Set to True when the entry is ready to process the FDT.
self.process_fdt_ready = False
@@ -71,11 +73,12 @@ class Entry__testing(Entry):
if self.force_bad_datatype:
self.GetEntryArgsOrProps([EntryArg('test-bad-datatype-arg', bool)])
self.return_contents = True
+ self.contents = b'a'
def ObtainContents(self):
if self.return_unknown_contents or not self.return_contents:
return False
- self.data = b'a'
+ self.data = self.contents
self.contents_size = len(self.data)
if self.return_contents_once:
self.return_contents = False
@@ -90,7 +93,11 @@ class Entry__testing(Entry):
if self.bad_update_contents:
# Request to update the contents with something larger, to cause a
# failure.
- return self.ProcessContentsUpdate('aa')
+ if self.bad_update_contents_twice:
+ self.contents += b'a'
+ else:
+ self.contents = b'aa'
+ return self.ProcessContentsUpdate(self.contents)
return True
def ProcessFdt(self, fdt):