Files
carbon-lang/explorer/autoupdate_lit_testdata.py
T
Jon Ross-Perkins e2b1511a0d Clean up lit tests and config to reflect current uses. (#2913)
Overall, cleaning up remaining lit uses.

#2851 had removed FileCheck invocations from some of the explorer tests; this starts as just restoring that. But, now that we have far fewer `lit` tests, it seems best to refine `lit.cfg.py` to focus on providing fewer commands (not all were even used).

Also, adding testing of an error to explorer (which I noticed due to a change that would've broken that) made me notice that autoupdate_lit_test's for_lit logic didn't actually work, so I'm just cutting it and going to manual updates. Really, we might want to just remove lit autoupdate support altogether since it's only a couple tests using it, but I'm not ready to make that change right now.

Fixes #2912
2023-06-16 11:52:11 -07:00

36 lines
1.0 KiB
Python
Executable File

#!/usr/bin/env python3
"""Updates the CHECK: lines in tests with an AUTOUPDATE line."""
__copyright__ = """
Part of the Carbon Language project, under the Apache License v2.0 with LLVM
Exceptions. See /LICENSE for license information.
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
"""
import subprocess
import sys
from pathlib import Path
def main() -> None:
# Subprocess to the main script in order to avoid Python import behaviors.
this_py = Path(__file__).resolve()
autoupdate_py = this_py.parent.parent.joinpath(
"testing", "scripts", "autoupdate_testdata_base.py"
)
args = [
str(autoupdate_py),
# Flags to configure for explorer testing.
"--tool=explorer",
"--testdata=explorer/lit_testdata",
"--lit_run=%{explorer} | %{FileCheck-strict}",
"--lit_run=%{explorer} --parser_debug --trace_file=- | "
"%{FileCheck-allow-unmatched}",
] + sys.argv[1:]
exit(subprocess.call(args))
if __name__ == "__main__":
main()