|
46 | 46 | // RUN: %target-codesign %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2)
|
47 | 47 | // RUN: %target-run %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2)
|
48 | 48 |
|
| 49 | +/////////////////////////////////////////////////////////////////////////////// |
| 50 | +// Now repeat all of the same tests, but with library evolution enabled: |
| 51 | +/////////////////////////////////////////////////////////////////////////////// |
| 52 | + |
| 53 | +// RUN: %empty-directory(%t) |
| 54 | +// RUN: %target-build-swift-dylib(%t/%target-library-name(Module1)) -DMODULE -module-name Module1 -emit-module -emit-module-path %t/Module1.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift -enable-library-evolution |
| 55 | +// RUN: %target-build-swift-dylib(%t/%target-library-name(Module2)) -I%t -L%t -lModule1 %target-rpath(%t) -DMODULE2 -module-name Module2 -emit-module -emit-module-path %t/Module2.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift -DEVOLUTION |
| 56 | +// RUN: %target-build-swift -I%t -L%t -lModule1 -DMAIN -o %t/main %target-rpath(%t) %s -swift-version 5 -DEVOLUTION |
| 57 | +// RUN: %target-codesign %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2) |
| 58 | +// RUN: %target-run %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2) |
| 59 | + |
| 60 | +// Now the same in optimized mode. |
| 61 | +// RUN: %empty-directory(%t) |
| 62 | +// RUN: %target-build-swift-dylib(%t/%target-library-name(Module1)) -O -DMODULE -module-name Module1 -emit-module -emit-module-path %t/Module1.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift -enable-library-evolution |
| 63 | +// RUN: %target-build-swift-dylib(%t/%target-library-name(Module2)) -O -I%t -L%t -lModule1 %target-rpath(%t) -DMODULE2 -module-name Module2 -emit-module -emit-module-path %t/Module2.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift -DEVOLUTION |
| 64 | +// RUN: %target-build-swift -O -I%t -L%t -lModule1 -DMAIN -o %t/main %target-rpath(%t) %s -swift-version 5 -DEVOLUTION |
| 65 | +// RUN: %target-codesign %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2) |
| 66 | +// RUN: %target-run %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2) |
| 67 | + |
| 68 | +// Now the same in size mode. |
| 69 | +// RUN: %empty-directory(%t) |
| 70 | +// RUN: %target-build-swift-dylib(%t/%target-library-name(Module1)) -Osize -DMODULE -module-name Module1 -emit-module -emit-module-path %t/Module1.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift -enable-library-evolution |
| 71 | +// RUN: %target-build-swift-dylib(%t/%target-library-name(Module2)) -Osize -I%t -L%t -lModule1 %target-rpath(%t) -DMODULE2 -module-name Module2 -emit-module -emit-module-path %t/Module2.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift -DEVOLUTION |
| 72 | +// RUN: %target-build-swift -Osize -I%t -L%t -lModule1 -DMAIN -o %t/main %target-rpath(%t) %s -swift-version 5 -DEVOLUTION |
| 73 | +// RUN: %target-codesign %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2) |
| 74 | +// RUN: %target-run %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2) |
| 75 | + |
| 76 | +// Now the same in optimized wholemodule mode. |
| 77 | +// RUN: %empty-directory(%t) |
| 78 | +// RUN: %target-build-swift-dylib(%t/%target-library-name(Module1)) -O -wmo -DMODULE -module-name Module1 -emit-module -emit-module-path %t/Module1.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift -enable-library-evolution |
| 79 | +// RUN: %target-build-swift-dylib(%t/%target-library-name(Module2)) -O -wmo -I%t -L%t -lModule1 %target-rpath(%t) -DMODULE2 -module-name Module2 -emit-module -emit-module-path %t/Module2.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift -DEVOLUTION |
| 80 | +// RUN: %target-build-swift -O -wmo -I%t -L%t -lModule1 -DMAIN -o %t/main %target-rpath(%t) %s -swift-version 5 -DEVOLUTION |
| 81 | +// RUN: %target-codesign %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2) |
| 82 | +// RUN: %target-run %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2) |
| 83 | + |
| 84 | +// Test the -enable-implicit-dynamic flag. |
| 85 | + |
| 86 | +// RUN: %empty-directory(%t) |
| 87 | +// RUN: %target-build-swift-dylib(%t/%target-library-name(Module1)) -DMODULENODYNAMIC -module-name Module1 -emit-module -emit-module-path %t/Module1.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift -Xfrontend -enable-implicit-dynamic -enable-library-evolution |
| 88 | +// RUN: %target-build-swift-dylib(%t/%target-library-name(Module2)) -I%t -L%t -lModule1 %target-rpath(%t) -DMODULE2 -module-name Module2 -emit-module -emit-module-path %t/Module2.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift -DEVOLUTION |
| 89 | +// RUN: %target-build-swift -I%t -L%t -lModule1 -DMAIN -o %t/main %target-rpath(%t) %s -swift-version 5 -DEVOLUTION |
| 90 | +// RUN: %target-codesign %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2) |
| 91 | +// RUN: %target-run %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2) |
| 92 | + |
| 93 | +// Test the -enable-implicit-dynamic flag in optimized wholemodule mode. |
| 94 | +// RUN: %empty-directory(%t) |
| 95 | +// RUN: %target-build-swift-dylib(%t/%target-library-name(Module1)) -O -wmo -DMODULENODYNAMIC -module-name Module1 -emit-module -emit-module-path %t/Module1.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift -Xfrontend -enable-implicit-dynamic -enable-library-evolution |
| 96 | +// RUN: %target-build-swift-dylib(%t/%target-library-name(Module2)) -O -wmo -I%t -L%t -lModule1 %target-rpath(%t) -DMODULE2 -module-name Module2 -emit-module -emit-module-path %t/Module2.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift -DEVOLUTION |
| 97 | +// RUN: %target-build-swift -O -wmo -I%t -L%t -lModule1 -DMAIN -o %t/main %target-rpath(%t) %s -swift-version 5 -DEVOLUTION |
| 98 | +// RUN: %target-codesign %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2) |
| 99 | +// RUN: %target-run %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2) |
| 100 | + |
49 | 101 |
|
50 | 102 | // REQUIRES: executable_test
|
51 | 103 |
|
@@ -82,8 +134,13 @@ func checkExpectedResults(forOriginalLibrary useOrig: Bool) {
|
82 | 134 | expectTrue(public_global_generic_func(Int.self) ==
|
83 | 135 | expectedResult(useOrig, "public_global_generic_func"))
|
84 | 136 |
|
| 137 | + // Designated initializers of resilient classes cannot be |
| 138 | + // dynamically replaced. |
| 139 | +#if !EVOLUTION |
85 | 140 | expectTrue(PublicClass(x: 0).str ==
|
86 | 141 | expectedResult(useOrig, "public_class_init"))
|
| 142 | +#endif |
| 143 | + |
87 | 144 | expectTrue(PublicClass().function() ==
|
88 | 145 | expectedResult(useOrig, "public_class_func"))
|
89 | 146 | expectTrue(PublicClass().finalFunction() ==
|
|
0 commit comments