提交 1835cd22 编写于 作者: S Simon Glass

binman: Make the operation of Entry__testing explicit

This fake entry is used for testing. At present it only has one behaviour
which is to return an invalid set of entry positions, to cause an error.

The fake entry will need to be used for other things too. Allow the test
.dts file to specify the behaviour of the fake entry, so we can control
its behaviour easily.

While we are here, drop the ReadContents() method, since this only applies
to subclasses of Entry_blob, which Entry__testing is not.
Signed-off-by: NSimon Glass <sjg@chromium.org>
上级 16d836cd
...@@ -10,16 +10,22 @@ import fdt_util ...@@ -10,16 +10,22 @@ import fdt_util
import tools import tools
class Entry__testing(Entry): class Entry__testing(Entry):
"""A fake entry used for testing
Properties:
return_invalid_entry: Return an invalid entry from GetPositions()
"""
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry.__init__(self, section, etype, node) Entry.__init__(self, section, etype, node)
self.return_invalid_entry = fdt_util.GetBool(self._node,
'return-invalid-entry')
def ObtainContents(self): def ObtainContents(self):
self.data = 'a' self.data = 'a'
self.contents_size = len(self.data) self.contents_size = len(self.data)
return True return True
def ReadContents(self):
return True
def GetPositions(self): def GetPositions(self):
return {'invalid-entry': [1, 2]} if self.return_invalid_entry :
return {'invalid-entry': [1, 2]}
return {}
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
binman { binman {
_testing { _testing {
return-invalid-entry;
}; };
}; };
}; };
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册