r329110 - [driver][darwin] Do not infer -simulator environment for non-simulator SDKs

Alex L via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 3 16:00:56 PDT 2018


On 3 April 2018 at 14:30, Chandler Carruth <chandlerc at gmail.com> wrote:

> On Tue, Apr 3, 2018 at 1:52 PM Alex Lorenz via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
>> Author: arphaman
>> Date: Tue Apr  3 13:50:05 2018
>> New Revision: 329110
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=329110&view=rev
>> Log:
>> [driver][darwin] Do not infer -simulator environment for non-simulator
>> SDKs
>>
>
> I know you added a REQUIRES line to these tests, but I think there is a
> much better way:
>
>
>> --- cfe/trunk/test/Driver/darwin-sdkroot.c (original)
>> +++ cfe/trunk/test/Driver/darwin-sdkroot.c Tue Apr  3 13:50:05 2018
>> @@ -51,12 +51,21 @@
>>  // CHECK-IPHONE: "-triple" "arm64-apple-ios8.0.0"
>>  // CHECK-IPHONE: ld
>>  // CHECK-IPHONE: "-iphoneos_version_min" "8.0.0"
>> +// RUN: env SDKROOT=%t/SDKs/iPhoneOS8.0.0.sdk %clang %s -### 2>&1 \
>>
>
> Instead of just running %clang, actually pass the `-target` you want to it
> like we do in the below invocation and the other invocations in this file.
>
> We shouldn't lose driver testing on other systems as long as you can
> specify the desired target.
>


Hi Chandler!

Thanks for pointing this out! We actually can't use -target here because
when -target is specified, Darwin's driver won't infer the triple's
environment from the SDKROOT. So this test covers the path in the driver
that won't be taken when -target is specified.

You've made a good point about losing testing though. I can split out this
test into the original file (with -target use) and the new tests which
can't use -target and are Darwin specific to ensure we won't loose the
existing coverage. I will commit a follow-up commit that does this.

Cheers,
Alex




>
>
>> +// RUN:   | FileCheck --check-prefix=CHECK-IPHONE-X86 %s
>> +// CHECK-IPHONE-X86: clang
>> +// CHECK-IPHONE-X86: "-cc1"
>> +// CHECK-IPHONE-X86: -apple-ios8.0.0"
>> +// CHECK-IPHONE-X86: ld
>> +// CHECK-IPHONE-X86: "-iphoneos_version_min" "8.0.0"
>>  //
>>  //
>>  // RUN: rm -rf %t/SDKs/iPhoneSimulator8.0.sdk
>>  // RUN: mkdir -p %t/SDKs/iPhoneSimulator8.0.sdk
>>  // RUN: env SDKROOT=%t/SDKs/iPhoneSimulator8.0.sdk %clang -target
>> x86_64-apple-darwin %s -### 2>&1 \
>>  // RUN:   | FileCheck --check-prefix=CHECK-SIMULATOR %s
>> +// RUN: env SDKROOT=%t/SDKs/iPhoneSimulator8.0.sdk %clang -arch x86_64
>> %s -### 2>&1 \
>> +// RUN:   | FileCheck --check-prefix=CHECK-SIMULATOR %s
>>  //
>>  // CHECK-SIMULATOR: clang
>>  // CHECK-SIMULATOR: "-cc1"
>> @@ -74,3 +83,49 @@
>>  // CHECK-MACOSX: "-triple" "x86_64-apple-macosx10.10.0"
>>  // CHECK-MACOSX: ld
>>  // CHECK-MACOSX: "-macosx_version_min" "10.10.0"
>> +
>> +// RUN: rm -rf %t/SDKs/WatchOS3.0.sdk
>> +// RUN: mkdir -p %t/SDKs/WatchOS3.0.sdk
>> +// RUN: env SDKROOT=%t/SDKs/WatchOS3.0.sdk %clang %s -### 2>&1 \
>> +// RUN:   | FileCheck --check-prefix=CHECK-WATCH %s
>> +//
>> +// CHECK-WATCH: clang
>> +// CHECK-WATCH: "-cc1"
>> +// CHECK-WATCH: -apple-watchos3.0.0"
>> +// CHECK-WATCH: ld
>> +// CHECK-WATCH: "-watchos_version_min" "3.0.0"
>> +//
>> +//
>> +// RUN: rm -rf %t/SDKs/WatchSimulator3.0.sdk
>> +// RUN: mkdir -p %t/SDKs/WatchSimulator3.0.sdk
>> +// RUN: env SDKROOT=%t/SDKs/WatchSimulator3.0.sdk %clang %s -### 2>&1 \
>> +// RUN:   | FileCheck --check-prefix=CHECK-WATCH-SIMULATOR %s
>> +//
>> +// CHECK-WATCH-SIMULATOR: clang
>> +// CHECK-WATCH-SIMULATOR: "-cc1"
>> +// CHECK-WATCH-SIMULATOR: -apple-watchos3.0.0-simulator"
>> +// CHECK-WATCH-SIMULATOR: ld
>> +// CHECK-WATCH-SIMULATOR: "-watchos_simulator_version_min" "3.0.0"
>> +
>> +// RUN: rm -rf %t/SDKs/AppleTVOS10.0.sdk
>> +// RUN: mkdir -p %t/SDKs/AppleTVOS10.0.sdk
>> +// RUN: env SDKROOT=%t/SDKs/AppleTVOS10.0.sdk %clang %s -### 2>&1 \
>> +// RUN:   | FileCheck --check-prefix=CHECK-TV %s
>> +//
>> +// CHECK-TV: clang
>> +// CHECK-TV: "-cc1"
>> +// CHECK-TV: -apple-tvos10.0.0"
>> +// CHECK-TV: ld
>> +// CHECK-TV: "-tvos_version_min" "10.0.0"
>> +//
>> +//
>> +// RUN: rm -rf %t/SDKs/AppleTVSimulator10.0.sdk
>> +// RUN: mkdir -p %t/SDKs/AppleTVSimulator10.0.sdk
>> +// RUN: env SDKROOT=%t/SDKs/AppleTVSimulator10.0.sdk %clang %s -###
>> 2>&1 \
>> +// RUN:   | FileCheck --check-prefix=CHECK-TV-SIMULATOR %s
>> +//
>> +// CHECK-TV-SIMULATOR: clang
>> +// CHECK-TV-SIMULATOR: "-cc1"
>> +// CHECK-TV-SIMULATOR: -apple-tvos10.0.0-simulator"
>> +// CHECK-TV-SIMULATOR: ld
>> +// CHECK-TV-SIMULATOR: "-tvos_simulator_version_min" "10.0.0"
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180403/38bfa67d/attachment-0001.html>


More information about the cfe-commits mailing list