From e2603996e5b155d8316b42e9b3dbc087e4e9e1f8 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Wed, 11 Nov 2026 22:57:11 +0000 Subject: [PATCH] Allow autoupdate_testdata.py to update C++ file tests (#8124) Some driver file tests are C++ files, such as toolchain/driver/testdata/fail_clang_no_args.cpp, but autoupdate_testdata.py ignored any file argument that wasn't a .carbon file. I tested this manually (since there's no automated test coverage for the script) by making a modification to that .cpp file's CHECK before and after this PR's change: Before: ``` [hi on] blaikie@blaikie-cloudtop2:~/dev/carbon$ ./toolchain/autoupdate_testdata.py toolchain/driver/testdata/fail_clang_no_args.cpp Args do not seem to be test files; for example, toolchain/driver/testdata/fail_clang_no_args.cpp ``` After: ``` [hi on] blaikie@blaikie-cloudtop2:~/dev/carbon$ ./toolchain/autoupdate_testdata.py toolchain/driver/testdata/fail_clang_no_args.cpp ... TEST: toolchain/driver/testdata/fail_clang_no_args.cpp ! Ran 1 tests in 25 ms wall time, 1 ms across threads ``` This improves the situation for those two .cpp files, and paves the way for more top-level C++ test coverage for reverse interop functionality. --- toolchain/autoupdate_testdata.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/toolchain/autoupdate_testdata.py b/toolchain/autoupdate_testdata.py index 7ca175991532..bee936de6d07 100755 --- a/toolchain/autoupdate_testdata.py +++ b/toolchain/autoupdate_testdata.py @@ -110,9 +110,10 @@ def main() -> None: if args.files: repo_root = Path(__file__).parents[1] file_tests = [] - # Filter down to just test files. + # Filter down to just test files. Most are Carbon files, but some + # driver tests are C++ files. for f in args.files: - if f.endswith(".carbon"): + if f.endswith((".carbon", ".cpp")): path = str(Path(f).resolve().relative_to(repo_root)) if path.count("/testdata/"): file_tests.append(path)