aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorStefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>2022-08-19 16:25:32 +0200
committerSimon Glass <sjg@chromium.org>2022-08-20 18:07:33 -0600
commitda1af35c2f4c09a1fad9b135a11b754e5c6cb234 (patch)
tree41f52d53061cd86ef2ab088d19583f5eddfec3d0 /tools
parentc3665a896e30578f8e5d6f1927da304efcd14735 (diff)
downloadu-boot-da1af35c2f4c09a1fad9b135a11b754e5c6cb234.zip
u-boot-da1af35c2f4c09a1fad9b135a11b754e5c6cb234.tar.gz
u-boot-da1af35c2f4c09a1fad9b135a11b754e5c6cb234.tar.bz2
binman: Add compression tests
Add common test functions to test all supported compressions. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/binman/ftest.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 81ecc88..47763c8 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -5863,6 +5863,32 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
self._DoTestFile('237_compress_dtb_invalid.dts')
self.assertIn("Unknown algorithm 'invalid'", str(e.exception))
+ def testCompUtilCompressions(self):
+ """Test compression algorithms"""
+ for bintool in self.comp_bintools.values():
+ self._CheckBintool(bintool)
+ data = bintool.compress(COMPRESS_DATA)
+ self.assertNotEqual(COMPRESS_DATA, data)
+ orig = bintool.decompress(data)
+ self.assertEquals(COMPRESS_DATA, orig)
+
+ def testCompUtilVersions(self):
+ """Test tool version of compression algorithms"""
+ for bintool in self.comp_bintools.values():
+ self._CheckBintool(bintool)
+ version = bintool.version()
+ self.assertRegex(version, '^v?[0-9]+[0-9.]*')
+
+ def testCompUtilPadding(self):
+ """Test padding of compression algorithms"""
+ for bintool in self.comp_bintools.values():
+ self._CheckBintool(bintool)
+ data = bintool.compress(COMPRESS_DATA)
+ self.assertNotEqual(COMPRESS_DATA, data)
+ data += tools.get_bytes(0, 64)
+ orig = bintool.decompress(data)
+ self.assertEquals(COMPRESS_DATA, orig)
+
if __name__ == "__main__":
unittest.main()