diff options
author | Tom Rini <trini@konsulko.com> | 2025-04-11 14:32:02 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2025-04-11 16:47:29 -0600 |
commit | a40fc5afaec079ee4e621965fed18dcc94240d8c (patch) | |
tree | a6d644d2f13d543f7da3f6de1ef1a8d6c9eec68b /tools/u_boot_pylib/test_util.py | |
parent | 407d68638fe32418d61681407effba2a303bb9ee (diff) | |
parent | 6f875290eb107106059f4edfcf8afe31bed9a378 (diff) |
Merge patch series "binman: Check code-coverage requirements"
Simon Glass <sjg@chromium.org> says:
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.
Link: https://lore.kernel.org/r/20250410124333.843527-1-sjg@chromium.org
Diffstat (limited to 'tools/u_boot_pylib/test_util.py')
-rw-r--r-- | tools/u_boot_pylib/test_util.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/tools/u_boot_pylib/test_util.py b/tools/u_boot_pylib/test_util.py index dd671965263..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: @@ -56,7 +57,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 = '' @@ -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') |