summaryrefslogtreecommitdiff
path: root/tools/binman/ftest.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-01-09 20:14:10 -0700
committerSimon Glass <sjg@chromium.org>2022-01-25 12:36:11 -0700
commita00d9713e4c01de7e7753c9394a95dca27e47e21 (patch)
tree6e83774eff49fb7f7c4d634281d3e985700c641a /tools/binman/ftest.py
parent4f9ee83ba96c6c4e5e647f26eb4a124544ce61d7 (diff)
binman: Complete test coverage of comp_util
Drop the unused gzip code, update comments and add a test for an invalid algorithm. The temporary file is not needed now, so drop that also. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/ftest.py')
-rw-r--r--tools/binman/ftest.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 6e1c4985b09..a3454ddb104 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -5076,6 +5076,15 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
self._DoBinman(*args)
self.assertIn('failed to fetch with all methods', stdout.getvalue())
+ def testInvalidCompress(self):
+ with self.assertRaises(ValueError) as e:
+ comp_util.compress(b'', 'invalid')
+ self.assertIn("Unknown algorithm 'invalid'", str(e.exception))
+
+ with self.assertRaises(ValueError) as e:
+ comp_util.decompress(b'1234', 'invalid')
+ self.assertIn("Unknown algorithm 'invalid'", str(e.exception))
+
if __name__ == "__main__":
unittest.main()