Skip the RAM and Flash summary lines together when the flash budget is unknown

This commit is contained in:
J. Nick Koston
2026-08-20 10:09:57 -05:00
parent 069ae156f9
commit 1477de24d3
2 changed files with 10 additions and 4 deletions
+7 -2
View File
@@ -195,11 +195,16 @@ def _print_size_summary(build_dir: Path) -> None:
", ".join(sorted(missing)),
)
return
# Resolve the flash budget before printing anything: a RAM line without
# its Flash line would let CI's memory-impact extraction sum the two
# metrics over different build counts (_parse_app_size already warned).
app_size = _parse_app_size(build_dir)
if not app_size:
return
ram = sum(sections[s] for s in _RAM_SECTIONS)
flash = sum(sections[s] for s in _FLASH_SECTIONS)
print(f"RAM: {format_bar(ram, _MAX_RAM_SIZE)}")
if app_size := _parse_app_size(build_dir):
print(f"Flash: {format_bar(flash, app_size)}")
print(f"Flash: {format_bar(flash, app_size)}")
def get_idedata() -> dict | None:
@@ -180,8 +180,9 @@ def test_print_size_summary_no_app_size(
):
toolchain._print_size_summary(tmp_path)
out = capsys.readouterr().out
assert "RAM:" in out
assert "Flash:" not in out
# Both lines are skipped together: a RAM line without Flash would skew
# CI's memory-impact sums across builds
assert out == ""
def test_print_size_summary_size_tool_failure(