|
| 1 | +// We test various combinations to make sure that -enable-testing does not |
| 2 | +// break ABI with or without -enable-library-evolution. |
| 3 | + |
| 4 | +//// |
| 5 | + |
| 6 | +// RUN: %empty-directory(%t) |
| 7 | + |
| 8 | +// 1) -enable-testing OFF / -enable-library-evolution OFF |
| 9 | + |
| 10 | +// RUN: %target-build-swift-dylib(%t/%target-library-name(vtables_multifile_testable_helper)) %S/Inputs/vtables_multifile_testable_helper.swift -emit-module -emit-module-path %t/vtables_multifile_testable_helper.swiftmodule |
| 11 | +// RUN: %target-codesign %t/%target-library-name(vtables_multifile_testable_helper) |
| 12 | + |
| 13 | +// RUN: %target-build-swift %s -L %t -I %t -lvtables_multifile_testable_helper -o %t/main %target-rpath(%t) |
| 14 | +// RUN: %target-codesign %t/main |
| 15 | + |
| 16 | +// RUN: %target-run %t/main %t/%target-library-name(vtables_multifile_testable_helper) |
| 17 | + |
| 18 | +// 2) -enable-testing ON / -enable-library-evolution OFF |
| 19 | + |
| 20 | +// ... first without rebuilding the client: |
| 21 | + |
| 22 | +// RUN: %target-build-swift-dylib(%t/%target-library-name(vtables_multifile_testable_helper)) %S/Inputs/vtables_multifile_testable_helper.swift -enable-testing -emit-module -emit-module-path %t/vtables_multifile_testable_helper.swiftmodule |
| 23 | +// RUN: %target-codesign %t/%target-library-name(vtables_multifile_testable_helper) |
| 24 | + |
| 25 | +// RUN: %target-run %t/main %t/%target-library-name(vtables_multifile_testable_helper) |
| 26 | + |
| 27 | +// ... now try to rebuild the client: |
| 28 | + |
| 29 | +// RUN: %target-build-swift %s -L %t -I %t -lvtables_multifile_testable_helper -o %t/main %target-rpath(%t) |
| 30 | +// RUN: %target-codesign %t/main |
| 31 | + |
| 32 | +// RUN: %target-run %t/main %t/%target-library-name(vtables_multifile_testable_helper) |
| 33 | + |
| 34 | +//// |
| 35 | + |
| 36 | +// Delete build artifacts |
| 37 | +// RUN: %empty-directory(%t) |
| 38 | + |
| 39 | +// 3) -enable-testing OFF / -enable-library-evolution ON |
| 40 | + |
| 41 | +// RUN: %target-build-swift-dylib(%t/%target-library-name(vtables_multifile_testable_helper)) %S/Inputs/vtables_multifile_testable_helper.swift -enable-library-evolution -emit-module -emit-module-path %t/vtables_multifile_testable_helper.swiftmodule |
| 42 | +// RUN: %target-codesign %t/%target-library-name(vtables_multifile_testable_helper) |
| 43 | + |
| 44 | +// RUN: %target-build-swift %s -L %t -I %t -lvtables_multifile_testable_helper -o %t/main %target-rpath(%t) |
| 45 | +// RUN: %target-codesign %t/main |
| 46 | + |
| 47 | +// RUN: %target-run %t/main %t/%target-library-name(vtables_multifile_testable_helper) |
| 48 | + |
| 49 | +// 4) -enable-testing ON / -enable-library-evolution ON |
| 50 | + |
| 51 | +// ... first without rebuilding the client: |
| 52 | + |
| 53 | +// RUN: %target-build-swift-dylib(%t/%target-library-name(vtables_multifile_testable_helper)) %S/Inputs/vtables_multifile_testable_helper.swift -enable-testing -enable-library-evolution -emit-module -emit-module-path %t/vtables_multifile_testable_helper.swiftmodule |
| 54 | +// RUN: %target-codesign %t/%target-library-name(vtables_multifile_testable_helper) |
| 55 | + |
| 56 | +// RUN: %target-run %t/main %t/%target-library-name(vtables_multifile_testable_helper) |
| 57 | + |
| 58 | +// ... now try to rebuild the client: |
| 59 | + |
| 60 | +// RUN: %target-build-swift %s -L %t -I %t -lvtables_multifile_testable_helper -o %t/main %target-rpath(%t) |
| 61 | +// RUN: %target-codesign %t/main |
| 62 | + |
| 63 | +// RUN: %target-run %t/main %t/%target-library-name(vtables_multifile_testable_helper) |
| 64 | + |
| 65 | +//// |
| 66 | + |
| 67 | +// Delete build artifacts |
| 68 | +// RUN: %empty-directory(%t) |
| 69 | + |
| 70 | +// 5) -enable-testing OFF / -enable-library-evolution ON / textual interfaces |
| 71 | + |
| 72 | +// RUN: %target-build-swift-dylib(%t/%target-library-name(vtables_multifile_testable_helper)) %S/Inputs/vtables_multifile_testable_helper.swift -enable-library-evolution -emit-module-interface -emit-module-interface-path %t/vtables_multifile_testable_helper.swiftinterface |
| 73 | +// RUN: %target-codesign %t/%target-library-name(vtables_multifile_testable_helper) |
| 74 | + |
| 75 | +// RUN: %target-build-swift %s -L %t -I %t -lvtables_multifile_testable_helper -o %t/main %target-rpath(%t) |
| 76 | +// RUN: %target-codesign %t/main |
| 77 | + |
| 78 | +// RUN: %target-run %t/main %t/%target-library-name(vtables_multifile_testable_helper) |
| 79 | + |
| 80 | +// 6) -enable-testing ON / -enable-library-evolution ON / textual interfaces |
| 81 | + |
| 82 | +// ... first without rebuilding the client: |
| 83 | + |
| 84 | +// RUN: %target-build-swift-dylib(%t/%target-library-name(vtables_multifile_testable_helper)) %S/Inputs/vtables_multifile_testable_helper.swift -enable-testing -enable-library-evolution -emit-module-interface -emit-module-interface-path %t/vtables_multifile_testable_helper.swiftinterface |
| 85 | +// RUN: %target-codesign %t/%target-library-name(vtables_multifile_testable_helper) |
| 86 | + |
| 87 | +// RUN: %target-run %t/main %t/%target-library-name(vtables_multifile_testable_helper) |
| 88 | + |
| 89 | +// ... now try to rebuild the client: |
| 90 | + |
| 91 | +// RUN: %target-build-swift %s -L %t -I %t -lvtables_multifile_testable_helper -o %t/main %target-rpath(%t) |
| 92 | +// RUN: %target-codesign %t/main |
| 93 | + |
| 94 | +// RUN: %target-run %t/main %t/%target-library-name(vtables_multifile_testable_helper) |
| 95 | + |
| 96 | + |
| 97 | +// REQUIRES: executable_test |
| 98 | + |
| 99 | +import StdlibUnittest |
| 100 | +import vtables_multifile_testable_helper |
| 101 | + |
| 102 | +var VTableTestSuite = TestSuite("VTable") |
| 103 | + |
| 104 | +public class Derived : Middle { |
| 105 | + public override func method() -> Int { |
| 106 | + return super.method() + 1 |
| 107 | + } |
| 108 | +} |
| 109 | + |
| 110 | +VTableTestSuite.test("Derived") { |
| 111 | + expectEqual(3, callBaseMethod(Derived())) |
| 112 | + expectEqual(3, callMiddleMethod(Derived())) |
| 113 | +} |
| 114 | + |
| 115 | +runAllTests() |
0 commit comments