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

Function check_full_run_cache

ci/meson/cache_utils.py:419–508  ·  view source on GitHub ↗

Check if full test suite passed with current build state. Returns (num_passed, num_tests, duration_seconds) if conditions match, else None. Uses same gate conditions as check_ninja_skip: 1. build.ninja mtime unchanged (no meson reconfiguration) 2. libfastled.a mtime unchanged (no s

(
    build_dir: Path,
    include_examples: bool = False,
)

Source from the content-addressed store, hash-verified

417
418
419def check_full_run_cache(
420 build_dir: Path,
421 include_examples: bool = False,
422) -> Optional[tuple[int, int, float]]:
423 """Check if full test suite passed with current build state.
424
425 Returns (num_passed, num_tests, duration_seconds) if conditions match, else None.
426
427 Uses same gate conditions as check_ninja_skip:
428 1. build.ninja mtime unchanged (no meson reconfiguration)
429 2. libfastled.a mtime unchanged (no src/ code changes)
430 3. tests/ max source file mtime unchanged (no test source modifications)
431 4. Last result was "pass"
432 5. [Optional] examples/ max source file mtime unchanged (when include_examples=True)
433
434 Args:
435 build_dir: Meson build directory
436 include_examples: If True, also verify examples/ haven't changed.
437 Use this for 'bash test --cpp' (includes examples).
438
439 Overhead: ~30-60ms (scandir over tests/ [+ examples/] + 2 stat calls + JSON read).
440 Savings: ~3s per cached 'bash test --cpp' run (skips fingerprint + imports).
441 """
442 cache_file = get_full_run_cache_file(build_dir)
443 if not cache_file.exists():
444 return None
445
446 try:
447 with open(cache_file, "r", encoding="utf-8") as f:
448 saved = json.load(f)
449
450 if saved.get("result") != "pass":
451 return None
452
453 # 1. Check build.ninja mtime (detects meson reconfiguration)
454 build_ninja = build_dir / "build.ninja"
455 if not build_ninja.exists():
456 return None
457 if (
458 abs(build_ninja.stat().st_mtime - saved.get("build_ninja_mtime", -1.0))
459 > 0.001
460 ):
461 return None
462
463 # 2a. Check meson.build files (detects build config changes)
464 cwd = Path.cwd()
465 _meson_files = [
466 cwd / "meson.build",
467 cwd / "tests" / "meson.build",
468 cwd / "ci" / "meson" / "native" / "meson.build",
469 cwd / "ci" / "meson" / "wasm" / "meson.build",
470 cwd / "examples" / "meson.build",
471 ]
472 _meson_max = 0.0
473 for mf in _meson_files:
474 try:
475 _meson_max = max(_meson_max, mf.stat().st_mtime)
476 except OSError:

Callers

nothing calls this directly

Calls 6

get_full_run_cache_fileFunction · 0.85
maxFunction · 0.85
absFunction · 0.50
loadMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected