diff mbox series

[05/18] binman: Workaround lz4 cli padding in test cases

Message ID 20240717-docker-image-v1-5-7c7fc6251e7a@flygoat.com
State Changes Requested
Delegated to: Tom Rini
Headers show
Series New CI image and fixes | expand

Commit Message

Jiaxun Yang July 17, 2024, 2:29 p.m. UTC
Newer lz4 util is not happy with any padding at end of file,
it would abort with error message like:

Stream followed by undecodable data at position 43.

Workaround by skipping testCompUtilPadding test case and manually
strip padding in testCompressSectionSize test case.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 tools/binman/ftest.py                           | 7 +++++--
 tools/binman/test/184_compress_section_size.dts | 1 +
 2 files changed, 6 insertions(+), 2 deletions(-)

Comments

Simon Glass July 19, 2024, 3:05 p.m. UTC | #1
On Wed, 17 Jul 2024 at 15:29, Jiaxun Yang <jiaxun.yang@flygoat.com> wrote:
>
> Newer lz4 util is not happy with any padding at end of file,
> it would abort with error message like:
>
> Stream followed by undecodable data at position 43.
>
> Workaround by skipping testCompUtilPadding test case and manually
> strip padding in testCompressSectionSize test case.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>  tools/binman/ftest.py                           | 7 +++++--
>  tools/binman/test/184_compress_section_size.dts | 1 +
>  2 files changed, 6 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>


>
> diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
> index e9ad145e790d..0143d5e41737 100644
> --- a/tools/binman/ftest.py
> +++ b/tools/binman/ftest.py
> @@ -4518,6 +4518,8 @@ class TestFunctional(unittest.TestCase):
>          dtb.Scan()
>          props = self._GetPropTree(dtb, ['offset', 'image-pos', 'size',
>                                          'uncomp-size'])
> +        data = data[:0x30]
> +        data = data.rstrip(b'\xff')
>          orig = self._decompress(data)
>          self.assertEqual(COMPRESS_DATA + U_BOOT_DATA, orig)
>          expected = {
> @@ -6118,8 +6120,9 @@ fdt         fdtmap                Extract the devicetree blob from the fdtmap
>
>      def testCompUtilPadding(self):
>          """Test padding of compression algorithms"""
> -        # Skip zstd because it doesn't support padding
> -        for bintool in [v for k,v in self.comp_bintools.items() if k != 'zstd']:
> +        # Skip zstd and lz4 because they doesn't support padding
> +        for bintool in [v for k,v in self.comp_bintools.items()
> +                        if not k in ['zstd', 'lz4']]:
>              self._CheckBintool(bintool)
>              data = bintool.compress(COMPRESS_DATA)
>              self.assertNotEqual(COMPRESS_DATA, data)
> diff --git a/tools/binman/test/184_compress_section_size.dts b/tools/binman/test/184_compress_section_size.dts
> index 95ed30add1aa..1c1dbd5f580f 100644
> --- a/tools/binman/test/184_compress_section_size.dts
> +++ b/tools/binman/test/184_compress_section_size.dts
> @@ -6,6 +6,7 @@
>                 section {
>                         size = <0x30>;
>                         compress = "lz4";
> +                       pad-byte = <0xff>;
>                         blob {
>                                 filename = "compress";
>                         };
>
> --
> 2.45.2
>
diff mbox series

Patch

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index e9ad145e790d..0143d5e41737 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -4518,6 +4518,8 @@  class TestFunctional(unittest.TestCase):
         dtb.Scan()
         props = self._GetPropTree(dtb, ['offset', 'image-pos', 'size',
                                         'uncomp-size'])
+        data = data[:0x30]
+        data = data.rstrip(b'\xff')
         orig = self._decompress(data)
         self.assertEqual(COMPRESS_DATA + U_BOOT_DATA, orig)
         expected = {
@@ -6118,8 +6120,9 @@  fdt         fdtmap                Extract the devicetree blob from the fdtmap
 
     def testCompUtilPadding(self):
         """Test padding of compression algorithms"""
-        # Skip zstd because it doesn't support padding
-        for bintool in [v for k,v in self.comp_bintools.items() if k != 'zstd']:
+        # Skip zstd and lz4 because they doesn't support padding
+        for bintool in [v for k,v in self.comp_bintools.items()
+                        if not k in ['zstd', 'lz4']]:
             self._CheckBintool(bintool)
             data = bintool.compress(COMPRESS_DATA)
             self.assertNotEqual(COMPRESS_DATA, data)
diff --git a/tools/binman/test/184_compress_section_size.dts b/tools/binman/test/184_compress_section_size.dts
index 95ed30add1aa..1c1dbd5f580f 100644
--- a/tools/binman/test/184_compress_section_size.dts
+++ b/tools/binman/test/184_compress_section_size.dts
@@ -6,6 +6,7 @@ 
 		section {
 			size = <0x30>;
 			compress = "lz4";
+			pad-byte = <0xff>;
 			blob {
 				filename = "compress";
 			};