summaryrefslogtreecommitdiff
path: root/tools/binman/ftest.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-07-17 13:25:33 -0600
committerSimon Glass <sjg@chromium.org>2018-08-01 16:30:47 -0600
commitbb74837c9a32e51187d843c2469f0176d674c5f9 (patch)
treeb7597444221cb13594090527ff54ee5f0dad8d12 /tools/binman/ftest.py
parent53af22a9958ca93c89056ad2750ad0d46a51b6c8 (diff)
binman: Support an entry that holds text
It is useful to able to write an identifying string to the image within an entry. Add a 'text' entry type to handle this. The actual text is typically passed to binman on the command line. The text is not itself nul-terminated but this can be achieved if required by setting the size of the entry to something larger than the text. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/ftest.py')
-rw-r--r--tools/binman/ftest.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index c54cd12e717..696889601ef 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -41,6 +41,9 @@ FSP_DATA = 'fsp'
CMC_DATA = 'cmc'
VBT_DATA = 'vbt'
MRC_DATA = 'mrc'
+TEXT_DATA = 'text'
+TEXT_DATA2 = 'text2'
+TEXT_DATA3 = 'text3'
class TestFunctional(unittest.TestCase):
"""Functional tests for binman
@@ -1161,6 +1164,19 @@ class TestFunctional(unittest.TestCase):
self.assertIn('GetArg() internal error: Unknown data type ',
str(e.exception))
+ def testText(self):
+ """Test for a text entry type"""
+ entry_args = {
+ 'test-id': TEXT_DATA,
+ 'test-id2': TEXT_DATA2,
+ 'test-id3': TEXT_DATA3,
+ }
+ data, _, _, _ = self._DoReadFileDtb('66_text.dts',
+ entry_args=entry_args)
+ expected = (TEXT_DATA + chr(0) * (8 - len(TEXT_DATA)) + TEXT_DATA2 +
+ TEXT_DATA3 + 'some text')
+ self.assertEqual(expected, data)
+
if __name__ == "__main__":
unittest.main()