File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
test/ParseableInterface/ModuleCache Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ //
3
+ // Test will build a module TestModule that depends on OtherModule and LeafModule (built from other.swift and leaf.swift).
4
+ //
5
+ // RUN: echo 'public func LeafFunc() -> Int { return 10; }' >%t/leaf.swift
6
+ //
7
+ // RUN: echo 'import LeafModule' >%t/other.swift
8
+ // RUN: echo 'public func OtherFunc() -> Int { return LeafFunc(); }' >>%t/other.swift
9
+ //
10
+ // Phase 1: build LeafModule into a .swiftinterface file with -swift-version 4:
11
+ //
12
+ // RUN: %target-swift-frontend -swift-version 4 -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -typecheck
13
+ //
14
+ // Phase 2: build OtherModule into a .swiftinterface file with -swift-version 4.2:
15
+ //
16
+ // RUN: %target-swift-frontend -swift-version 4.2 -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -enable-parseable-module-interface -typecheck
17
+ //
18
+ // Phase 3: build TestModule in -swift-version 5 and import both of these:
19
+ //
20
+ // RUN: %target-swift-frontend -swift-version 5 -I %t -module-cache-path %t/modulecache -module-name TestModule %s -enable-parseable-module-interface -typecheck
21
+ //
22
+ // Phase 4: make sure we only compiled LeafModule and OtherModule one time:
23
+ //
24
+ // RUN: NUM_LEAF_MODULES=$(find %t/modulecache -type f -name 'LeafModule-*.swiftmodule' | wc -l)
25
+ // RUN: NUM_OTHER_MODULES=$(find %t/modulecache -type f -name 'OtherModule-*.swiftmodule' | wc -l)
26
+ // RUN: if [ ! $NUM_LEAF_MODULES -eq 1 ]; then echo "Should only be 1 LeafModule, found $NUM_LEAF_MODULES"; exit 1; fi
27
+ // RUN: if [ ! $NUM_OTHER_MODULES -eq 1 ]; then echo "Should only be 1 OtherModule, found $NUM_OTHER_MODULES"; exit 1; fi
28
+ import LeafModule
29
+ import OtherModule
You can’t perform that action at this time.
0 commit comments