autoupdate_lit_testdata.py 946 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env python3
  2. """Updates the CHECK: lines in tests with an AUTOUPDATE line."""
  3. __copyright__ = """
  4. Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  5. Exceptions. See /LICENSE for license information.
  6. SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  7. """
  8. import subprocess
  9. import sys
  10. from pathlib import Path
  11. def main() -> None:
  12. # Subprocess to the main script in order to avoid Python import behaviors.
  13. this_py = Path(__file__).resolve()
  14. autoupdate_py = this_py.parent.parent.joinpath(
  15. "testing", "scripts", "autoupdate_testdata_base.py"
  16. )
  17. args = [
  18. str(autoupdate_py),
  19. # Flags to configure for explorer testing.
  20. "--tool=explorer",
  21. "--testdata=explorer/lit_testdata",
  22. "--lit_run=%{explorer-run}",
  23. "--lit_run=%{explorer-run-trace}",
  24. ] + sys.argv[1:]
  25. exit(subprocess.call(args))
  26. if __name__ == "__main__":
  27. main()