67 lines · plain
1// RUN: rm -rf %t2 3// Set up directories4// RUN: mkdir -p %t/APINotes5// RUN: cp %S/Inputs/APINotes/SomeOtherKit.apinotes %t/APINotes/SomeOtherKit.apinotes6// RUN: mkdir -p %t/Frameworks7// RUN: cp -r %S/Inputs/Frameworks/SomeOtherKit.framework %t/Frameworks8 9// First build: check that 'methodB' is unavailable but 'methodA' is available.10// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -Rmodule-build -fmodules-cache-path=%t/ModulesCache -iapinotes-modules %t/APINotes -F %t/Frameworks %s > %t/before.log 2>&111// RUN: FileCheck -check-prefix=CHECK-METHODB %s < %t/before.log12// RUN: FileCheck -check-prefix=CHECK-REBUILD %s < %t/before.log13// RUN: FileCheck -check-prefix=CHECK-ONE-ERROR %s < %t/before.log14 15// Do it again; now we're using caches.16// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -Rmodule-build -fmodules-cache-path=%t/ModulesCache -iapinotes-modules %t/APINotes -F %t/Frameworks %s > %t/before.log 2>&117// RUN: FileCheck -check-prefix=CHECK-METHODB %s < %t/before.log18// RUN: FileCheck -check-prefix=CHECK-WITHOUT-REBUILD %s < %t/before.log19// RUN: FileCheck -check-prefix=CHECK-ONE-ERROR %s < %t/before.log20 21// Add a blank line to the header to force the module to rebuild, without22// (yet) changing API notes.23// RUN: echo >> %t/Frameworks/SomeOtherKit.framework/Headers/SomeOtherKit.h24// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -Rmodule-build -fmodules-cache-path=%t/ModulesCache -iapinotes-modules %t/APINotes -F %t/Frameworks %s > %t/before.log 2>&125// RUN: FileCheck -check-prefix=CHECK-METHODB %s < %t/before.log26// RUN: FileCheck -check-prefix=CHECK-REBUILD %s < %t/before.log27// RUN: FileCheck -check-prefix=CHECK-ONE-ERROR %s < %t/before.log28 29// Change the API notes file, after the module has rebuilt once.30// RUN: chmod u+w %t/APINotes/SomeOtherKit.apinotes31// RUN: echo ' - Selector: "methodA"' >> %t/APINotes/SomeOtherKit.apinotes32// RUN: echo ' MethodKind: Instance' >> %t/APINotes/SomeOtherKit.apinotes33// RUN: echo ' Availability: none' >> %t/APINotes/SomeOtherKit.apinotes34// RUN: echo ' AvailabilityMsg: "not here either"' >> %t/APINotes/SomeOtherKit.apinotes35 36// Build again: check that both methods are now unavailable and that the module rebuilt.37// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -Rmodule-build -fmodules-cache-path=%t/ModulesCache -iapinotes-modules %t/APINotes -F %t/Frameworks %s > %t/after.log 2>&138// RUN: FileCheck -check-prefix=CHECK-METHODA %s < %t/after.log39// RUN: FileCheck -check-prefix=CHECK-METHODB %s < %t/after.log40// RUN: FileCheck -check-prefix=CHECK-REBUILD %s < %t/after.log41// RUN: FileCheck -check-prefix=CHECK-TWO-ERRORS %s < %t/after.log42 43// Run the build again: check that both methods are now unavailable44// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -Rmodule-build -fmodules-cache-path=%t/ModulesCache -iapinotes-modules %t/APINotes -F %t/Frameworks %s > %t/after.log 2>&145// RUN: FileCheck -check-prefix=CHECK-METHODA %s < %t/after.log46// RUN: FileCheck -check-prefix=CHECK-METHODB %s < %t/after.log47// RUN: FileCheck -check-prefix=CHECK-WITHOUT-REBUILD %s < %t/after.log48// RUN: FileCheck -check-prefix=CHECK-TWO-ERRORS %s < %t/after.log49 50@import SomeOtherKit;51 52void test(A *a) {53 // CHECK-METHODA: error: 'methodA' is unavailable: not here either54 [a methodA];55 56 // CHECK-METHODB: error: 'methodB' is unavailable: anything but this57 [a methodB];58}59 60// CHECK-REBUILD: remark: building module{{.*}}SomeOtherKit61 62// CHECK-WITHOUT-REBUILD-NOT: remark: building module{{.*}}SomeOtherKit63 64// CHECK-ONE-ERROR: 1 error generated.65// CHECK-TWO-ERRORS: 2 errors generated.66 67