blob: 3fc2a13c19cddd1bf211a77fa1eb6b1d7de17987 [file] [log] [blame]
Daniel Dunbar455a0492012-08-17 18:43:50 +00001// Check that SDKROOT is used to define the default for -isysroot on Darwin.
2//
3// RUN: rm -rf %t.tmpdir
4// RUN: mkdir -p %t.tmpdir
5// RUN: env SDKROOT=%t.tmpdir %clang -target x86_64-apple-darwin10 \
6// RUN: -c %s -### 2> %t.log
7// RUN: FileCheck --check-prefix=CHECK-BASIC < %t.log %s
8//
9// CHECK-BASIC: clang
10// CHECK-BASIC: "-cc1"
11// CHECK-BASIC: "-isysroot" "{{.*tmpdir}}"
12
13// Check that we don't use SDKROOT as the default if it is not a valid path.
Daniel Dunbarb2543042013-01-15 20:33:56 +000014//
Daniel Dunbar455a0492012-08-17 18:43:50 +000015// RUN: rm -rf %t.nonpath
16// RUN: env SDKROOT=%t.nonpath %clang -target x86_64-apple-darwin10 \
17// RUN: -c %s -### 2> %t.log
18// RUN: FileCheck --check-prefix=CHECK-NONPATH < %t.log %s
19//
20// CHECK-NONPATH: clang
21// CHECK-NONPATH: "-cc1"
22// CHECK-NONPATH-NOT: "-isysroot"
Daniel Dunbarb2543042013-01-15 20:33:56 +000023
24// Check that we don't use SDKROOT as the default if it is just "/"
25//
26// RUN: env SDKROOT=/ %clang -target x86_64-apple-darwin10 \
27// RUN: -c %s -### 2> %t.log
28// RUN: FileCheck --check-prefix=CHECK-NONROOT < %t.log %s
29//
30// CHECK-NONROOT: clang
31// CHECK-NONROOT: "-cc1"
32// CHECK-NONROOT-NOT: "-isysroot"
NAKAMURA Takumi6c8127c2013-01-16 06:10:16 +000033//
34// It doesn't make sense on msys bash.
35// REQUIRES: shell-preserves-root
Yaron Keren3c4c9fe2014-11-04 14:54:37 +000036//
Yaron Keren1a06e6ab2015-07-15 09:41:04 +000037// This test fails with MSYS or MSYS2 env.exe, since it does not preserve
38// root, expanding / into C:/MINGW/MSYS/1.0 or c:/msys64. To reproduce the
39// problem, run:
Yaron Keren3c4c9fe2014-11-04 14:54:37 +000040//
Yaron Kerenec740b32014-08-09 21:24:04 +000041// env SDKROOT=/ cmd //c echo %SDKROOT%
Yaron Keren3c4c9fe2014-11-04 14:54:37 +000042//
Yaron Keren1a06e6ab2015-07-15 09:41:04 +000043// This test do pass using GnuWin32 env.exe.
Steven Wu7a1372c2015-06-25 01:59:35 +000044
45// Check if clang set the correct deployment target from -sysroot
46//
47// RUN: rm -rf %t/SDKs/iPhoneOS8.0.0.sdk
48// RUN: mkdir -p %t/SDKs/iPhoneOS8.0.0.sdk
49// RUN: env SDKROOT=%t/SDKs/iPhoneOS8.0.0.sdk %clang -target arm64-apple-darwin %s -### 2>&1 \
50// RUN: | FileCheck --check-prefix=CHECK-IPHONE %s
51//
52// CHECK-IPHONE: clang
53// CHECK-IPHONE: "-cc1"
54// CHECK-IPHONE: "-triple" "arm64-apple-ios8.0.0"
55// CHECK-IPHONE: ld
56// CHECK-IPHONE: "-iphoneos_version_min" "8.0.0"
57//
58//
59// RUN: rm -rf %t/SDKs/iPhoneSimulator8.0.sdk
60// RUN: mkdir -p %t/SDKs/iPhoneSimulator8.0.sdk
61// RUN: env SDKROOT=%t/SDKs/iPhoneSimulator8.0.sdk %clang -target x86_64-apple-darwin %s -### 2>&1 \
62// RUN: | FileCheck --check-prefix=CHECK-SIMULATOR %s
63//
64// CHECK-SIMULATOR: clang
65// CHECK-SIMULATOR: "-cc1"
66// CHECK-SIMULATOR: "-triple" "x86_64-apple-ios8.0.0"
67// CHECK-SIMULATOR: ld
68// CHECK-SIMULATOR: "-ios_simulator_version_min" "8.0.0"
69//
70// RUN: rm -rf %t/SDKs/MacOSX10.10.0.sdk
71// RUN: mkdir -p %t/SDKs/MacOSX10.10.0.sdk
72// RUN: env SDKROOT=%t/SDKs/MacOSX10.10.0.sdk %clang -target x86_64-apple-darwin %s -### 2>&1 \
73// RUN: | FileCheck --check-prefix=CHECK-MACOSX %s
74//
75// CHECK-MACOSX: clang
76// CHECK-MACOSX: "-cc1"
77// CHECK-MACOSX: "-triple" "x86_64-apple-macosx10.10.0"
78// CHECK-MACOSX: ld
79// CHECK-MACOSX: "-macosx_version_min" "10.10.0"