()
| 291 | |
| 292 | |
| 293 | def main() -> None: |
| 294 | try: |
| 295 | # Use module-level start time (recorded before heavy imports for accuracy). |
| 296 | # _argv_ultra_early_exit() already fired at module level; if we reached main(), |
| 297 | # the early exit did not apply and we proceed normally. |
| 298 | start_time = _START_TIME |
| 299 | |
| 300 | # Parse and process arguments |
| 301 | args = parse_args() |
| 302 | |
| 303 | # Warn about any leftover crash dumps from previous runs |
| 304 | _check_crash_dumps() |
| 305 | |
| 306 | if args.debug_test: |
| 307 | from ci.util.global_interrupt_handler import set_debug_test |
| 308 | |
| 309 | set_debug_test(True) |
| 310 | |
| 311 | # Handle --list-tests flag: list available tests and exit |
| 312 | if args.list_tests: |
| 313 | from ci.meson.test_discovery import list_all_tests |
| 314 | |
| 315 | list_all_tests(filter_pattern=args.test, filter_type=None) |
| 316 | sys.exit(0) |
| 317 | |
| 318 | # Handle --setup-only flag: run Meson setup to generate compile_commands.json, then exit. |
| 319 | # This is used by the install script to avoid a full build when only IntelliSense |
| 320 | # configuration is needed. |
| 321 | if args.setup_only: |
| 322 | from ci.meson.build_config import setup_meson_build |
| 323 | |
| 324 | build_mode = ( |
| 325 | args.build_mode |
| 326 | if args.build_mode |
| 327 | else ("debug" if args.debug else "quick") |
| 328 | ) |
| 329 | source_dir = Path(".") |
| 330 | build_dir = Path(".build") / f"meson-{build_mode}" |
| 331 | ts_print(f"Running Meson setup only ({build_mode} mode)...") |
| 332 | ok = setup_meson_build( |
| 333 | source_dir, |
| 334 | build_dir, |
| 335 | reconfigure=False, |
| 336 | debug=(build_mode == "debug"), |
| 337 | build_mode=build_mode, |
| 338 | verbose=args.verbose, |
| 339 | enable_examples=True, |
| 340 | enable_unit_tests=True, |
| 341 | ) |
| 342 | if ok: |
| 343 | ts_print("Meson setup complete.") |
| 344 | else: |
| 345 | ts_print("Meson setup failed.", file=sys.stderr) |
| 346 | sys.exit(1) |
| 347 | sys.exit(0) |
| 348 | |
| 349 | # ULTRA-EARLY EXIT: Check if the requested test result is already cached. |
| 350 | # Uses check_single_test_cached() from ci.early_exit_cache for the full |
no test coverage detected