|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: %empty-directory(%t/cache) |
| 3 | +// RUN: %empty-directory(%t/idx) |
| 4 | +// RUN: %empty-directory(%t/sdk) |
| 5 | +// RUN: split-file %s %t |
| 6 | + |
| 7 | +/// Create a Swift module to import. |
| 8 | +// RUN: cp %t/module.modulemap %t/sdk/ |
| 9 | +// RUN: %target-swift-frontend -emit-module \ |
| 10 | +// RUN: -enable-library-evolution -swift-version 5 \ |
| 11 | +// RUN: -emit-module-path %t/sdk/LocalSystemModule.swiftmodule \ |
| 12 | +// RUN: -emit-module-interface-path %t/sdk/LocalSystemModule.swiftinterface \ |
| 13 | +// RUN: %t/LocalSystemModule.swift -I %t/sdk \ |
| 14 | +// RUN: -enable-testing |
| 15 | + |
| 16 | +/// Build a test client once with indexing, not setting an SDK. |
| 17 | +// RUN: %target-swift-frontend -typecheck %t/TestClient.swift \ |
| 18 | +// RUN: -I %t/sdk -module-cache-path %t/cache \ |
| 19 | +// RUN: -index-system-modules \ |
| 20 | +// RUN: -index-store-path %t/idx \ |
| 21 | +// RUN: -index-ignore-stdlib \ |
| 22 | +// RUN: -sdk %t/someothersdk -Rmodule-loading 2>&1 \ |
| 23 | +// RUN: | %FileCheck -check-prefix=CHECK-SWIFTMODULE %s |
| 24 | +// CHECK-SWIFTMODULE: source: '{{.*}}LocalSystemModule.swiftmodule' |
| 25 | + |
| 26 | +/// Build the test client again not setting an SDK, this one should still use |
| 27 | +/// the adjacent module that is built for testing. |
| 28 | +// RUN: %target-swift-frontend -typecheck %t/TestClient.swift \ |
| 29 | +// RUN: -I %t/sdk -module-cache-path %t/cache \ |
| 30 | +// RUN: -sdk %t/someothersdk -Rmodule-loading 2>&1 \ |
| 31 | +// RUN: | %FileCheck -check-prefix=CHECK-SWIFTMODULE %s |
| 32 | + |
| 33 | +/// @testable import of a module in the SDK works once but not after it's cached. |
| 34 | +// RUN: %empty-directory(%t/idx) |
| 35 | +// RUN: %target-swift-frontend -typecheck %t/TestClient.swift \ |
| 36 | +// RUN: -I %t/sdk -module-cache-path %t/cache \ |
| 37 | +// RUN: -index-system-modules \ |
| 38 | +// RUN: -index-store-path %t/idx \ |
| 39 | +// RUN: -index-ignore-stdlib \ |
| 40 | +// RUN: -sdk %t/sdk -Rmodule-loading 2>&1 \ |
| 41 | +// RUN: | %FileCheck -check-prefix=CHECK-SWIFTMODULE %s |
| 42 | + |
| 43 | +/// Failing case when building against the cached swiftmodule. |
| 44 | +// RUN: %target-swift-frontend -typecheck %t/TestClient.swift \ |
| 45 | +// RUN: -I %t/sdk -module-cache-path %t/cache \ |
| 46 | +// RUN: -sdk %t/sdk -Rmodule-loading \ |
| 47 | +// RUN: -verify -verify-ignore-unknown -show-diagnostics-after-fatal 2>&1 |
| 48 | + |
| 49 | +//--- module.modulemap |
| 50 | + |
| 51 | +module LocalSystemModule [system] { } |
| 52 | + |
| 53 | +//--- LocalSystemModule.swift |
| 54 | + |
| 55 | +@_exported import LocalSystemModule |
| 56 | + |
| 57 | +//--- TestClient.swift |
| 58 | + |
| 59 | +@testable import LocalSystemModule // expected-error {{module 'LocalSystemModule' was not compiled for testing}} |
| 60 | +// expected-remark @-1 {{LocalSystemModule.swiftinterface}} |
0 commit comments