aboutsummaryrefslogtreecommitdiff
path: root/tools/binman/ftest.py
diff options
context:
space:
mode:
authorStefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>2022-08-19 16:25:38 +0200
committerSimon Glass <sjg@chromium.org>2022-08-20 18:07:33 -0600
commitcd15b640b0b8d5a7ba5f1c0587e4f9c767e2d8fb (patch)
treed835a61c4cf553ed3b7688d7e467edf53a56bec1 /tools/binman/ftest.py
parent432a825520a13a034f1becf1d0020404a705b6f7 (diff)
binman: Add zstd bintool
Add zstd bintool to binman to support on-the-fly compression. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/ftest.py')
-rw-r--r--tools/binman/ftest.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index bfca9c1355..0b1774046f 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -107,7 +107,7 @@ BASE_DTB_PROPS = ['offset', 'size', 'image-pos']
REPACK_DTB_PROPS = ['orig-offset', 'orig-size']
# Supported compression bintools
-COMP_BINTOOLS = ['bzip2', 'gzip', 'lz4', 'lzma_alone', 'lzop', 'xz']
+COMP_BINTOOLS = ['bzip2', 'gzip', 'lz4', 'lzma_alone', 'lzop', 'xz', 'zstd']
class TestFunctional(unittest.TestCase):
"""Functional tests for binman
@@ -5881,7 +5881,8 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
def testCompUtilPadding(self):
"""Test padding of compression algorithms"""
- for bintool in self.comp_bintools.values():
+ # Skip zstd because it doesn't support padding
+ for bintool in [v for k,v in self.comp_bintools.items() if k != 'zstd']:
self._CheckBintool(bintool)
data = bintool.compress(COMPRESS_DATA)
self.assertNotEqual(COMPRESS_DATA, data)
@@ -5889,6 +5890,13 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
orig = bintool.decompress(data)
self.assertEquals(COMPRESS_DATA, orig)
+ def testCompressDtbZstd(self):
+ """Test that zstd compress of device-tree files failed"""
+ with self.assertRaises(ValueError) as e:
+ self._DoTestFile('238_compress_dtb_zstd.dts')
+ self.assertIn("Node '/binman/u-boot-dtb': The zstd compression "
+ "requires a length header", str(e.exception))
+
if __name__ == "__main__":
unittest.main()