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

Function run_direct_test

ci/meson/sequential_runner.py:449–546  ·  view source on GitHub ↗

Locate and execute a single test executable; return its MesonTestResult.

(ctx: DirectTestContext)

Source from the content-addressed store, hash-verified

447
448
449def run_direct_test(ctx: DirectTestContext) -> MesonTestResult:
450 """Locate and execute a single test executable; return its MesonTestResult."""
451 test_cmd, artifact_path = _resolve_test_command(
452 ctx.build_dir, ctx.meson_test_name, ctx.verbose
453 )
454
455 if not test_cmd:
456 _ts_print(
457 f"[MESON] Error: test executable not found for: {ctx.meson_test_name}",
458 file=sys.stderr,
459 )
460 return MesonTestResult(
461 success=False,
462 duration=time.time() - ctx.start_time,
463 num_tests_run=0,
464 num_tests_passed=0,
465 num_tests_failed=0,
466 )
467
468 print_banner("Test", "▶️", verbose=ctx.verbose)
469 print(f"Running: {ctx.meson_test_name}")
470 ctx.phase_tracker.set_phase(
471 "EXECUTE", test_name=ctx.meson_test_name, path="sequential"
472 )
473
474 try:
475 test_env = _make_direct_test_env(ctx.source_dir, ctx.build_dir, ctx.build_mode)
476 proc = RunningProcess(
477 test_cmd,
478 cwd=ctx.source_dir,
479 timeout=600,
480 auto_run=True,
481 check=False,
482 env=test_env,
483 output_formatter=TimestampFormatter(),
484 )
485 is_profile_test = artifact_path and "profile" in str(artifact_path)
486 echo_callback = ctx.verbose or is_profile_test
487 test_start = time.time()
488 returncode = cast(int, proc.wait(echo=bool(echo_callback)))
489 test_duration = time.time() - test_start
490 duration = time.time() - ctx.start_time
491 ctx.build_timer.checkpoint("test_execution_done")
492
493 if returncode != 0:
494 _print_direct_test_failure(ctx, proc, returncode)
495 if artifact_path is not None:
496 save_test_result_state(
497 ctx.build_dir, ctx.meson_test_name, artifact_path, passed=False
498 )
499 if ctx.log_failures is not None and ctx.meson_test_name:
500 _write_failure_log(
501 ctx.log_failures, ctx.meson_test_name, "run", str(proc.stdout)
502 )
503 return MesonTestResult(
504 success=False,
505 duration=duration,
506 num_tests_run=1,

Callers 1

run_meson_build_and_testFunction · 0.90

Calls 15

MesonTestResultClass · 0.90
print_bannerFunction · 0.90
TimestampFormatterClass · 0.90
save_test_result_stateFunction · 0.90
_write_failure_logFunction · 0.90
print_successFunction · 0.90
_apply_phase_timingFunction · 0.90
_resolve_test_commandFunction · 0.85
_make_direct_test_envFunction · 0.85
timeMethod · 0.80

Tested by

no test coverage detected