Clang Project

clang_source_code/test/Driver/env.c
1// These tests try to ensure that the driver operates reasonably when run with
2// a strange environment. Unfortunately, it requires a normal shell and the
3// 'env' command that understands arguments, unlike the LIT built-in env.
4//
5// REQUIRES: shell
6// The PATH variable is heavily used when trying to find a linker.
7// RUN: env -i LC_ALL=C LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
8// RUN:   %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
9// RUN:     --target=i386-unknown-linux \
10// RUN:     --sysroot=%S/Inputs/basic_linux_tree \
11// RUN:     --gcc-toolchain="" \
12// RUN:   | FileCheck --check-prefix=CHECK-LD-32 %s
13//
14// RUN: env -i LC_ALL=C PATH="" LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
15// RUN:   %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
16// RUN:     --target=i386-unknown-linux \
17// RUN:     --sysroot=%S/Inputs/basic_linux_tree \
18// RUN:     --gcc-toolchain="" \
19// RUN:   | FileCheck --check-prefix=CHECK-LD-32 %s
20//
21// CHECK-LD-32-NOT: warning:
22// CHECK-LD-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
23// CHECK-LD-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
24// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
25// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
26// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
27// CHECK-LD-32: "-L[[SYSROOT]]/lib"
28// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib"
29