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

Function main

tests/measure_esp32s3_opt_ins.py:396–475  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

394
395
396def main() -> int:
397 parser = argparse.ArgumentParser(description=__doc__)
398 parser.add_argument(
399 "--config",
400 default="all",
401 help=(
402 "Comma-separated list of configs to run, or `all`. Available: "
403 + ", ".join(CONFIGS.keys())
404 ),
405 )
406 parser.add_argument(
407 "--example",
408 default="Blink",
409 help="Example sketch to build (default: Blink).",
410 )
411 parser.add_argument(
412 "--out",
413 type=Path,
414 default=None,
415 help="If set, write the Markdown comparison table to this path.",
416 )
417 parser.add_argument(
418 "--keep-platformio-ini-backup",
419 action="store_true",
420 help="Keep platformio.ini.bak around after the run (default: delete on success).",
421 )
422 args = parser.parse_args()
423
424 if args.config == "all":
425 requested = list(CONFIGS.keys())
426 else:
427 requested = [c.strip() for c in args.config.split(",") if c.strip()]
428 for name in requested:
429 if name not in CONFIGS:
430 print(
431 f"measure-opt-ins: unknown config '{name}'. Available: "
432 + ", ".join(CONFIGS.keys()),
433 file=sys.stderr,
434 )
435 return 2
436
437 backup_platformio_ini()
438
439 def _restore_and_exit(*_: object) -> None:
440 restore_platformio_ini(keep_backup=args.keep_platformio_ini_backup)
441 sys.exit(130)
442
443 signal.signal(signal.SIGINT, _restore_and_exit)
444 if hasattr(signal, "SIGTERM"):
445 signal.signal(signal.SIGTERM, _restore_and_exit)
446
447 results: dict[str, int] = {}
448 failed: list[str] = []
449 try:
450 for name in requested:
451 total = measure_one(CONFIGS[name], args.example)
452 if total is None:
453 failed.append(name)

Callers 1

Calls 9

listClass · 0.85
backup_platformio_iniFunction · 0.85
measure_oneFunction · 0.85
restore_platformio_iniFunction · 0.85
format_tableFunction · 0.85
parse_argsMethod · 0.80
printFunction · 0.50
keysMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected