mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-27 21:40:10 +01:00
The intent here is that changes to prelude.carbon shouldn't break every test that expects some error from prelude.carbon; that would be too fragile. As a consequence, this effectively ignores the line number in prelude.carbon. This is a little complex because we don't know which line in the original source file is actually causing the error, just that there is an error. Also, the previous look-behind approach required a fixed-with prefix, whereas we want a little more than that in order to capture the filename for comparison. This would be hard to do with extra_check_replacement because the path to bazel.runfiles is complex to calculate. As a consequence, this is basically all new code. Co-authored-by: Richard Smith <richard@metafoo.co.uk>
37 lines
978 B
Python
Executable File
37 lines
978 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",
|
|
"--lit_run=%{carbon-run-parser}",
|
|
"--testdata=toolchain/parser/testdata",
|
|
] + sys.argv[1:]
|
|
os.execv(actual_py, args)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|