MCPcopy Create free account
hub / github.com/FastLED/FastLED / main

Function main

tests/test_esp32s3_bloat_regression.py:67–129  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65
66
67def main() -> int:
68 parser = argparse.ArgumentParser(description=__doc__)
69 parser.add_argument(
70 "--no-build",
71 action="store_true",
72 help="Skip `--build`; assume the ELF + report.json already exist.",
73 )
74 parser.add_argument(
75 "--baseline",
76 type=int,
77 default=None,
78 help=(
79 "Override the pinned baseline (bytes). Default: read from "
80 "tests/data/esp32s3_bloat_baseline.txt."
81 ),
82 )
83 args = parser.parse_args()
84
85 baseline = args.baseline if args.baseline is not None else read_baseline()
86
87 run_bloat(skip_build=args.no_build)
88
89 if not REPORT_JSON.exists():
90 print(
91 f"esp32s3-bloat-regression: report.json missing after bloat run: "
92 f"{REPORT_JSON}",
93 file=sys.stderr,
94 )
95 return 2
96
97 data = json.loads(REPORT_JSON.read_text(encoding="utf-8"))
98 total_flash = int(data["total_flash"])
99
100 delta = total_flash - baseline
101 if delta <= 0:
102 print(
103 f"esp32s3-bloat-regression: PASS — total_flash={total_flash:,} B "
104 f"<= baseline={baseline:,} B (headroom={-delta:,} B).",
105 flush=True,
106 )
107 return 0
108
109 print(
110 f"esp32s3-bloat-regression: FAIL — total_flash={total_flash:,} B "
111 f"exceeds baseline={baseline:,} B by {delta:,} B.",
112 file=sys.stderr,
113 )
114 print(
115 "esp32s3-bloat-regression: if the regression is intentional, update "
116 f"{BASELINE_FILE.relative_to(PROJECT_ROOT).as_posix()} in the same PR. "
117 "Otherwise inspect the top-N table:",
118 file=sys.stderr,
119 )
120 print(
121 " bash bloat esp32s3 --top 25",
122 file=sys.stderr,
123 )
124 print(

Calls 4

read_baselineFunction · 0.85
parse_argsMethod · 0.80
run_bloatFunction · 0.70
printFunction · 0.50

Tested by

no test coverage detected