Files
carbon-lang/toolchain/parser/lit_autoupdate.py
T
Jon Ross-PerkinsandChandler Carruth e4a04c2936 Use new test framework in toolchain to reduce per-test overhead (#2821)
This builds on #2814 by adding the test framework to the toolchain. On Linux, this is 7s -> 4s for me. #2811 has more detailed timing for the explorer, which also had more dramatic changes because it's about 3x more tests run in 2x as many ways (6x total).

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2023-05-12 10:40:22 -07:00

36 lines
936 B
Python
Executable File

#!/usr/bin/env python3
"""Updates the CHECK: lines in lit tests based on the 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 os
import sys
from pathlib import Path
def main() -> None:
# Calls the main script using execv in order to avoid Python import
# behaviors.
this_py = Path(__file__).resolve()
actual_py = this_py.parent.parent.parent.joinpath(
"bazel", "testing", "lit_autoupdate_base.py"
)
args = [
sys.argv[0],
# Flags to configure for parser testing.
"--tool=carbon",
"--autoupdate_arg=dump",
"--autoupdate_arg=parse-tree",
"--testdata=toolchain/parser/testdata",
] + sys.argv[1:]
os.execv(actual_py, args)
if __name__ == "__main__":
main()