[clang] [clang][test] Fix flaky linker checks in msvc-link.c (PR #228657)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `lldb-arm-ubuntu` running on `linaro-lldb-arm-ubuntu` while building `clang` at step 6 "test". Full details are available at: https://lab.llvm.org/buildbot/#/builders/18/builds/27304 Here is the relevant piece of the build log for the reference ``` Step 6 (test) failure: build (failure) ... PASS: lldb-api :: functionalities/thread/main_thread_exit/TestMainThreadExit.py (794 of 3012) PASS: lldb-api :: functionalities/thread/step_until/TestStepUntilAPI.py (795 of 3012) PASS: lldb-api :: functionalities/thread/thread_exit/TestThreadExit.py (796 of 3012) PASS: lldb-api :: functionalities/thread/step_out_line0/TestThreadStepOutLine0.py (797 of 3012) PASS: lldb-api :: functionalities/thread/step_until/TestStepUntil.py (798 of 3012) PASS: lldb-api :: functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py (799 of 3012) PASS: lldb-api :: functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py (800 of 3012) SKIPPED: lldb-api :: functionalities/tsan/basic/TestTsanBasic.py (801 of 3012) SKIPPED: lldb-api :: functionalities/tsan/cpp_global_location/TestTsanCPPGlobalLocation.py (802 of 3012) PASS: lldb-api :: functionalities/thread/exit_during_expression/TestExitDuringExpression.py (803 of 3012) FAIL: lldb-api :: functionalities/thread/exit_during_step/TestExitDuringStep.py (804 of 3012) TEST 'lldb-api :: functionalities/thread/exit_during_step/TestExitDuringStep.py' FAILED Script: -- /usr/bin/python3.10 /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin --triple armv8l-unknown-linux-gnueabihf --build-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/lldb --lldb-python-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/local/lib/python3.10/dist-packages --compiler /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./lib --cmake-build-type Release /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/functionalities/thread/exit_during_step -p TestExitDuringStep.py --timeout 600 -- Exit Code: 1 Command Output (stdout): -- Skipping the following test categories: libc++, msvcstl, dsym, pdb, gmodules, debugserver, objc -- Command Output (stderr): -- UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_dsym (TestExitDuringStep.ExitDuringStepTestCase) (test case does not fall in any category of interest for this run) PASS: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_dwarf (TestExitDuringStep.ExitDuringStepTestCase) PASS: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_dwo (TestExitDuringStep.ExitDuringStepTestCase) UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_step_in_dsym (TestExitDuringStep.ExitDuringStepTestCase) (test case does not fall in any category of interest for this run) PASS: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_step_in_dwarf (TestExitDuringStep.ExitDuringStepTestCase) PASS: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_step_in_dwo (TestExitDuringStep.ExitDuringStepTestCase) UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_step_over_dsym (TestExitDuringStep.ExitDuringStepTestCase) (test case does not fall in any category of interest for this run) PASS: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_step_over_dwarf (TestExitDuringStep.ExitDuringStepTestCase) FAIL: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_step_over_dwo (TestExitDuringStep.ExitDuringStepTestCase) Log Files: - /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build/functionalities/thread/exit_during_step/TestExitDuringStep.dwo/Failure_test_step_over_dwo.log == FAIL: test_step_over_dwo
[clang] [clang][test] Fix flaky linker checks in msvc-link.c (PR #228657)
https://github.com/zeroomega closed https://github.com/llvm/llvm-project/pull/228657 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][test] Fix flaky linker checks in msvc-link.c (PR #228657)
https://github.com/Nerixyz approved this pull request. https://github.com/llvm/llvm-project/pull/228657 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][test] Fix flaky linker checks in msvc-link.c (PR #228657)
@@ -61,9 +61,8 @@
// RUN: %clang --target=i686-pc-windows-msvc -g -fuse-ld= -### %s 2>&1 |
FileCheck --check-prefix=DEBUG-LINK %s
// RUN: %clang --target=i686-pc-windows-msvc -g -fuse-ld=link -### %s 2>&1 |
FileCheck --check-prefix=DEBUG-LINK %s
-// DEBUG-LINK: link.exe"
+// DEBUG-LINK: "{{([^"]*[/\\])?}}link.exe"
Nerixyz wrote:
Oh, I thought the default linker was also used in the `-fuse-ld` case.
https://github.com/llvm/llvm-project/pull/228657
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][test] Fix flaky linker checks in msvc-link.c (PR #228657)
@@ -61,9 +61,8 @@
// RUN: %clang --target=i686-pc-windows-msvc -g -fuse-ld= -### %s 2>&1 |
FileCheck --check-prefix=DEBUG-LINK %s
// RUN: %clang --target=i686-pc-windows-msvc -g -fuse-ld=link -### %s 2>&1 |
FileCheck --check-prefix=DEBUG-LINK %s
-// DEBUG-LINK: link.exe"
+// DEBUG-LINK: "{{([^"]*[/\\])?}}link.exe"
zeroomega wrote:
Why it won't work? Build task
https://ci.chromium.org/ui/p/fuchsia/builders/toolchain.ci.shadow/clang-linux-x64/b8668993331892795153/overview
was test run on this PR using `clang/cmake/caches/Fuchsia-stage2.cmake` cache
file (see
https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket/8668993331892795153/+/u/clang/configure/l_execution_details).
And this cache file set the flag you mentioned to lld:
https://github.com/llvm/llvm-project/blob/018a46162a84070109760677031bcd636ed6026e/clang/cmake/caches/Fuchsia-stage2.cmake#L43
So we already tested the scenario you suspected and it passed.
Also the two RUN: at L62 and 63 overrides the linker with -fuse-ld.
In visualstudio::Linker::ConstructJob:
https://github.com/llvm/llvm-project/blob/018a46162a84070109760677031bcd636ed6026e/clang/lib/Driver/ToolChains/MSVC.cpp#L341-L361
Because `-fuse-ld=` is present on the command line, `A` is non-null, so
`TC.getDriver().getPreferredLinker()` (CLANG_DEFAULT_LINKER) is not used.
`A->getValue()` returns "", which enters `if (Linker.empty())` and selects
"link" (link.exe).
In this case, the test should pass even after the modification.
https://github.com/llvm/llvm-project/pull/228657
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][test] Fix flaky linker checks in msvc-link.c (PR #228657)
@@ -61,9 +61,8 @@
// RUN: %clang --target=i686-pc-windows-msvc -g -fuse-ld= -### %s 2>&1 |
FileCheck --check-prefix=DEBUG-LINK %s
// RUN: %clang --target=i686-pc-windows-msvc -g -fuse-ld=link -### %s 2>&1 |
FileCheck --check-prefix=DEBUG-LINK %s
-// DEBUG-LINK: link.exe"
+// DEBUG-LINK: "{{([^"]*[/\\])?}}link.exe"
Nerixyz wrote:
I don't think this will work if Clang is configured with
`CLANG_DEFAULT_LINKER=lld`.
https://github.com/llvm/llvm-project/pull/228657
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][test] Fix flaky linker checks in msvc-link.c (PR #228657)
https://github.com/zeroomega created
https://github.com/llvm/llvm-project/pull/228657
In clang/test/Driver/msvc-link.c, DEBUG-LINK-NOT: lld and DEBUG-LLD-NOT:
link.exe were placed after the *-SAME: "-debug" checks. Because FileCheck only
scans the input after the preceding positive match for CHECK-NOT, those
negative checks never inspected the linker executable at the start of the
command line and instead scanned the trailing arguments (such as the temporary
object file path inside lit's randomly named lit-tmp- scratch
directory), causing spurious failures whenever the scratch directory name
contained "lld".
Moreover, DEBUG-LINK: link.exe" was unanchored on the left and could match the
suffix of "lld-link.exe".
Anchor the positive linker executable regexes in DEBUG-LINK and DEBUG-LLD to
the opening quote or path separator within a single quoted argument
("{{([^"]*[/\\])?}}...") so link.exe cannot match lld-link.exe, and remove the
redundant trailing *-NOT checks.
>From 14f1ccf6d04434a0bf3f41815e9001afff24e876 Mon Sep 17 00:00:00 2001
From: Haowei Wu
Date: Fri, 2 Oct 2026 21:09:36 -0700
Subject: [PATCH] [clang][test] Fix flaky linker checks in msvc-link.c
In clang/test/Driver/msvc-link.c, DEBUG-LINK-NOT: lld and
DEBUG-LLD-NOT: link.exe were placed after the *-SAME: "-debug" checks.
Because FileCheck only scans the input after the preceding positive
match for CHECK-NOT, those negative checks never inspected the linker
executable at the start of the command line and instead scanned the
trailing arguments (such as the temporary object file path inside
lit's randomly named lit-tmp- scratch directory), causing
spurious failures whenever the scratch directory name contained "lld".
Moreover, DEBUG-LINK: link.exe" was unanchored on the left and could
match the suffix of "lld-link.exe".
Anchor the positive linker executable regexes in DEBUG-LINK and
DEBUG-LLD to the opening quote or path separator within a single quoted
argument ("{{([^"]*[/\\])?}}...") so link.exe cannot match lld-link.exe,
and remove the redundant trailing *-NOT checks.
---
clang/test/Driver/msvc-link.c | 6 ++
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/clang/test/Driver/msvc-link.c b/clang/test/Driver/msvc-link.c
index fc7a18014da735..88474dbd9787cb 100644
--- a/clang/test/Driver/msvc-link.c
+++ b/clang/test/Driver/msvc-link.c
@@ -61,9 +61,8 @@
// RUN: %clang --target=i686-pc-windows-msvc -g -fuse-ld= -### %s 2>&1 |
FileCheck --check-prefix=DEBUG-LINK %s
// RUN: %clang --target=i686-pc-windows-msvc -g -fuse-ld=link -### %s 2>&1 |
FileCheck --check-prefix=DEBUG-LINK %s
-// DEBUG-LINK: link.exe"
+// DEBUG-LINK: "{{([^"]*[/\\])?}}link.exe"
// DEBUG-LINK-SAME: "-debug"
-// DEBUG-LINK-NOT: lld
// RUN: %clang --target=i686-pc-windows-msvc -g -fuse-ld=lld -### %s 2>&1 |
FileCheck --check-prefix=DEBUG-LLD %s
// RUN: %clang --target=i686-pc-windows-msvc -g -fuse-ld=lld-link -### %s 2>&1
| FileCheck --check-prefix=DEBUG-LLD %s
@@ -73,6 +72,5 @@
// RUN: %clang --target=i686-pc-windows-msvc -gdwarf-4 -fuse-ld= -### %s 2>&1
| FileCheck --check-prefix=DEBUG-LLD %s
// RUN: %clang --target=i686-pc-windows-msvc -gdwarf-5 -fuse-ld= -### %s 2>&1
| FileCheck --check-prefix=DEBUG-LLD %s
// RUN: %clang --target=i686-pc-windows-msvc -gdwarf-6 -fuse-ld= -### %s 2>&1
| FileCheck --check-prefix=DEBUG-LLD %s
-// DEBUG-LLD: lld-link{{(\.exe)?}}"
+// DEBUG-LLD: "{{([^"]*[/\\])?}}lld-link{{(\.exe)?}}"
// DEBUG-LLD-SAME: "-debug"
-// DEBUG-LLD-NOT: link.exe
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
