Find the test executable / DLL and return (cmd, artifact_path). Returns ([], None) if no executable could be located.
(
build_dir: Path, meson_test_name: str, verbose: bool
)
| 292 | |
| 293 | |
| 294 | def _resolve_test_command( |
| 295 | build_dir: Path, meson_test_name: str, verbose: bool |
| 296 | ) -> tuple[list[str], Optional[Path]]: |
| 297 | """Find the test executable / DLL and return (cmd, artifact_path). |
| 298 | |
| 299 | Returns ([], None) if no executable could be located. |
| 300 | """ |
| 301 | # Profile tests (tests/profile/) — any name (not just profile_* prefix) |
| 302 | profile_exe_path = build_dir / "tests" / "profile" / f"{meson_test_name}.exe" |
| 303 | if profile_exe_path.exists(): |
| 304 | return [str(profile_exe_path)], profile_exe_path |
| 305 | profile_exe_unix = build_dir / "tests" / "profile" / meson_test_name |
| 306 | if profile_exe_unix.exists(): |
| 307 | return [str(profile_exe_unix)], profile_exe_unix |
| 308 | |
| 309 | # Copied runner .exe (e.g. fl_async.exe) — DLL preferred as artifact |
| 310 | test_exe_path = build_dir / "tests" / f"{meson_test_name}.exe" |
| 311 | if test_exe_path.exists(): |
| 312 | dll_candidate = build_dir / "tests" / f"{meson_test_name}.dll" |
| 313 | artifact = dll_candidate if dll_candidate.exists() else test_exe_path |
| 314 | return [str(test_exe_path)], artifact |
| 315 | |
| 316 | # Unix bare-name variant |
| 317 | test_exe_unix = build_dir / "tests" / meson_test_name |
| 318 | if test_exe_unix.exists(): |
| 319 | return [str(test_exe_unix)], test_exe_unix |
| 320 | |
| 321 | # DLL-based architecture: shared runner + test.{dll,so,dylib} |
| 322 | runner_name = "runner.exe" if os.name == "nt" else "runner" |
| 323 | runner_exe = build_dir / "tests" / runner_name |
| 324 | if not runner_exe.exists(): |
| 325 | compile_meson(build_dir, target="runner", quiet=True, verbose=verbose) |
| 326 | if runner_exe.exists(): |
| 327 | for ext in (".dll", ".so", ".dylib"): |
| 328 | candidate = build_dir / "tests" / f"{meson_test_name}{ext}" |
| 329 | if candidate.exists(): |
| 330 | return [str(runner_exe), str(candidate)], candidate |
| 331 | |
| 332 | return [], None |
| 333 | |
| 334 | |
| 335 | def _make_direct_test_env( |
no test coverage detected