[Concept,00/18] buildman: Improve test coverage for builder.py

Message ID 20260109183116.3262115-1-sjg@u-boot.org
Headers
Series buildman: Improve test coverage for builder.py |

Message

Simon Glass Jan. 9, 2026, 6:30 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

This series improves the test coverage for builder.py from 11% to 97%
by adding unit tests for various functions.

It extracts several functions to make them more testable:
- _print_build_summary() from build_boards()
- _check_output_for_loop() from make()

It also fixes a bug in _calc_config_changes() where value changes in
existing config options are not detected.

New unit tests cover:
- Function size detail output (bloat-o-meter style)
- Thread preparation and working space setup
- Output space management and cleanup
- Build loop detection in make output
- The make() method execution flow
- Build summary message formatting
- Detection of boards not built due to missing toolchains

Functional tests are added for -K, -E, -U flags, IDE mode output,
branch summary display, and toolchain error reporting.


Simon Glass (18):
  buildman: Add missing return documentation in builder.py
  buildman: Add tests for builder helper functions
  buildman: Add test for branch summary display
  buildman: Add unit tests for print_func_size_detail()
  buildman: Add test for -K flag (show config changes)
  buildman: Fix config value change detection
  buildman: Add a test for -E flag (warnings as errors)
  buildman: Add test for -U flag (show environment changes)
  buildman: Add test for IDE mode output
  buildman: Add unit tests for _prepare_thread()
  buildman: Add unit tests for _prepare_working_space()
  buildman: Add unit tests for _prepare_output_space()
  buildman: Test _show_not_built() and toolchain errors
  buildman: Detect toolchain errors in _show_not_built()
  buildman: Add unit tests for _check_output_for_loop()
  buildman: Add unit tests for make()
  buildman: Extract _print_build_summary() from build_boards()
  buildman: Add unit tests for _print_build_summary()

 tools/buildman/builder.py      | 158 ++++--
 tools/buildman/func_test.py    | 257 +++++++++-
 tools/buildman/main.py         |  12 +-
 tools/buildman/test.py         | 185 +++++++
 tools/buildman/test_builder.py | 854 +++++++++++++++++++++++++++++++++
 5 files changed, 1411 insertions(+), 55 deletions(-)
 create mode 100644 tools/buildman/test_builder.py