| from __future__ import annotations | |
| import sys | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parents[1] | |
| sys.path.insert(0, str(ROOT / "scripts")) | |
| import run_mlir_batch # noqa: E402 | |
| from validate_config_layout import EXPECTED_CATEGORY_COUNTS, audit_layout # noqa: E402 | |
| def test_config_layout_is_canonical_and_portable() -> None: | |
| result = audit_layout(ROOT) | |
| assert result["status"] == "PASS", result["errors"] | |
| assert result["config_count"] == 62 | |
| assert result["category_counts"] == EXPECTED_CATEGORY_COUNTS | |
| def test_mlir_config_paths_resolve_from_repository_root() -> None: | |
| paths = sorted((ROOT / "configs/mlir/batch").glob("*_mlir.json")) | |
| assert len(paths) == 21 | |
| for path in paths: | |
| config = run_mlir_batch.load_schema(path) | |
| assert not Path(config["model_dir"]).is_absolute() | |
| assert not Path(config["toolchain_lock"]).is_absolute() | |
| assert run_mlir_batch.resolve_config_path(config["toolchain_lock"]).is_file() | |
| for variant in config["variants"].values(): | |
| assert not Path(variant["input_path"]).is_absolute() | |