forked from carbon-language/carbon-lang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lit_autoupdate.py
executable file
·36 lines (29 loc) · 999 Bytes
/
lit_autoupdate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/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.joinpath(
"bazel", "testing", "lit_autoupdate_base.py"
)
args = [
sys.argv[0],
# Flags to configure for explorer testing.
"--tool=explorer",
"--testdata=explorer/testdata",
r"--line_number_pattern=(?<=\.carbon:)(\d+)(?=(?:\D|$))",
"--lit_run=%{explorer-run}",
"--lit_run=%{explorer-run-trace}",
] + sys.argv[1:]
os.execv(actual_py, args)
if __name__ == "__main__":
main()