U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5/7] binman: Workaround lz4 cli padding in test cases
  2025-02-25 20:06 Simon Glass
@ 2025-02-25 20:06 ` Simon Glass
  0 siblings, 0 replies; 14+ messages in thread
From: Simon Glass @ 2025-02-25 20:06 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Jiaxun Yang, Simon Glass, Alexander Kochetkov, Alper Nebi Yasak,
	Brandon Maier, Neha Malcom Francis, Peng Fan, Philippe Reynes,
	Stefan Herbrechtsmeier, Tom Rini

From: Jiaxun Yang <jiaxun.yang@flygoat.com>

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>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

 tools/binman/ftest.py                           | 7 +++++--
 tools/binman/test/184_compress_section_size.dts | 1 +
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 53242c6333f..da39807693b 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -4591,6 +4591,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 = {
@@ -6196,8 +6198,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 95ed30add1a..1c1dbd5f580 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.43.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 0/7] binman: Check code-coverage requirements
@ 2025-03-04 13:09 Simon Glass
  2025-03-04 13:09 ` [PATCH 1/7] binman: Exclude dist-packages and site-packages Simon Glass
                   ` (7 more replies)
  0 siblings, 8 replies; 14+ messages in thread
From: Simon Glass @ 2025-03-04 13:09 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Simon Glass, Alexander Kochetkov, Alper Nebi Yasak, Brandon Maier,
	Jerome Forissier, Jiaxun Yang, Neha Malcom Francis,
	Patrick Rudolph, Paul HENRYS, Peng Fan, Philippe Reynes,
	Stefan Herbrechtsmeier, Tom Rini

This series adds a cover-coverage check to CI for Binman. The iMX8 tests
are still not completed, so a work-around is included for those.

A few fixes are included for some other problems.


Jiaxun Yang (1):
  binman: Workaround lz4 cli padding in test cases

Simon Glass (6):
  binman: Exclude dist-packages and site-packages
  binman: Drop GetRootSkipAtStart()
  binman: fit: Drop unused code
  binman: Drop algo check in CheckSetHashValue()
  binman: Work around missing test coverage
  CI: Run code-coverage test for Binman

 .azure-pipelines.yml                           |  5 ++++-
 .gitlab-ci.yml                                 |  4 +++-
 tools/binman/etype/fit.py                      |  2 --
 tools/binman/etype/section.py                  | 17 -----------------
 tools/binman/ftest.py                          |  7 +++++--
 tools/binman/main.py                           |  8 +++++++-
 tools/binman/state.py                          |  3 +--
 .../binman/test/184_compress_section_size.dts  |  1 +
 tools/u_boot_pylib/test_util.py                | 18 ++++++++++++++++--
 9 files changed, 37 insertions(+), 28 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/7] binman: Exclude dist-packages and site-packages
  2025-03-04 13:09 [PATCH 0/7] binman: Check code-coverage requirements Simon Glass
@ 2025-03-04 13:09 ` Simon Glass
  2025-03-04 13:09 ` [PATCH 2/7] binman: Drop GetRootSkipAtStart() Simon Glass
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Simon Glass @ 2025-03-04 13:09 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Simon Glass, Alper Nebi Yasak, Neha Malcom Francis, Peng Fan,
	Philippe Reynes, Stefan Herbrechtsmeier, Tom Rini

Newer versions of the python3-coverage tool require a directory
separator before and after the directory name. Add this so that system
package are not included in the coverage report.

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

 tools/u_boot_pylib/test_util.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/u_boot_pylib/test_util.py b/tools/u_boot_pylib/test_util.py
index dd671965263..ed216c4fc4e 100644
--- a/tools/u_boot_pylib/test_util.py
+++ b/tools/u_boot_pylib/test_util.py
@@ -56,7 +56,7 @@ def run_test_coverage(prog, filter_fname, exclude_list, build_dir,
     else:
         glob_list = []
     glob_list += exclude_list
-    glob_list += ['*libfdt.py', '*site-packages*', '*dist-packages*']
+    glob_list += ['*libfdt.py', '*/site-packages/*', '*/dist-packages/*']
     glob_list += ['*concurrencytest*']
     test_cmd = 'test' if 'binman' in prog or 'patman' in prog else '-t'
     prefix = ''
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/7] binman: Drop GetRootSkipAtStart()
  2025-03-04 13:09 [PATCH 0/7] binman: Check code-coverage requirements Simon Glass
  2025-03-04 13:09 ` [PATCH 1/7] binman: Exclude dist-packages and site-packages Simon Glass
@ 2025-03-04 13:09 ` Simon Glass
  2025-03-04 13:09 ` [PATCH 3/7] binman: fit: Drop unused code Simon Glass
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Simon Glass @ 2025-03-04 13:09 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Simon Glass, Alper Nebi Yasak, Neha Malcom Francis, Peng Fan,
	Philippe Reynes, Stefan Herbrechtsmeier, Tom Rini

This method is not called anymore, so drop it.

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

 tools/binman/etype/section.py | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index 5c371397ffb..1d50bb47753 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -666,23 +666,6 @@ class Entry_section(Entry):
         else:
             raise ValueError("%s: No such property '%s'" % (msg, prop_name))
 
-    def GetRootSkipAtStart(self):
-        """Get the skip-at-start value for the top-level section
-
-        This is used to find out the starting offset for root section that
-        contains this section. If this is a top-level section then it returns
-        the skip-at-start offset for this section.
-
-        This is used to get the absolute position of section within the image.
-
-        Returns:
-            Integer skip-at-start value for the root section containing this
-                section
-        """
-        if self.section:
-            return self.section.GetRootSkipAtStart()
-        return self._skip_at_start
-
     def GetStartOffset(self):
         """Get the start offset for this section
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/7] binman: fit: Drop unused code
  2025-03-04 13:09 [PATCH 0/7] binman: Check code-coverage requirements Simon Glass
  2025-03-04 13:09 ` [PATCH 1/7] binman: Exclude dist-packages and site-packages Simon Glass
  2025-03-04 13:09 ` [PATCH 2/7] binman: Drop GetRootSkipAtStart() Simon Glass
@ 2025-03-04 13:09 ` Simon Glass
  2025-03-04 13:09 ` [PATCH 4/7] binman: Drop algo check in CheckSetHashValue() Simon Glass
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Simon Glass @ 2025-03-04 13:09 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Simon Glass, Alexander Kochetkov, Alper Nebi Yasak,
	Neha Malcom Francis, Paul HENRYS, Peng Fan, Philippe Reynes,
	Stefan Herbrechtsmeier, Tom Rini

The key-name-hint case is not tested so is presumably not used. Drop it.

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

 tools/binman/etype/fit.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py
index 803fb66ea83..ed3cac4ee7e 100644
--- a/tools/binman/etype/fit.py
+++ b/tools/binman/etype/fit.py
@@ -562,8 +562,6 @@ class Entry_fit(Entry_section):
             for subnode in node.subnodes:
                 if (subnode.name.startswith('signature') or
                     subnode.name.startswith('cipher')):
-                    if subnode.props.get('key-name-hint') is None:
-                        continue
                     hint = subnode.props['key-name-hint'].value
                     name = tools.get_input_filename(
                         f"{hint}.key" if subnode.name.startswith('signature')
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/7] binman: Drop algo check in CheckSetHashValue()
  2025-03-04 13:09 [PATCH 0/7] binman: Check code-coverage requirements Simon Glass
                   ` (2 preceding siblings ...)
  2025-03-04 13:09 ` [PATCH 3/7] binman: fit: Drop unused code Simon Glass
@ 2025-03-04 13:09 ` Simon Glass
  2025-03-04 13:09 ` [PATCH 5/7] binman: Workaround lz4 cli padding in test cases Simon Glass
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Simon Glass @ 2025-03-04 13:09 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Simon Glass, Alper Nebi Yasak, Neha Malcom Francis, Peng Fan,
	Philippe Reynes, Stefan Herbrechtsmeier, Tom Rini

The CheckAddHashValue() function is always called before this one, so
the algorithm check is never used. Replace it with an assert to avoid a
coverage error.

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

 tools/binman/state.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/binman/state.py b/tools/binman/state.py
index 6772d3678fe..f4d885c772a 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -411,8 +411,7 @@ def CheckSetHashValue(node, get_data_func):
             m = hashlib.sha256()
             m.update(get_data_func())
             data = m.digest()
-        if data is None:
-            raise ValueError(f"Node '{node.path}': Unknown hash algorithm '{algo}'")
+        assert data
         for n in GetUpdateNodes(hash_node):
             n.SetData('value', data)
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/7] binman: Workaround lz4 cli padding in test cases
  2025-03-04 13:09 [PATCH 0/7] binman: Check code-coverage requirements Simon Glass
                   ` (3 preceding siblings ...)
  2025-03-04 13:09 ` [PATCH 4/7] binman: Drop algo check in CheckSetHashValue() Simon Glass
@ 2025-03-04 13:09 ` Simon Glass
  2025-04-10  9:27   ` Mattijs Korpershoek
  2025-03-04 13:09 ` [PATCH 6/7] binman: Work around missing test coverage Simon Glass
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Simon Glass @ 2025-03-04 13:09 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Jiaxun Yang, Simon Glass, Alexander Kochetkov, Alper Nebi Yasak,
	Brandon Maier, Neha Malcom Francis, Paul HENRYS, Peng Fan,
	Philippe Reynes, Stefan Herbrechtsmeier, Tom Rini

From: Jiaxun Yang <jiaxun.yang@flygoat.com>

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>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/binman/ftest.py                           | 7 +++++--
 tools/binman/test/184_compress_section_size.dts | 1 +
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 1a92a99b511..e46a1e84372 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -4613,6 +4613,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 = {
@@ -6218,8 +6220,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 95ed30add1a..1c1dbd5f580 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.43.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 6/7] binman: Work around missing test coverage
  2025-03-04 13:09 [PATCH 0/7] binman: Check code-coverage requirements Simon Glass
                   ` (4 preceding siblings ...)
  2025-03-04 13:09 ` [PATCH 5/7] binman: Workaround lz4 cli padding in test cases Simon Glass
@ 2025-03-04 13:09 ` Simon Glass
  2025-03-04 13:09 ` [PATCH 7/7] CI: Run code-coverage test for Binman Simon Glass
  2025-03-04 13:16 ` [PATCH 0/7] binman: Check code-coverage requirements Simon Glass
  7 siblings, 0 replies; 14+ messages in thread
From: Simon Glass @ 2025-03-04 13:09 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Simon Glass, Alper Nebi Yasak, Neha Malcom Francis, Peng Fan,
	Philippe Reynes, Stefan Herbrechtsmeier, Tom Rini

The iMX8 entry-types don't have proper test coverage. Add a work-around
to skip this for now.

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

 tools/binman/main.py            |  8 +++++++-
 tools/u_boot_pylib/test_util.py | 16 +++++++++++++++-
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/tools/binman/main.py b/tools/binman/main.py
index 619840e7d55..326f5c93155 100755
--- a/tools/binman/main.py
+++ b/tools/binman/main.py
@@ -94,10 +94,16 @@ def RunTestCoverage(toolpath, build_dir, args):
     if toolpath:
         for path in toolpath:
             extra_args += ' --toolpath %s' % path
+
+    # Some files unfortunately don't thave the required test coverage. This will
+    # eventually be fixed, but exclude them for now
     test_util.run_test_coverage('tools/binman/binman', None,
             ['*test*', '*main.py', 'tools/patman/*', 'tools/dtoc/*',
              'tools/u_boot_pylib/*'],
-            build_dir, all_set, extra_args or None, args=args)
+            build_dir, all_set, extra_args or None, args=args,
+            allow_failures=['tools/binman/btool/cst.py',
+                            'tools/binman/etype/nxp_imx8mcst.py',
+                            'tools/binman/etype/nxp_imx8mimage.py'])
 
 def RunBinman(args):
     """Main entry point to binman once arguments are parsed
diff --git a/tools/u_boot_pylib/test_util.py b/tools/u_boot_pylib/test_util.py
index ed216c4fc4e..4835847bfc6 100644
--- a/tools/u_boot_pylib/test_util.py
+++ b/tools/u_boot_pylib/test_util.py
@@ -8,6 +8,7 @@ import doctest
 import glob
 import multiprocessing
 import os
+import re
 import sys
 import unittest
 
@@ -25,7 +26,7 @@ except:
 
 def run_test_coverage(prog, filter_fname, exclude_list, build_dir,
                       required=None, extra_args=None, single_thread='-P1',
-                      args=None):
+                      args=None, allow_failures=None):
     """Run tests and check that we get 100% coverage
 
     Args:
@@ -96,6 +97,19 @@ def run_test_coverage(prog, filter_fname, exclude_list, build_dir,
         print('Coverage error: %s, but should be 100%%' % coverage)
         ok = False
     if not ok:
+        if allow_failures:
+            # for line in lines:
+                # print('.', line, re.match(r'^(tools/.*py) *\d+ *(\d+) *(\d+)%$', line))
+            lines = [re.match(r'^(tools/.*py) *\d+ *(\d+) *\d+%$', line)
+                     for line in stdout.splitlines()]
+            bad = []
+            for mat in lines:
+                if mat and mat.group(2) != '0':
+                    fname = mat.group(1)
+                    if fname not in allow_failures:
+                        bad.append(fname)
+            if not bad:
+                return
         raise ValueError('Test coverage failure')
 
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 7/7] CI: Run code-coverage test for Binman
  2025-03-04 13:09 [PATCH 0/7] binman: Check code-coverage requirements Simon Glass
                   ` (5 preceding siblings ...)
  2025-03-04 13:09 ` [PATCH 6/7] binman: Work around missing test coverage Simon Glass
@ 2025-03-04 13:09 ` Simon Glass
  2025-03-04 14:26   ` Tom Rini
  2025-03-04 13:16 ` [PATCH 0/7] binman: Check code-coverage requirements Simon Glass
  7 siblings, 1 reply; 14+ messages in thread
From: Simon Glass @ 2025-03-04 13:09 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Simon Glass, Tom Rini, Jerome Forissier, Jiaxun Yang,
	Patrick Rudolph

Binman includes a good set of tests covering all of its functionality.
This includes a code-coverage test.

However to date the code-coverage test has not been checked
automatically by CI, relying on people to run 'binman test -T'
themselves.

Plug the gap to avoid bugs creeping in future.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
---

 .azure-pipelines.yml | 5 ++++-
 .gitlab-ci.yml       | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 2bc2ca55b9a..712c823e145 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -140,7 +140,10 @@ stages:
           export PATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}
           ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w --board tools-only
           set -ex
-          ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test
+          export TOOLPATH="--toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools --toolpath /opt/coreboot"
+          ./tools/binman/binman ${TOOLPATH} test
+          # Avoid "Permission denied: 'cov'" error by using a temporary file
+          COVERAGE_FILE=/tmp/.coverage ./tools/binman/binman ${TOOLPATH} test -T
           ./tools/buildman/buildman -t
           ./tools/dtoc/dtoc -t
           ./tools/patman/patman test
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8c49d5b0a79..c6461f33982 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -229,7 +229,9 @@ Run binman, buildman, dtoc, Kconfig and patman testsuites:
       ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w
         --board tools-only;
       set -e;
-      ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test;
+      export TOOLPATH="--toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools --toolpath /opt/coreboot";
+      ./tools/binman/binman ${TOOLPATH} test;
+      ./tools/binman/binman ${TOOLPATH} test -T;
       ./tools/buildman/buildman -t;
       ./tools/dtoc/dtoc -t;
       ./tools/patman/patman test;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/7] binman: Check code-coverage requirements
  2025-03-04 13:09 [PATCH 0/7] binman: Check code-coverage requirements Simon Glass
                   ` (6 preceding siblings ...)
  2025-03-04 13:09 ` [PATCH 7/7] CI: Run code-coverage test for Binman Simon Glass
@ 2025-03-04 13:16 ` Simon Glass
  7 siblings, 0 replies; 14+ messages in thread
From: Simon Glass @ 2025-03-04 13:16 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Alexander Kochetkov, Alper Nebi Yasak, Brandon Maier,
	Jerome Forissier, Jiaxun Yang, Neha Malcom Francis,
	Patrick Rudolph, Paul HENRYS, Peng Fan, Philippe Reynes,
	Stefan Herbrechtsmeier, Tom Rini

Hi,

On Tue, 4 Mar 2025 at 06:09, Simon Glass <sjg@chromium.org> wrote:
>
> This series adds a cover-coverage check to CI for Binman. The iMX8 tests
> are still not completed, so a work-around is included for those.
>
> A few fixes are included for some other problems.
>
>
> Jiaxun Yang (1):
>   binman: Workaround lz4 cli padding in test cases
>
> Simon Glass (6):
>   binman: Exclude dist-packages and site-packages
>   binman: Drop GetRootSkipAtStart()
>   binman: fit: Drop unused code
>   binman: Drop algo check in CheckSetHashValue()
>   binman: Work around missing test coverage
>   CI: Run code-coverage test for Binman
>
>  .azure-pipelines.yml                           |  5 ++++-
>  .gitlab-ci.yml                                 |  4 +++-
>  tools/binman/etype/fit.py                      |  2 --
>  tools/binman/etype/section.py                  | 17 -----------------
>  tools/binman/ftest.py                          |  7 +++++--
>  tools/binman/main.py                           |  8 +++++++-
>  tools/binman/state.py                          |  3 +--
>  .../binman/test/184_compress_section_size.dts  |  1 +
>  tools/u_boot_pylib/test_util.py                | 18 ++++++++++++++++--
>  9 files changed, 37 insertions(+), 28 deletions(-)
>
> --
> 2.43.0
>

Sorry, please ignore this series, it is not marked as v2.

Regards,
Simon

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 7/7] CI: Run code-coverage test for Binman
  2025-03-04 13:09 ` [PATCH 7/7] CI: Run code-coverage test for Binman Simon Glass
@ 2025-03-04 14:26   ` Tom Rini
  0 siblings, 0 replies; 14+ messages in thread
From: Tom Rini @ 2025-03-04 14:26 UTC (permalink / raw)
  To: Simon Glass
  Cc: U-Boot Mailing List, Jerome Forissier, Jiaxun Yang,
	Patrick Rudolph

[-- Attachment #1: Type: text/plain, Size: 536 bytes --]

On Tue, Mar 04, 2025 at 06:09:44AM -0700, Simon Glass wrote:

> Binman includes a good set of tests covering all of its functionality.
> This includes a code-coverage test.
> 
> However to date the code-coverage test has not been checked
> automatically by CI, relying on people to run 'binman test -T'
> themselves.
> 
> Plug the gap to avoid bugs creeping in future.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 5/7] binman: Workaround lz4 cli padding in test cases
  2025-03-04 13:09 ` [PATCH 5/7] binman: Workaround lz4 cli padding in test cases Simon Glass
@ 2025-04-10  9:27   ` Mattijs Korpershoek
  2025-04-10 14:53     ` Simon Glass
  0 siblings, 1 reply; 14+ messages in thread
From: Mattijs Korpershoek @ 2025-04-10  9:27 UTC (permalink / raw)
  To: Simon Glass, U-Boot Mailing List
  Cc: Jiaxun Yang, Simon Glass, Alexander Kochetkov, Alper Nebi Yasak,
	Brandon Maier, Neha Malcom Francis, Paul HENRYS, Peng Fan,
	Philippe Reynes, Stefan Herbrechtsmeier, Tom Rini

Hi Simon,

Thank you for the patch.

On mar., mars 04, 2025 at 06:09, Simon Glass <sjg@chromium.org> wrote:

> From: Jiaxun Yang <jiaxun.yang@flygoat.com>
>
> 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>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Tested that this solves issues when using lz4 1.9.4.

This patch solves:
https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/38

Tested-by: Mattijs Korpershoek <mkorpershoek@kernel.org>

> ---
>
>  tools/binman/ftest.py                           | 7 +++++--
>  tools/binman/test/184_compress_section_size.dts | 1 +
>  2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
> index 1a92a99b511..e46a1e84372 100644
> --- a/tools/binman/ftest.py
> +++ b/tools/binman/ftest.py
> @@ -4613,6 +4613,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 = {
> @@ -6218,8 +6220,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 95ed30add1a..1c1dbd5f580 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.43.0

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 5/7] binman: Workaround lz4 cli padding in test cases
  2025-04-10  9:27   ` Mattijs Korpershoek
@ 2025-04-10 14:53     ` Simon Glass
  2025-04-10 15:07       ` Tom Rini
  0 siblings, 1 reply; 14+ messages in thread
From: Simon Glass @ 2025-04-10 14:53 UTC (permalink / raw)
  To: Mattijs Korpershoek
  Cc: U-Boot Mailing List, Jiaxun Yang, Alexander Kochetkov,
	Alper Nebi Yasak, Brandon Maier, Neha Malcom Francis, Paul HENRYS,
	Peng Fan, Philippe Reynes, Stefan Herbrechtsmeier, Tom Rini

Hi Mattijs,

On Thu, 10 Apr 2025 at 03:27, Mattijs Korpershoek
<mkorpershoek@kernel.org> wrote:
>
> Hi Simon,
>
> Thank you for the patch.
>
> On mar., mars 04, 2025 at 06:09, Simon Glass <sjg@chromium.org> wrote:
>
> > From: Jiaxun Yang <jiaxun.yang@flygoat.com>
> >
> > 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>
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> > Signed-off-by: Simon Glass <sjg@chromium.org>
>
> Tested that this solves issues when using lz4 1.9.4.
>
> This patch solves:
> https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/38
>
> Tested-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
>

Ah, I'd forgotten about this series, as I applied it to my tree a
while back. I sent a v2 for Tom[1].

Regards,
SImon

[1] https://patchwork.ozlabs.org/project/uboot/list/?series=452114

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 5/7] binman: Workaround lz4 cli padding in test cases
  2025-04-10 14:53     ` Simon Glass
@ 2025-04-10 15:07       ` Tom Rini
  0 siblings, 0 replies; 14+ messages in thread
From: Tom Rini @ 2025-04-10 15:07 UTC (permalink / raw)
  To: Simon Glass
  Cc: Mattijs Korpershoek, U-Boot Mailing List, Jiaxun Yang,
	Alexander Kochetkov, Alper Nebi Yasak, Brandon Maier,
	Neha Malcom Francis, Paul HENRYS, Peng Fan, Philippe Reynes,
	Stefan Herbrechtsmeier

[-- Attachment #1: Type: text/plain, Size: 1238 bytes --]

On Thu, Apr 10, 2025 at 08:53:14AM -0600, Simon Glass wrote:
> Hi Mattijs,
> 
> On Thu, 10 Apr 2025 at 03:27, Mattijs Korpershoek
> <mkorpershoek@kernel.org> wrote:
> >
> > Hi Simon,
> >
> > Thank you for the patch.
> >
> > On mar., mars 04, 2025 at 06:09, Simon Glass <sjg@chromium.org> wrote:
> >
> > > From: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > >
> > > 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>
> > > Reviewed-by: Simon Glass <sjg@chromium.org>
> > > Signed-off-by: Simon Glass <sjg@chromium.org>
> >
> > Tested that this solves issues when using lz4 1.9.4.
> >
> > This patch solves:
> > https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/38
> >
> > Tested-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
> >
> 
> Ah, I'd forgotten about this series, as I applied it to my tree a
> while back. I sent a v2 for Tom[1].

For mainline, yes.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2025-04-10 15:07 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-04 13:09 [PATCH 0/7] binman: Check code-coverage requirements Simon Glass
2025-03-04 13:09 ` [PATCH 1/7] binman: Exclude dist-packages and site-packages Simon Glass
2025-03-04 13:09 ` [PATCH 2/7] binman: Drop GetRootSkipAtStart() Simon Glass
2025-03-04 13:09 ` [PATCH 3/7] binman: fit: Drop unused code Simon Glass
2025-03-04 13:09 ` [PATCH 4/7] binman: Drop algo check in CheckSetHashValue() Simon Glass
2025-03-04 13:09 ` [PATCH 5/7] binman: Workaround lz4 cli padding in test cases Simon Glass
2025-04-10  9:27   ` Mattijs Korpershoek
2025-04-10 14:53     ` Simon Glass
2025-04-10 15:07       ` Tom Rini
2025-03-04 13:09 ` [PATCH 6/7] binman: Work around missing test coverage Simon Glass
2025-03-04 13:09 ` [PATCH 7/7] CI: Run code-coverage test for Binman Simon Glass
2025-03-04 14:26   ` Tom Rini
2025-03-04 13:16 ` [PATCH 0/7] binman: Check code-coverage requirements Simon Glass
  -- strict thread matches above, loose matches on Subject: below --
2025-02-25 20:06 Simon Glass
2025-02-25 20:06 ` [PATCH 5/7] binman: Workaround lz4 cli padding in test cases Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox