summaryrefslogtreecommitdiffstats
path: root/clang/test/Driver/env.c
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-12-02 00:53:20 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-12-02 00:53:20 +0000
commitc2f9ea78473caa319380f49287da512ba96c60e8 (patch)
tree488c0e5aff2a593129c1213608c76677e3a51a8b /clang/test/Driver/env.c
parentec8406d8f43c8e459034f8bddf3112c26a31a81b (diff)
downloadbcm5719-llvm-c2f9ea78473caa319380f49287da512ba96c60e8.tar.gz
bcm5719-llvm-c2f9ea78473caa319380f49287da512ba96c60e8.zip
Add a test that ensures the Clang driver behaves itself when the PATH
environment variable is changed to strange things out from under it. Prior to r223099 in LLVM, these test cases would crash in various ways (assert fails, stack exhaustion, etc.). llvm-svn: 223100
Diffstat (limited to 'clang/test/Driver/env.c')
-rw-r--r--clang/test/Driver/env.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/test/Driver/env.c b/clang/test/Driver/env.c
new file mode 100644
index 00000000000..1d28fc0091d
--- /dev/null
+++ b/clang/test/Driver/env.c
@@ -0,0 +1,25 @@
+// These tests try to ensure that the driver operates reasonably when run with
+// a strange environment. Unfortunately, it requires a normal shell and the
+// 'env' command.
+//
+// REQUIRES: shell
+//
+// The PATH variable is heavily used when trying to find a linker.
+// RUN: env -u PATH -- %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=i386-unknown-linux \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD-32 %s
+//
+// RUN: env PATH="" %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=i386-unknown-linux \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD-32 %s
+//
+// CHECK-LD-32-NOT: warning:
+// CHECK-LD-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-LD-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
+// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
+// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
+// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
+// CHECK-LD-32: "-L[[SYSROOT]]/lib"
+// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib"
OpenPOWER on IntegriCloud