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-XXXXXXXX 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 <[email protected]>
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-XXXXXXXX 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

Reply via email to