|
1 | 1 | // RUN: %empty-directory(%t)
|
2 | 2 | // RUN: %empty-directory(%t/modulecache)
|
3 |
| -// RUN: %target-swift-frontend -enable-resilience -emit-parseable-module-interface-path %t/TestModule.swiftinterface -module-name TestModule %S/Inputs/other.swift -emit-module -o /dev/null |
4 |
| -// RUN: test -f %t/TestModule.swiftinterface |
5 |
| -// RUN: %target-swift-frontend -typecheck -enable-parseable-module-interface -module-cache-path %t/modulecache -I %t %s |
| 3 | +// |
| 4 | +// Test will build a module TestModule that depends on OtherModule and LeafModule (built from other.swift and leaf.swift). |
| 5 | +// |
| 6 | +// RUN: echo 'public func LeafFunc() -> Int { return 10; }' >%t/leaf.swift |
| 7 | +// |
| 8 | +// RUN: echo 'import LeafModule' >%t/other.swift |
| 9 | +// RUN: echo 'public func OtherFunc() -> Int { return LeafFunc(); }' >>%t/other.swift |
| 10 | +// |
| 11 | +// Both inputs are initially set to modification-time 201401240005. Subsequent derived files will be |
| 12 | +// touched to have timestamps 1 minute forward each (i.e. minutes 06, 07, 08) |
| 13 | +// |
| 14 | +// RUN: touch -t 201401240005 %t/leaf.swift |
| 15 | +// RUN: touch -t 201401240005 %t/other.swift |
| 16 | +// |
| 17 | +// |
| 18 | +// Phase 1: build LeafModule into a .swiftinterface file: |
| 19 | +// |
| 20 | +// RUN: %target-swift-frontend -I %t -emit-parseable-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null |
| 21 | +// RUN: test -f %t/LeafModule.swiftinterface |
| 22 | +// RUN: %FileCheck %s -check-prefix=CHECK-LEAFINTERFACE <%t/LeafModule.swiftinterface |
| 23 | +// CHECK-LEAFINTERFACE: LeafFunc |
| 24 | +// RUN: touch -t 201401240006 %t/LeafModule.swiftinterface |
| 25 | +// |
| 26 | +// |
| 27 | +// Phase 2: build OtherModule into a .swiftinterface _using_ LeafModule via LeafModule.swiftinterface, creating LeafModule-*.swiftmodule along the way. |
| 28 | +// |
| 29 | +// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null |
| 30 | +// RUN: test -f %t/OtherModule.swiftinterface |
| 31 | +// RUN: %FileCheck %s -check-prefix=CHECK-OTHERINTERFACE <%t/OtherModule.swiftinterface |
| 32 | +// CHECK-OTHERINTERFACE: OtherFunc |
| 33 | +// RUN: test -f %t/modulecache/LeafModule-*.swiftmodule |
| 34 | +// RUN: llvm-bcanalyzer -dump %t/modulecache/LeafModule-*.swiftmodule | %FileCheck %s -check-prefix=CHECK-LEAFMODULE |
| 35 | +// CHECK-LEAFMODULE: {{MODULE_NAME.*blob data = 'LeafModule'}} |
| 36 | +// CHECK-LEAFMODULE: {{FILE_DEPENDENCY.*Swift.swiftmodule'}} |
| 37 | +// CHECK-LEAFMODULE: {{FILE_DEPENDENCY.*SwiftOnoneSupport.swiftmodule'}} |
| 38 | +// CHECK-LEAFMODULE: {{FILE_DEPENDENCY.*LeafModule.swiftinterface'}} |
| 39 | +// CHECK-LEAFMODULE: FUNC_DECL |
| 40 | +// RUN: touch -t 201401240007 %t/modulecache/LeafModule-*.swiftmodule |
| 41 | +// RUN: touch -t 201401240007 %t/OtherModule.swiftinterface |
| 42 | +// |
| 43 | +// |
| 44 | +// Phase 3: build TestModule into a .swiftmodule explicitly us OtherModule via OtherModule.swiftinterface, creating OtherModule-*.swiftmodule along the way. |
| 45 | +// |
| 46 | +// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s |
| 47 | +// RUN: test -f %t/TestModule.swiftmodule |
| 48 | +// RUN: test -f %t/modulecache/OtherModule-*.swiftmodule |
| 49 | +// RUN: llvm-bcanalyzer -dump %t/modulecache/OtherModule-*.swiftmodule | %FileCheck %s -check-prefix=CHECK-OTHERMODULE |
| 50 | +// CHECK-OTHERMODULE: {{MODULE_NAME.*blob data = 'OtherModule'}} |
| 51 | +// CHECK-OTHERMODULE: {{FILE_DEPENDENCY.*Swift.swiftmodule'}} |
| 52 | +// CHECK-OTHERMODULE: {{FILE_DEPENDENCY.*SwiftOnoneSupport.swiftmodule'}} |
| 53 | +// CHECK-OTHERMODULE: {{FILE_DEPENDENCY.*LeafModule-.*.swiftmodule'}} |
| 54 | +// CHECK-OTHERMODULE: {{FILE_DEPENDENCY.*OtherModule.swiftinterface'}} |
| 55 | +// CHECK-OTHERMODULE: FUNC_DECL |
| 56 | +// RUN: touch -t 201401240008 %t/modulecache/OtherModule-*.swiftmodule |
| 57 | +// RUN: touch -t 201401240008 %t/TestModule.swiftmodule |
| 58 | +// |
| 59 | +// |
| 60 | +// Phase 4: Same command as in phase 3, but check that none of the cached modules are rebuilt. |
| 61 | +// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s |
| 62 | +// RUN: touch -t 201401240008 %t/TestModule.swiftmodule |
| 63 | +// RUN: test ! %t/TestModule.swiftmodule -ot %t/modulecache/OtherModule-*.swiftmodule |
| 64 | +// RUN: test ! %t/TestModule.swiftmodule -ot %t/modulecache/LeafModule-*.swiftmodule |
| 65 | +// |
| 66 | +// |
| 67 | +// Phase 5: change the mtime on LeafModule.swiftinterface and watch LeafModule-*.swiftmodule and OtherModule-*.swiftmodule recompile. |
| 68 | +// RUN: touch -t 201401240016 %t/LeafModule.swiftinterface |
| 69 | +// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s |
| 70 | +// RUN: test %t/LeafModule.swiftinterface -ot %t/modulecache/LeafModule-*.swiftmodule |
| 71 | +// RUN: test %t/LeafModule.swiftinterface -ot %t/modulecache/OtherModule-*.swiftmodule |
| 72 | +// |
| 73 | +// |
| 74 | +// Phase 6: change the mtimes on LeafModule-*.swiftmodule and OtherModule.swiftinterface, and watch just OtherModule-*.swiftmodule recompile, leaving LeafModule-*.swiftmodule alone. |
| 75 | +// RUN: touch -t 201401240016 %t/modulecache/LeafModule-*.swiftmodule |
| 76 | +// RUN: touch -t 201401240017 %t/OtherModule.swiftinterface |
| 77 | +// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s |
| 78 | +// RUN: test ! %t/OtherModule.swiftinterface -ot %t/modulecache/LeafModule-*.swiftmodule |
| 79 | +// RUN: test %t/OtherModule.swiftinterface -ot %t/modulecache/OtherModule-*.swiftmodule |
| 80 | +// |
| 81 | +// |
| 82 | +// Phase 7: change the size on LeafModule.swiftinterface (keeping mtime fixed) and watch LeafModule-*.swiftmodule and OtherModule-*.swiftmodule recompile. |
| 83 | +// RUN: touch -t 201401240017 %t/modulecache/OtherModule-*.swiftmodule |
| 84 | +// RUN: echo '// size change' >>%t/LeafModule.swiftinterface |
| 85 | +// RUN: touch -t 201401240016 %t/LeafModule.swiftinterface |
| 86 | +// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s |
| 87 | +// RUN: test %t/LeafModule.swiftinterface -ot %t/modulecache/LeafModule-*.swiftmodule |
| 88 | +// RUN: test %t/LeafModule.swiftinterface -ot %t/modulecache/OtherModule-*.swiftmodule |
6 | 89 |
|
7 |
| -// RUN: test -f %t/modulecache/TestModule-*.swiftmodule |
8 |
| -// RUN: test ! %t/modulecache/TestModule-*.swiftmodule -ot %t/TestModule.swiftinterface |
9 |
| -// RUN: llvm-bcanalyzer -dump %t/modulecache/TestModule-*.swiftmodule | %FileCheck %s -check-prefix=CHECK-SWIFTMODULE |
| 90 | +import OtherModule |
10 | 91 |
|
11 |
| -// CHECK-SWIFTMODULE: {{MODULE_NAME.*blob data = 'TestModule'}} |
12 |
| -// CHECK-SWIFTMODULE: {{FILE_DEPENDENCY.*Swift.swiftmodule'}} |
13 |
| -// CHECK-SWIFTMODULE: FUNC_DECL |
14 |
| -// CHECK-SWIFTMODULE: RESILIENCE_STRATEGY |
15 |
| - |
16 |
| -import TestModule |
17 |
| -func foo() { |
18 |
| - otherFileFunction() |
| 92 | +public func TestFunc() { |
| 93 | + print(OtherFunc()) |
19 | 94 | }
|
0 commit comments