From 74a8d51d78758843b3dec7ec191f16f4aab63353 Mon Sep 17 00:00:00 2001 From: Jon Ross-Perkins Date: Thu, 4 Sep 2025 07:54:47 -0700 Subject: [PATCH] Add test name to all file_test errors (#6011) Common case is going to be like: ``` Running tests with 64 thread(s) Autoupdate can't discard non-CHECK lines inside conflicts: ......................!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!..!!!!!!!!!!!!!!!!!!!!. ``` -> ``` Running tests with 64 thread(s) toolchain/check/testdata/as/unsafe_as.carbon: Autoupdate can't discard non-CHECK lines inside conflicts: ......................!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!..!!!!!!!!!!!!!!!!!!!!. ``` (i.e., the conflict line was blank) One error had the test name, I'm dropping it here, meaning: ``` ................................................................................ Missing AUTOUPDATE/NOAUTOUPDATE setting: toolchain/codegen/testdata/assembly/basic.carbon ................................................................................ ``` -> ``` ................................................................................ toolchain/codegen/testdata/assembly/basic.carbon: Missing AUTOUPDATE/NOAUTOUPDATE setting ................................................................................ ``` For single-threaded runs, at the top there's already: ``` } else if (single_threaded) { std::unique_lock lock(output_mutex); llvm::errs() << "\nTEST: " << test.test_name << ' '; } ``` --- testing/file_test/file_test_base.cpp | 5 ++++- testing/file_test/test_file.cpp | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/testing/file_test/file_test_base.cpp b/testing/file_test/file_test_base.cpp index 2ac8d5e06807..18f71a4481c9 100644 --- a/testing/file_test/file_test_base.cpp +++ b/testing/file_test/file_test_base.cpp @@ -434,7 +434,10 @@ static auto RunSingleTest(FileTestInfo& test, bool single_threaded, if (!test.test_result->ok()) { std::unique_lock lock(output_mutex); - llvm::errs() << "\n" << test.test_result->error().message() << "\n"; + if (!single_threaded) { + llvm::errs() << "\n" << test.test_name << ": "; + } + llvm::errs() << test.test_result->error().message() << "\n"; return true; } diff --git a/testing/file_test/test_file.cpp b/testing/file_test/test_file.cpp index 89506ed7dc04..691605e7fc8e 100644 --- a/testing/file_test/test_file.cpp +++ b/testing/file_test/test_file.cpp @@ -833,8 +833,7 @@ auto ProcessTestFile(llvm::StringRef test_name, bool running_autoupdate) test_file.file_splits, include_files)); if (!found_autoupdate) { - return ErrorBuilder() << "Missing AUTOUPDATE/NOAUTOUPDATE setting: " - << test_name; + return ErrorBuilder() << "Missing AUTOUPDATE/NOAUTOUPDATE setting"; } constexpr llvm::StringLiteral AutoupdateSplit = "AUTOUPDATE-SPLIT";