|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: mkdir -p %t/sdk/usr/lib/swift/Normal.swiftmodule |
| 3 | +// RUN: mkdir -p %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule |
| 4 | + |
| 5 | +// RUN: echo 'public func normal() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name -emit-module -o /dev/null -module-name Normal |
| 6 | +// RUN: echo 'public func flat() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Flat.swiftinterface -emit-module -o /dev/null -module-name Flat |
| 7 | +// RUN: echo 'public func fmwk() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/%target-swiftinterface-name -emit-module -o /dev/null -module-name FMWK |
| 8 | + |
| 9 | +// RUN: %swift_build_sdk_interfaces -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -v -o %t/prebuilt |
| 10 | +// RUN: ls %t/prebuilt | %FileCheck %s |
| 11 | +// CHECK-DAG: Normal.swiftmodule |
| 12 | +// CHECK-DAG: Flat.swiftmodule |
| 13 | +// CHECK-DAG: FMWK.swiftmodule |
| 14 | + |
| 15 | +// RUN: env SWIFT_OVERLOAD_PREBUILT_MODULE_CACHE_PATH=%t/prebuilt %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -module-cache-path %t/MCP |
| 16 | +// RUN: %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/*.swiftmodule |
| 17 | + |
| 18 | +// Touch a file in the SDK (to make it look like it changed) and try again. |
| 19 | +// This should still be able to use the prebuilt modules because they track |
| 20 | +// content hashes, not just size+mtime. |
| 21 | +// RUN: rm -rf %t/MCP |
| 22 | +// RUN: %{python} %S/../ModuleCache/Inputs/make-old.py %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name |
| 23 | +// RUN: env SWIFT_OVERLOAD_PREBUILT_MODULE_CACHE_PATH=%t/prebuilt %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -module-cache-path %t/MCP |
| 24 | +// RUN: ls %t/MCP/*.swiftmodule | %FileCheck -check-prefix CHECK-CACHE %s |
| 25 | +// RUN: %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/*.swiftmodule |
| 26 | + |
| 27 | +// CHECK-CACHE-DAG: Normal-{{.+}}.swiftmodule |
| 28 | +// CHECK-CACHE-DAG: Flat-{{.+}}.swiftmodule |
| 29 | +// CHECK-CACHE-DAG: FMWK-{{.+}}.swiftmodule |
| 30 | + |
| 31 | +// Actually change a file in the SDK, to check that we're tracking dependencies |
| 32 | +// at all. |
| 33 | +// RUN: rm -rf %t/MCP |
| 34 | +// RUN: echo "public func another()" >> %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name |
| 35 | +// RUN: env SWIFT_OVERLOAD_PREBUILT_MODULE_CACHE_PATH=%t/prebuilt %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -module-cache-path %t/MCP |
| 36 | +// RUN: ls %t/MCP/*.swiftmodule | %FileCheck -check-prefix CHECK-CACHE %s |
| 37 | +// RUN: not %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/Normal-*.swiftmodule |
| 38 | +// RUN: %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/Flat-*.swiftmodule |
| 39 | +// RUN: %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/FMWK-*.swiftmodule |
| 40 | + |
| 41 | +// Without the prebuilt cache everything should still work; it'll just take time |
| 42 | +// because we have to build the interfaces. |
| 43 | +// RUN: rm -rf %t/MCP |
| 44 | +// RUN: %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -module-cache-path %t/MCP |
| 45 | +// RUN: ls %t/MCP/*.swiftmodule | %FileCheck -check-prefix CHECK-CACHE %s |
| 46 | +// RUN: not %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/Normal-*.swiftmodule |
| 47 | +// RUN: not %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/Flat-*.swiftmodule |
| 48 | +// RUN: not %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/FMWK-*.swiftmodule |
| 49 | + |
| 50 | + |
| 51 | +import Normal |
| 52 | +import Flat |
| 53 | +import FMWK |
| 54 | + |
| 55 | +func test() { |
| 56 | + normal() |
| 57 | + flat() |
| 58 | + fmwk() |
| 59 | +} |
0 commit comments