File: loaded_module_trace_swiftinterface.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (71 lines) | stat: -rw-r--r-- 4,710 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// UNSUPPORTED: OS=windows-msvc

// FIXME: Disabled due to https://github.com/apple/swift/issues/55480.
// REQUIRES: issue_55480

// 1) If there is no swiftmodule, use the swiftinterface
//
// RUN: %empty-directory(%t)
// RUN: %target-build-swift -swift-version 5 -enable-library-evolution -module-name Module %S/Inputs/loaded_module_trace_empty.swift -emit-module-interface-path %t/Module.swiftinterface
// RUN: %target-build-swift -swift-version 5 -I %t -module-name Module2 %S/Inputs/loaded_module_trace_imports_module.swift -emit-module -o %t/Module2.swiftmodule
// RUN: %target-build-swift -I %t %s -emit-loaded-module-trace -o %t/loaded_module_trace_swiftinterface
// RUN: %FileCheck -check-prefix=CHECK %s < %t/loaded_module_trace_swiftinterface.trace.json
//
// CHECK: {
// CHECK: "version":2
// CHECK: "name":"loaded_module_trace_swiftinterface"
// CHECK: "arch":"{{[^"]*}}"
// CHECK: "swiftmodules":[
// CHECK-DAG: "{{[^"]*\\[/\\]}}Module2.swiftmodule"
// CHECK-DAG: "{{[^"]*\\[/\\]}}Swift.swiftmodule{{(\\[/\\][^"]+[.]swiftmodule)?}}"
// CHECK-DAG: "{{[^"]*\\[/\\]}}SwiftOnoneSupport.swiftmodule{{(\\[/\\][^"]+[.]swiftmodule)?}}"
// CHECK-DAG: "{{[^"]*\\[/\\]}}Module.swiftinterface"
// CHECK-NOT: Module.swiftmodule
// CHECK: ]
// CHECK: "swiftmodulesDetailedInfo":[
// CHECK-DAG: {"name":"Module2","path":"{{[^"]*\\[/\\]}}Module2.swiftmodule","isImportedDirectly":true,"supportsLibraryEvolution":false}
// CHECK-DAG: {"name":"Swift","path":"{{[^"]*\\[/\\]}}Swift.swiftmodule{{(\\[/\\][^"]+[.]swiftmodule)?}}","isImportedDirectly":true,"supportsLibraryEvolution":true}
// CHECK-DAG: {"name":"SwiftOnoneSupport","path":"{{[^"]*\\[/\\]}}SwiftOnoneSupport.swiftmodule{{(\\[/\\][^"]+[.]swiftmodule)?}}","isImportedDirectly":true,"supportsLibraryEvolution":true}
// CHECK-DAG: {"name":"Module","path":"{{[^"]*\\[/\\]}}Module.swiftinterface","isImportedDirectly":false,"supportsLibraryEvolution":true}
// CHECK: ]
// CHECK: }


// 2) If there is a swiftmodule next to the swiftinterface, use that instead.
//
// RUN: %empty-directory(%t)
// RUN: %target-build-swift -swift-version 5 -enable-library-evolution -module-name Module %S/Inputs/loaded_module_trace_empty.swift -emit-module-interface-path %t/Module.swiftinterface -emit-module -o %t/Module.swiftmodule
// RUN: %target-swift-frontend -swift-version 5 -I %t -module-name Module2 %S/Inputs/loaded_module_trace_imports_module.swift -emit-module -o %t/Module2.swiftmodule
// RUN: %target-build-swift -I %t %s -emit-loaded-module-trace -o %t/loaded_module_trace_swiftinterface
// RUN: %FileCheck -check-prefix=ADJMODULE %s < %t/loaded_module_trace_swiftinterface.trace.json
//
// ADJMODULE: Module.swiftmodule
// ADJMODULE-NOT: Module.swiftinterface


// 3) If there is a swiftmodule in the (non-prebuilt) module cache path pointing to the swiftinterface, use the swiftinterface.
//
// RUN: %empty-directory(%t)
// RUN: mkdir %t/MCP
// RUN: %target-build-swift -swift-version 5 -enable-library-evolution -module-cache-path %t/MCP -module-name Module %S/Inputs/loaded_module_trace_empty.swift -emit-module-interface-path %t/Module.swiftinterface -emit-module -o %t/MCP/Module.swiftmodule
// RUN: %target-swift-frontend -swift-version 5 -I %t -module-cache-path %t/MCP -module-name Module2  %S/Inputs/loaded_module_trace_imports_module.swift -emit-module -o %t/Module2.swiftmodule
// RUN: %target-build-swift -I %t -module-cache-path %t/MCP %s -emit-loaded-module-trace -o %t/loaded_module_trace_swiftinterface
// RUN: %FileCheck -check-prefix=CACHEDMODULE %s < %t/loaded_module_trace_swiftinterface.trace.json
//
// CACHEDMODULE: Module.swiftinterface
// CACHEDMODULE-NOT: Module.swiftmodule


// 4) If there is a swiftmodule in the prebuilt module cache path pointing to the swiftinterface, use the swiftinterface.
//
// RUN: %empty-directory(%t)
// RUN: mkdir %t/MCP %t/PB %t/Main
// RUN: %target-swift-frontend -swift-version 5 -enable-library-evolution -prebuilt-module-cache-path %t/PB -module-cache-path %/MCP -module-name Module %S/Inputs/loaded_module_trace_empty.swift -emit-module -o %t/PB/Module.swiftmodule -emit-module-interface-path %t/Main/Module.swiftinterface
// RUN: %target-swift-frontend -swift-version 5 -I %t/Main -prebuilt-module-cache-path %t/PB -module-cache-path %t/MCP -module-name Module2 %S/Inputs/loaded_module_trace_imports_module.swift -emit-module -o %t/Main/Module2.swiftmodule
// RUN: %target-build-swift -I %t/Main -module-cache-path %t/MCP %s -emit-loaded-module-trace -o %t/loaded_module_trace_swiftinterface
// RUN: %FileCheck -check-prefix=PREBUILTMODULE %s < %t/loaded_module_trace_swiftinterface.trace.json
//
// PREBUILTMODULE: Module.swiftinterface
// PREBUILTMODULE-NOT: Module.swiftmodule

import Module2