r262285 - Make test more robust.

Sean Silva via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 29 17:20:15 PST 2016

Author: silvas
Date: Mon Feb 29 19:20:15 2016
New Revision: 262285

URL: http://llvm.org/viewvc/llvm-project?rev=262285&view=rev
Make test more robust.

Really all these tests are checking is that we find a file path. The
behavior when we don't find one will have `"ps4-ld"` in it. We just need
a path separator to know that a path has been found.

The root cause of the flakiness of these tests is the same on Windows
and non-Windows: setting the PATH environment variable is not sufficient
to guarantee that a particular path is looked up first.
Driver::GetProgramPath checks some paths before deferring to PATH
(in particular, the directory containing the clang binary itself).

I initally ran into this on Windows when putting a PS4 linker in
build-dir/bin/ps4-ld for testing.
After digging for a while thinking that it was some windows path search
oddity (the Windows SearchPathW documentation indicates that its
behavior varies depending on a registry setting...).
I eventually tried reproducing the issue on Mac and to my surprise found
the same issue.
Ultimately I traced it down to the extra lookups in


Modified: cfe/trunk/test/Driver/ps4-linker-non-win.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ps4-linker-non-win.c?rev=262285&r1=262284&r2=262285&view=diff
--- cfe/trunk/test/Driver/ps4-linker-non-win.c (original)
+++ cfe/trunk/test/Driver/ps4-linker-non-win.c Mon Feb 29 19:20:15 2016
@@ -18,4 +18,4 @@
 // RUN: env "PATH=%T/Output:%PATH%" %clang -### -target x86_64-scei-ps4  %s -shared \
 // RUN:     -fuse-ld=ps4 2>&1 | FileCheck --check-prefix=CHECK-PS4-LINKER %s
-// CHECK-PS4-LINKER: Output/ps4-ld
+// CHECK-PS4-LINKER: /ps4-ld

Modified: cfe/trunk/test/Driver/ps4-linker-win.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ps4-linker-win.c?rev=262285&r1=262284&r2=262285&view=diff
--- cfe/trunk/test/Driver/ps4-linker-win.c (original)
+++ cfe/trunk/test/Driver/ps4-linker-win.c Mon Feb 29 19:20:15 2016
@@ -22,6 +22,5 @@
 // RUN: env "PATH=%T;%PATH%;" %clang -target x86_64-scei-ps4  %s -shared \
 // RUN:     -fuse-ld=ps4 -### 2>&1 | FileCheck --check-prefix=CHECK-PS4-LINKER %s
-// FIXME: "Output\\" is hardcoded part of %T.
-// CHECK-PS4-GOLD: Output\\ps4-ld.gold.exe"
-// CHECK-PS4-LINKER: Output\\ps4-ld.exe"
+// CHECK-PS4-GOLD: \\ps4-ld.gold
+// CHECK-PS4-LINKER: \\ps4-ld

More information about the cfe-commits mailing list