xref: /llvm-project/clang/test/Driver/env.c (revision f5991161529511ca6ebc058da2a0507c2fc5283e)
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" CLANG_NO_DEFAULT_CONFIG=1 \
8 // RUN:   %clang %s -### -o %t.o --target=i386-unknown-linux \
9 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
10 // RUN:     --rtlib=platform --unwindlib=platform -no-pie \
11 // RUN:     2>&1 | FileCheck --check-prefix=CHECK-LD-32 %s
12 //
13 // RUN: env -i LC_ALL=C PATH="" LD_LIBRARY_PATH="$LD_LIBRARY_PATH" CLANG_NO_DEFAULT_CONFIG=1 \
14 // RUN:   %clang %s -### -o %t.o --target=i386-unknown-linux \
15 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
16 // RUN:     --rtlib=platform --unwindlib=platform -no-pie \
17 // RUN:     2>&1 | FileCheck --check-prefix=CHECK-LD-32 %s
18 //
19 // CHECK-LD-32-NOT: warning:
20 // CHECK-LD-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
21 // CHECK-LD-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/10.2.0{{/|\\\\}}crtbegin.o"
22 // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/10.2.0"
23 // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/10.2.0/../../../../i386-unknown-linux/lib"
24 // CHECK-LD-32: "-L[[SYSROOT]]/lib"
25 // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib"
26