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

Function main

tests/test_metadata_cache.py:200–302  ·  view source on GitHub ↗

Main entry point for test metadata cache operations.

()

Source from the content-addressed store, hash-verified

198
199
200def main() -> None:
201 """Main entry point for test metadata cache operations."""
202 parser = argparse.ArgumentParser(
203 description="Manage test metadata cache for Meson build system"
204 )
205
206 # Mutually exclusive operation modes
207 group = parser.add_mutually_exclusive_group(required=True)
208 group.add_argument(
209 "--check",
210 action="store_true",
211 help="Check if cache is valid (exit 0 if valid, 1 if invalid)",
212 )
213 group.add_argument(
214 "--update", action="store_true", help="Update cache with new metadata"
215 )
216 group.add_argument(
217 "--invalidate", action="store_true", help="Force invalidate cache"
218 )
219 group.add_argument(
220 "--detect-changes",
221 action="store_true",
222 help="Detect changes since last cache (JSON output)",
223 )
224
225 # Positional arguments
226 parser.add_argument(
227 "tests_dir",
228 nargs="?",
229 type=Path,
230 help="Tests directory (required for --check, --update, --detect-changes)",
231 )
232 parser.add_argument(
233 "build_dir",
234 nargs="?",
235 type=Path,
236 help="Build directory (required for all operations)",
237 )
238 parser.add_argument(
239 "metadata", nargs="?", type=str, help="Test metadata (required for --update)"
240 )
241
242 args = parser.parse_args()
243
244 # Validate arguments based on operation
245 if args.invalidate:
246 if not args.build_dir:
247 print("Error: --invalidate requires <build_dir>", file=sys.stderr)
248 sys.exit(1)
249
250 cache_file = args.build_dir / CACHE_FILENAME
251 if cache_file.exists():
252 cache_file.unlink()
253 sys.exit(0)
254
255 elif args.check:
256 if not args.tests_dir or not args.build_dir:
257 print("Error: --check requires <tests_dir> <build_dir>", file=sys.stderr)

Callers 1

Calls 7

compute_test_files_hashFunction · 0.85
detect_changesFunction · 0.85
parse_argsMethod · 0.80
unlinkMethod · 0.80
load_cacheFunction · 0.70
save_cacheFunction · 0.70
printFunction · 0.50

Tested by

no test coverage detected