Skip to content

Add leak checking, test improvements, and build fixes#3

Merged
sjg20 merged 12 commits into
masterfrom
emo
Mar 16, 2026
Merged

Add leak checking, test improvements, and build fixes#3
sjg20 merged 12 commits into
masterfrom
emo

Conversation

@sjg20
Copy link
Copy Markdown
Owner

@sjg20 sjg20 commented Mar 16, 2026

Summary

  • Split run_tests() and do_test() into smaller functions
  • Ignore compiler warnings in buildman builds (-W flag)
  • Add --leak-check / -M flag for memory-leak detection in tests
  • Search all suites when test spec is not a known suite name
  • Show leak count, leaked bytes, and top leaking tests in progress
    and summary output
  • Parse test-log.html to show leak summary for pytest runs too
  • Reset terminal on crash even when test results were parsed
  • Install gdb-multiarch in containers

sjg20 added 4 commits March 15, 2026 19:30
The run_tests() function handles command execution, progress tracking,
result parsing, and output display all in one place.

Extract run_ut() for running the command with progress tracking, and
show_test_output() for parsing and displaying results. This makes
run_tests() a short orchestrator and allows the pieces to be reused.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
The do_test() function has many early returns and inline blocks for
listing suites, listing tests, and reporting unmatched specs.

Extract list_suites(), list_tests(), and report_unmatched() as
separate functions, and consolidate the two validation checks into
one error path.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
The run_tests() function has many early returns for different error
paths, making the flow hard to follow.

Extract check_signal() for signal detection and restructure the
result handling to use a single return at the end.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
Add gdb-multiarch to the default packages so that debugging with -G
works inside containers without manual installation.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
@sjg20 sjg20 changed the title Emo Add leak checking, test improvements, and build fixes Mar 16, 2026
sjg20 added 8 commits March 15, 2026 20:04
Buildman treats warnings as build failures by default, which causes
builds to fail on harmless warnings in U-Boot source files.

Add the -W flag to all buildman invocations so that warnings are
still shown but do not cause a non-zero exit code.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
Pass -L to the ut command so that each test checks for memory leaks
using mallinfo() before and after the test.

Co-developed-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When 'um t acpi' is used and 'acpi' is not a recognised suite name,
there is no fallback to search for tests matching that name across
all suites.

Try the spec as a pattern across all suites, so that 'um t acpi'
finds and runs all tests with 'acpi' in their name regardless of
which suite they belong to. The pattern uses the full U-Boot test
function name format ({suite}_test_{name}*) since the ut command
does not support leading wildcards.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
When --leak-check is enabled, U-Boot outputs 'Leak: N allocs' lines
for tests that leak memory. These are not currently tracked.

Parse leak lines in both the live progress display and the result
summary, showing the count alongside passed/failed/skipped when any
leaks are detected.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
The leak detail lines from U-Boot contain allocation sizes in hex.

Parse these to show the total leaked bytes alongside the leak count,
e.g. '12 leaked (0x3130 bytes)' in both the live progress display
and the final summary.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
When leak checking is enabled, it is useful to see which tests leak
the most memory.

Track per-test leak bytes during result parsing and add --show-leaks
N to display the top N leaking tests after the summary.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
The py subcommand passes --leak-check to test.py but does not show
the leak summary afterwards.

Parse test-log.html after pytest finishes to extract leak data and
show the same summary and top-leaks display as the t subcommand.
Extract add_leak_opts() and show_leak_top() as shared helpers to
avoid duplication between the two subcommands.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
When a test crashes (e.g. SIGSEGV), the sandbox process may leave
the terminal in a bad state. The tset call to fix this only runs
when no test results are parsed, but a crash can happen after some
tests have already produced results.

Move the signal check and terminal reset before the result display
so it always runs when a signal is detected.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
@sjg20 sjg20 merged commit a03bdbf into master Mar 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant