summaryrefslogtreecommitdiff
path: root/tools/binman/ftest.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-07-06 10:27:19 -0600
committerSimon Glass <sjg@chromium.org>2018-07-09 09:11:00 -0600
commit5c890238c480a96d4d0b06c92199e21867170c31 (patch)
treee538c0257a7f4d8c8377ecb00044281536085dec /tools/binman/ftest.py
parent2cd01285b53f376e439e4cbdbce808ca8231ef84 (diff)
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>
Diffstat (limited to 'tools/binman/ftest.py')
-rw-r--r--tools/binman/ftest.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index ca9d158eef3..af3b4dc3e56 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -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()