1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-02 01:02:19 +02:00

binman: Tidy up setting of entry contents

At present the contents of an entry are set in subclasses simply by
assigning to the data and content_size properties. Add some methods to do
this, so that we have more control. In particular, add a method to set the
contents without changing its size, so we can validate that case.

Add a test case for trying to change the size when this is not allowed.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2018-07-06 10:27:19 -06:00
parent 2cd01285b5
commit 5c890238c4
7 changed files with 62 additions and 6 deletions

View File

@@ -1006,5 +1006,13 @@ class TestFunctional(unittest.TestCase):
"processing of contents: remaining [<_testing.Entry__testing ",
str(e.exception))
def testBadChangeSize(self):
"""Test that trying to change the size of an entry fails"""
with self.assertRaises(ValueError) as e:
self._DoReadFile('59_change_size.dts', True)
self.assertIn("Node '/binman/_testing': Cannot update entry size from "
'2 to 1', str(e.exception))
if __name__ == "__main__":
unittest.main()