|
4 | 4 | // RUN: %empty-directory(%t/partials)
|
5 | 5 | // RUN: %empty-directory(%t/normal)
|
6 | 6 | // RUN: %empty-directory(%t/errors)
|
| 7 | +// RUN: %empty-directory(%t/cache) |
7 | 8 |
|
8 | 9 | /// Compile module A with a type and an empty module B.
|
9 |
| -// RUN: %target-swift-frontend %s -emit-module-path %t/partials/A.swiftmodule -module-name A -D LIB |
10 |
| -// RUN: %target-swift-frontend %s -emit-module-path %t/partials/B.swiftmodule -module-name B |
| 10 | +// RUN: %target-swift-frontend %s -emit-module-path %t/partials/A.swiftmodule -module-name A -D LIB -enable-library-evolution |
| 11 | +// RUN: %target-swift-frontend %s -emit-module-path %t/partials/B.swiftmodule -module-name B -enable-library-evolution |
11 | 12 |
|
12 | 13 | /// Compile a client using the type from A.
|
13 |
| -// RUN: %target-swift-frontend %s -emit-module-path %t/normal/Client.swiftmodule -module-name Client -D CLIENT -I %t/partials |
| 14 | +// RUN: %target-swift-frontend %s -emit-module-path %t/normal/Client.swiftmodule -module-name Client -D CLIENT -I %t/partials -enable-library-evolution -emit-module-interface-path %t/normal/Client.swiftinterface |
14 | 15 | // RUN: %target-swift-frontend %s -emit-module-path %t/errors/Client.swiftmodule -module-name Client -D CLIENT -I %t/partials -experimental-allow-module-with-compiler-errors
|
15 | 16 |
|
| 17 | +/// Force rebuilding from the swiftinterface. |
| 18 | +// RUN: mv %t/normal/Client.swiftmodule %t/swap-Client.swiftmodule |
| 19 | +// RUN: echo "import Client" | %target-swift-frontend -typecheck - -I %t/partials -I %t/normal -module-cache-path %t/cache/ |
| 20 | +//2> /dev/null |
| 21 | +// RUN: mv %t/swap-Client.swiftmodule %t/normal/Client.swiftmodule |
| 22 | + |
16 | 23 | /// Swap A and B around! A is now empty and B defines the type.
|
17 | 24 | // RUN: %target-swift-frontend %s -emit-module-path %t/partials/A.swiftmodule -module-name A
|
18 | 25 | // RUN: %target-swift-frontend %s -emit-module-path %t/partials/B.swiftmodule -module-name B -D LIB
|
|
25 | 32 | // NORMALFAILURE-LABEL: *** DESERIALIZATION FAILURE ***
|
26 | 33 | // NORMALFAILURE-LABEL: *** If any module named here was modified in the SDK, please delete the ***
|
27 | 34 | // NORMALFAILURE-LABEL: *** new swiftmodule files from the SDK and keep only swiftinterfaces. ***
|
28 |
| -// NORMALFAILURE-NEXT: module 'Client' with full misc version {{.*}}' |
| 35 | +// NORMALFAILURE-NEXT: module 'Client', builder version {{.*}}', built from source, resilient, loaded from |
29 | 36 | // NORMALFAILURE-NEXT: Could not deserialize type for 'foo()'
|
30 | 37 | // NORMALFAILURE-NEXT: Caused by: top-level value not found
|
31 | 38 | // NORMALFAILURE-NEXT: Cross-reference to module 'A'
|
|
37 | 44 | // ALLOWFAILURE-LABEL: *** DESERIALIZATION FAILURE ***
|
38 | 45 | // ALLOWFAILURE-LABEL: *** If any module named here was modified in the SDK, please delete the ***
|
39 | 46 | // ALLOWFAILURE-LABEL: *** new swiftmodule files from the SDK and keep only swiftinterfaces. ***
|
40 |
| -// ALLOWFAILURE-NEXT: module 'Client' with full misc version {{.*}}' (built with -experimental-allow-module-with-compiler-errors) |
| 47 | +// ALLOWFAILURE-NEXT: module 'Client', builder version {{.*}}', built from source, non-resilient, built with -experimental-allow-module-with-compiler-errors, loaded from |
41 | 48 | // ALLOWFAILURE-NEXT: Could not deserialize type for 'foo()'
|
42 | 49 | // ALLOWFAILURE-NEXT: Caused by: top-level value not found
|
43 | 50 | // ALLOWFAILURE-NEXT: Cross-reference to module 'A'
|
44 | 51 | // ALLOWFAILURE-NEXT: ... SomeType
|
45 | 52 | // ALLOWFAILURE-NEXT: Notes:
|
46 | 53 | // ALLOWFAILURE-NEXT: * There is a matching 'SomeType' in module 'B'. If this is imported from clang, please make sure the header is part of a single clang module.
|
47 | 54 |
|
| 55 | +/// Test a swiftmodule rebuilt from the swiftinterface. |
| 56 | +// RUN: not --crash %target-swift-frontend -emit-sil %t/cache/Client-*.swiftmodule -module-name Client -I %t/partials -disable-deserialization-recovery 2> %t/cache_stderr |
| 57 | +// RUN: cat %t/cache_stderr | %FileCheck %s -check-prefixes=CACHEFAILURE |
| 58 | +// CACHEFAILURE: module 'Client', builder version {{.*}}', built from swiftinterface, resilient |
| 59 | + |
48 | 60 | #if LIB
|
49 | 61 | public struct SomeType {
|
50 | 62 | public init() {}
|
|
0 commit comments