Skip to content

Commit 0ea7ee8

Browse files
committed
Tests: Upstream default-prebuilt-module-location-maccatalyst.swift.
1 parent a9667af commit 0ea7ee8

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Like default-prebuilt-module-location.swift, but for macCatalyst specifically.
2+
3+
// REQUIRES: OS=macosx
4+
5+
// 1. Create folders for a) our Swift module, b) the module cache, and c) a
6+
// fake resource dir with a default prebuilt module cache inside.
7+
// RUN: %empty-directory(%t/PrebuiltModule.swiftmodule)
8+
// RUN: %empty-directory(%t/ModuleCache)
9+
// RUN: %empty-directory(%t/ResourceDir/macosx/prebuilt-modules/PrebuiltModule.swiftmodule)
10+
11+
// 2. Define some public API
12+
// RUN: echo 'public struct InPrebuiltModule {}' > %t/PrebuiltModule.swift
13+
14+
// 3. Compile this into a module and put it into the default prebuilt cache
15+
// location relative to the fake resource dir. Also drop an interface into
16+
// the build dir.
17+
// RUN: %target-swift-frontend -target %target-cpu-apple-ios13.1-macabi -emit-module %t/PrebuiltModule.swift -o %t/ResourceDir/macosx/prebuilt-modules/PrebuiltModule.swiftmodule/%target-cpu.swiftmodule -module-name PrebuiltModule -parse-stdlib -emit-module-interface-path %t/PrebuiltModule.swiftmodule/%target-cpu.swiftinterface
18+
19+
// 4. Import this prebuilt module, but DON'T pass in -prebuilt-module-cache-path, it should use the implicit one.
20+
// RUN: %target-swift-frontend -target %target-cpu-apple-ios13.1-macabi -typecheck -resource-dir %t/ResourceDir -I %t %s -parse-stdlib -module-cache-path %t/ModuleCache -sdk %t
21+
22+
// 5. Make sure we installed a forwarding module in the module cache.
23+
// RUN: %{python} %S/ModuleCache/Inputs/check-is-forwarding-module.py %t/ModuleCache/PrebuiltModule-*.swiftmodule
24+
25+
import PrebuiltModule
26+
27+
func x<T>(_ x: T) {}
28+
29+
x(InPrebuiltModule.self)

0 commit comments

Comments
 (0)