From 52727f9e4b7efe5c2b8bb97efd68f75d49a9ce93 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 9 Jun 2025 12:39:07 -0400 Subject: [PATCH] Print test names when running with --threads=1 (#5629) When tests crash by stack overflow (and maybe other ways), they don't print a stack trace so you don't have any way to know which file it was. By running with --threads=1 you can figure this out, if we print out the name of each test before we run it. This prints each test name on its own line, then allows the autoupdate sigil to be added to the end of that line: ``` TEST: toolchain/check/testdata/alias/basics.carbon . TEST: toolchain/check/testdata/alias/builtins.carbon ! TEST: toolchain/check/testdata/alias/export_name.carbon . TEST: toolchain/check/testdata/alias/import.carbon . ... ``` --- testing/file_test/file_test_base.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/testing/file_test/file_test_base.cpp b/testing/file_test/file_test_base.cpp index 57da501ae61e..0d34f98e072f 100644 --- a/testing/file_test/file_test_base.cpp +++ b/testing/file_test/file_test_base.cpp @@ -386,6 +386,9 @@ static auto RunSingleTest(FileTestInfo& test, bool single_threaded, if (absl::GetFlag(FLAGS_dump_output)) { std::unique_lock lock(output_mutex); llvm::errs() << "\n--- Dumping: " << test.test_name << "\n\n"; + } else if (single_threaded) { + std::unique_lock lock(output_mutex); + llvm::errs() << "\nTEST: " << test.test_name << ' '; } // Load expected output.