Save test metadata to cache file. Args: build_dir: Meson build directory tests_hash: Hash of test file metadata metadata: Test metadata output from organize_tests.py
(build_dir: Path, tests_hash: str, metadata: str)
| 114 | |
| 115 | |
| 116 | def save_cache(build_dir: Path, tests_hash: str, metadata: str) -> None: |
| 117 | """ |
| 118 | Save test metadata to cache file. |
| 119 | |
| 120 | Args: |
| 121 | build_dir: Meson build directory |
| 122 | tests_hash: Hash of test file metadata |
| 123 | metadata: Test metadata output from organize_tests.py |
| 124 | """ |
| 125 | import time |
| 126 | |
| 127 | cache_file = build_dir / CACHE_FILENAME |
| 128 | build_dir.mkdir(parents=True, exist_ok=True) |
| 129 | |
| 130 | cache = {"hash": tests_hash, "timestamp": time.time(), "metadata": metadata} |
| 131 | |
| 132 | with open(cache_file, "w", encoding="utf-8") as f: |
| 133 | json.dump(cache, f, indent=2) |
| 134 | |
| 135 | |
| 136 | def parse_metadata(metadata: str) -> set[str]: |