Load cached test names from disk (stdlib only, no ci.* imports). Mirrors ci/meson/test_discovery._load_introspect_tests_cache() without importing that module (which pulls hashlib, subprocess, global_interrupt_handler). Args: build_dir: Meson build directory (e.g., .build/meson-
(build_dir: Path)
| 119 | |
| 120 | |
| 121 | def load_test_names(build_dir: Path) -> list: |
| 122 | """Load cached test names from disk (stdlib only, no ci.* imports). |
| 123 | |
| 124 | Mirrors ci/meson/test_discovery._load_introspect_tests_cache() without |
| 125 | importing that module (which pulls hashlib, subprocess, global_interrupt_handler). |
| 126 | |
| 127 | Args: |
| 128 | build_dir: Meson build directory (e.g., .build/meson-quick/). |
| 129 | |
| 130 | Returns: |
| 131 | List of cached test names, or empty list if cache is invalid. |
| 132 | """ |
| 133 | cache_path = build_dir / ".meson_introspect_tests_cache.json" |
| 134 | build_ninja = build_dir / "build.ninja" |
| 135 | if not cache_path.exists() or not build_ninja.exists(): |
| 136 | return [] |
| 137 | try: |
| 138 | if cache_path.stat().st_mtime < build_ninja.stat().st_mtime: |
| 139 | return [] |
| 140 | data = json.loads(cache_path.read_text(encoding="utf-8")) |
| 141 | if isinstance(data, list) and (not data or isinstance(data[0], str)): |
| 142 | return data |
| 143 | return [] |
| 144 | except (OSError, json.JSONDecodeError): |
| 145 | return [] |
| 146 | |
| 147 | |
| 148 | def ninja_skip( |
no outgoing calls
no test coverage detected