xref: /minix3/external/bsd/llvm/dist/clang/test/Driver/darwin-sdkroot.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // Check that SDKROOT is used to define the default for -isysroot on Darwin.
2f4a2713aSLionel Sambuc //
3f4a2713aSLionel Sambuc // RUN: rm -rf %t.tmpdir
4f4a2713aSLionel Sambuc // RUN: mkdir -p %t.tmpdir
5f4a2713aSLionel Sambuc // RUN: env SDKROOT=%t.tmpdir %clang -target x86_64-apple-darwin10 \
6f4a2713aSLionel Sambuc // RUN:   -c %s -### 2> %t.log
7f4a2713aSLionel Sambuc // RUN: FileCheck --check-prefix=CHECK-BASIC < %t.log %s
8f4a2713aSLionel Sambuc //
9f4a2713aSLionel Sambuc // CHECK-BASIC: clang
10f4a2713aSLionel Sambuc // CHECK-BASIC: "-cc1"
11f4a2713aSLionel Sambuc // CHECK-BASIC: "-isysroot" "{{.*tmpdir}}"
12f4a2713aSLionel Sambuc 
13f4a2713aSLionel Sambuc // Check that we don't use SDKROOT as the default if it is not a valid path.
14f4a2713aSLionel Sambuc //
15f4a2713aSLionel Sambuc // RUN: rm -rf %t.nonpath
16f4a2713aSLionel Sambuc // RUN: env SDKROOT=%t.nonpath %clang -target x86_64-apple-darwin10 \
17f4a2713aSLionel Sambuc // RUN:   -c %s -### 2> %t.log
18f4a2713aSLionel Sambuc // RUN: FileCheck --check-prefix=CHECK-NONPATH < %t.log %s
19f4a2713aSLionel Sambuc //
20f4a2713aSLionel Sambuc // CHECK-NONPATH: clang
21f4a2713aSLionel Sambuc // CHECK-NONPATH: "-cc1"
22f4a2713aSLionel Sambuc // CHECK-NONPATH-NOT: "-isysroot"
23f4a2713aSLionel Sambuc 
24f4a2713aSLionel Sambuc // Check that we don't use SDKROOT as the default if it is just "/"
25f4a2713aSLionel Sambuc //
26f4a2713aSLionel Sambuc // RUN: env SDKROOT=/ %clang -target x86_64-apple-darwin10 \
27f4a2713aSLionel Sambuc // RUN:   -c %s -### 2> %t.log
28f4a2713aSLionel Sambuc // RUN: FileCheck --check-prefix=CHECK-NONROOT < %t.log %s
29f4a2713aSLionel Sambuc //
30f4a2713aSLionel Sambuc // CHECK-NONROOT: clang
31f4a2713aSLionel Sambuc // CHECK-NONROOT: "-cc1"
32f4a2713aSLionel Sambuc // CHECK-NONROOT-NOT: "-isysroot"
33f4a2713aSLionel Sambuc //
34f4a2713aSLionel Sambuc // It doesn't make sense on msys bash.
35f4a2713aSLionel Sambuc // REQUIRES: shell-preserves-root
36*0a6a1f1dSLionel Sambuc //
37*0a6a1f1dSLionel Sambuc // This test will fail with MSYS env.exe, since it does not preserve root,
38*0a6a1f1dSLionel Sambuc // expanding / into C:/MINGW/MSYS/1.0. To see the problem, from cmd.exe run:
39*0a6a1f1dSLionel Sambuc //
40*0a6a1f1dSLionel Sambuc //   env SDKROOT=/ cmd //c echo %SDKROOT%
41*0a6a1f1dSLionel Sambuc //
42*0a6a1f1dSLionel Sambuc // This test passes using env.exe from GnuWin32.
43