[clang] 5ce85e6 - Fix driver test from e16c0a9a689719

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 24 07:51:34 PST 2020


Author: Nico Weber
Date: 2020-11-24T10:51:08-05:00
New Revision: 5ce85e66358a69e786093756c77fae2e140947c1

URL: https://github.com/llvm/llvm-project/commit/5ce85e66358a69e786093756c77fae2e140947c1
DIFF: https://github.com/llvm/llvm-project/commit/5ce85e66358a69e786093756c77fae2e140947c1.diff

LOG: Fix driver test from e16c0a9a689719

The test failed silently if lld wasn't built alongside clang.
But the test uses -###, so the "invalid linker name in -fuse-ld=lld"
diag didn't make clang fail, and something else happened to match
"-demangle", so the test passed.

To fix, pass -B to a directory with two empty +x files (which works
on non-Windows), and look for `"-demangle"` instead of just `-demangle`.
Also force linker_version to 0 and pass a darwin triple.

Differential Revision: https://reviews.llvm.org/D92028

Added: 
    clang/test/Driver/Inputs/lld/ld64.lld
    clang/test/Driver/Inputs/lld/ld64.lld.darwinnew

Modified: 
    clang/test/Driver/darwin-ld-demangle-lld.c

Removed: 
    


################################################################################
diff  --git a/clang/test/Driver/Inputs/lld/ld64.lld b/clang/test/Driver/Inputs/lld/ld64.lld
new file mode 100755
index 000000000000..e69de29bb2d1

diff  --git a/clang/test/Driver/Inputs/lld/ld64.lld.darwinnew b/clang/test/Driver/Inputs/lld/ld64.lld.darwinnew
new file mode 100755
index 000000000000..e69de29bb2d1

diff  --git a/clang/test/Driver/darwin-ld-demangle-lld.c b/clang/test/Driver/darwin-ld-demangle-lld.c
index dfa48353e5a7..84facc8d1539 100644
--- a/clang/test/Driver/darwin-ld-demangle-lld.c
+++ b/clang/test/Driver/darwin-ld-demangle-lld.c
@@ -1,6 +1,12 @@
 // With -fuse-ld=lld, -demangle is always passed to the linker on Darwin.
+// REQUIRES: shell
 
-// RUN: %clang -### -fuse-ld=lld %s 2>&1 | FileCheck %s
+// RUN: %clang --target=x86_64-apple-darwin -### \
+// RUN:   -fuse-ld=lld -B%S/Inputs/lld -mlinker-version=0 %s 2>&1 \
+// RUN:   | FileCheck %s
 // FIXME: Remove ld.darwinnew once it's the default (and only) mach-o lld.
-// RUN: %clang -### -fuse-ld=lld.darwinnew %s 2>&1 | FileCheck %s
-// CHECK: -demangle
+// RUN: %clang --target=x86_64-apple-darwin -### \
+// RUN:   -fuse-ld=lld.darwinnew -B%S/Inputs/lld -mlinker-version=0 %s 2>&1 \
+// RUN:   | FileCheck %s
+
+// CHECK: "-demangle"


        


More information about the cfe-commits mailing list