Daniel Dunbar | 455a049 | 2012-08-17 18:43:50 +0000 | [diff] [blame] | 1 | // 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 Dunbar | b254304 | 2013-01-15 20:33:56 +0000 | [diff] [blame] | 14 | // |
Daniel Dunbar | 455a049 | 2012-08-17 18:43:50 +0000 | [diff] [blame] | 15 | // 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 Dunbar | b254304 | 2013-01-15 20:33:56 +0000 | [diff] [blame] | 23 | |
| 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 Takumi | 6c8127c | 2013-01-16 06:10:16 +0000 | [diff] [blame] | 33 | // |
Yaron Keren | 1a06e6ab | 2015-07-15 09:41:04 +0000 | [diff] [blame] | 34 | // This test fails with MSYS or MSYS2 env.exe, since it does not preserve |
| 35 | // root, expanding / into C:/MINGW/MSYS/1.0 or c:/msys64. To reproduce the |
| 36 | // problem, run: |
Yaron Keren | 3c4c9fe | 2014-11-04 14:54:37 +0000 | [diff] [blame] | 37 | // |
Yaron Keren | ec740b3 | 2014-08-09 21:24:04 +0000 | [diff] [blame] | 38 | // env SDKROOT=/ cmd //c echo %SDKROOT% |
Yaron Keren | 3c4c9fe | 2014-11-04 14:54:37 +0000 | [diff] [blame] | 39 | // |
Yaron Keren | 1a06e6ab | 2015-07-15 09:41:04 +0000 | [diff] [blame] | 40 | // This test do pass using GnuWin32 env.exe. |
Steven Wu | 7a1372c | 2015-06-25 01:59:35 +0000 | [diff] [blame] | 41 | |
| 42 | // Check if clang set the correct deployment target from -sysroot |
| 43 | // |
| 44 | // RUN: rm -rf %t/SDKs/iPhoneOS8.0.0.sdk |
| 45 | // RUN: mkdir -p %t/SDKs/iPhoneOS8.0.0.sdk |
| 46 | // RUN: env SDKROOT=%t/SDKs/iPhoneOS8.0.0.sdk %clang -target arm64-apple-darwin %s -### 2>&1 \ |
| 47 | // RUN: | FileCheck --check-prefix=CHECK-IPHONE %s |
| 48 | // |
| 49 | // CHECK-IPHONE: clang |
| 50 | // CHECK-IPHONE: "-cc1" |
| 51 | // CHECK-IPHONE: "-triple" "arm64-apple-ios8.0.0" |
| 52 | // CHECK-IPHONE: ld |
| 53 | // CHECK-IPHONE: "-iphoneos_version_min" "8.0.0" |
| 54 | // |
| 55 | // |
| 56 | // RUN: rm -rf %t/SDKs/iPhoneSimulator8.0.sdk |
| 57 | // RUN: mkdir -p %t/SDKs/iPhoneSimulator8.0.sdk |
| 58 | // RUN: env SDKROOT=%t/SDKs/iPhoneSimulator8.0.sdk %clang -target x86_64-apple-darwin %s -### 2>&1 \ |
| 59 | // RUN: | FileCheck --check-prefix=CHECK-SIMULATOR %s |
| 60 | // |
| 61 | // CHECK-SIMULATOR: clang |
| 62 | // CHECK-SIMULATOR: "-cc1" |
Alex Lorenz | 6cdef0e | 2017-12-07 19:04:10 +0000 | [diff] [blame] | 63 | // CHECK-SIMULATOR: "-triple" "x86_64-apple-ios8.0.0-simulator" |
Steven Wu | 7a1372c | 2015-06-25 01:59:35 +0000 | [diff] [blame] | 64 | // CHECK-SIMULATOR: ld |
| 65 | // CHECK-SIMULATOR: "-ios_simulator_version_min" "8.0.0" |
| 66 | // |
| 67 | // RUN: rm -rf %t/SDKs/MacOSX10.10.0.sdk |
| 68 | // RUN: mkdir -p %t/SDKs/MacOSX10.10.0.sdk |
| 69 | // RUN: env SDKROOT=%t/SDKs/MacOSX10.10.0.sdk %clang -target x86_64-apple-darwin %s -### 2>&1 \ |
| 70 | // RUN: | FileCheck --check-prefix=CHECK-MACOSX %s |
| 71 | // |
| 72 | // CHECK-MACOSX: clang |
| 73 | // CHECK-MACOSX: "-cc1" |
| 74 | // CHECK-MACOSX: "-triple" "x86_64-apple-macosx10.10.0" |
| 75 | // CHECK-MACOSX: ld |
| 76 | // CHECK-MACOSX: "-macosx_version_min" "10.10.0" |