1
1
// RUN: %empty-directory(%t)
2
+ // RUN: %empty-directory(%t/mcp)
2
3
// RUN: cp -r %S/../Inputs/CrossImport %t/CrossImport
3
4
// RUN: %{python} %S/../../CrossImport/Inputs/rewrite-module-triples.py %t/CrossImport %module-target-triple
4
5
5
- // RUN: %target-swift-frontend -c -index-store-path %t/idx -index-system-modules -index-ignore-stdlib -enable-cross-import-overlays %s -Fsystem %t/CrossImport -o %t/file1.o -module-name cross_import_overlay
6
+ // RUN: %target-swift-frontend -c -index-store-path %t/idx -module-cache-path %t/mcp - index-system-modules -index-ignore-stdlib -enable-cross-import-overlays %s -Fsystem %t/CrossImport -o %t/file1.o -module-name cross_import_overlay
6
7
// RUN: c-index-test core -print-unit %t/idx > %t/units
7
- // RUN: %FileCheck %s --input-file %t/units --check-prefix=UNIT
8
- // RUN: %FileCheck %s --input-file %t/units --check-prefix=UNIT-NEGATIVE
9
8
10
9
import A
11
10
import B
@@ -16,59 +15,96 @@ fromB()
16
15
from_ABAdditions ( )
17
16
from__ABAdditionsCAdditions ( )
18
17
19
- // Check the overlay modules' names match the names of their underlying modules .
18
+ // Check the overlay modules pick up the name of their underlying module .
20
19
//
21
- // UNIT: module-name: cross_import_overlay
22
- // UNIT: main-path: {{.*}}/cross-import-overlay.swift
23
- // UNIT: DEPEND START
24
- // UNIT: Unit | system | B | {{.*}}/B.swiftmodule/{{.*}}
25
- // UNIT: Unit | system | C | {{.*}}/C.swiftmodule/{{.*}}
26
- // UNIT: Unit | system | A | {{.*}}/__ABAdditionsCAdditions.swiftmodule/{{.*}}
27
- // UNIT: Record | user | {{.*}}/cross-import-overlay.swift | cross-import-overlay.swift-{{.*}}
28
- // UNIT: DEPEND END
29
- // UNIT: --------
30
- // UNIT: module-name: A
31
- // UNIT: out-file: {{.*}}/_ABAdditions.swiftmodule/{{.*}}
32
- // UNIT: DEPEND START
33
- // UNIT: Unit | system | A | {{.*}}/A.swiftmodule/{{.*}}
34
- // UNIT: Unit | system | B | {{.*}}/B.swiftmodule/{{.*}}
35
- // UNIT: Record | system | A | {{.*}}/_ABAdditions.swiftmodule/{{.*}}
36
- // UNIT: DEPEND END
37
- // UNIT: --------
38
- // UNIT: module-name: A
39
- // UNIT: out-file: {{.*}}/__ABAdditionsCAdditions.swiftmodule/{{.*}}
40
- // UNIT: DEPEND START
41
- // UNIT: Unit | system | C | {{.*}}/C.swiftmodule/{{.*}}
42
- // UNIT: Unit | system | A | {{.*}}/_ABAdditions.swiftmodule/{{.*}}
43
- // UNIT: Record | system | A | {{.*}}/__ABAdditionsCAdditions.swiftmodule/{{.*}}
44
- // UNIT: DEPEND END
45
- // UNIT: --------
46
- // UNIT: module-name: C
47
- // UNIT: out-file: {{.*}}/C.swiftmodule/{{.*}}
48
- // UNIT: DEPEND START
49
- // UNIT: Record | system | C | {{.*}}/C.swiftmodule/{{.*}}
50
- // UNIT: DEPEND END
51
- // UNIT: --------
52
- // UNIT: module-name: B
53
- // UNIT: out-file: {{.*}}/B.swiftmodule/{{.*}}
54
- // UNIT: DEPEND START
55
- // UNIT: Record | system | B | {{.*}}/B.swiftmodule/{{.*}}
56
- // UNIT: DEPEND END
57
- // UNIT: --------
58
- // UNIT: module-name: A
59
- // UNIT: out-file: {{.*}}/A.swiftmodule/{{.*}}
60
- // UNIT: DEPEND START
61
- // UNIT: Record | system | A | {{.*}}/A.swiftmodule/{{.*}}
62
- // UNIT: DEPEND END
20
+ // FIXME: the units are sorted by their unit name, which for the frameworks in
21
+ // this test end up just being the target triple + a hash of the output file
22
+ // path which changes depending on where this test is run. We should fix this
23
+ // properly, but for now work around it by checking for each unit in a separate
24
+ // pass and do our best to make sure we don't match across unit boundaries.
25
+ //
26
+ // RUN: %FileCheck %s --input-file %t/units --check-prefix=MAIN
27
+ // MAIN: module-name: cross_import_overlay
28
+ // MAIN: out-file: {{.*}}/file1.o
29
+ // MAIN-NEXT: target: {{.*}}
30
+ // MAIN-NEXT: is-debug: 1
31
+ // MAIN-NEXT: DEPEND START
32
+ // MAIN-NEXT: Unit | system | Swift | {{.*}}/Swift.swiftmodule
33
+ // MAIN-NEXT: Unit | system | B | {{.*}}/B.swiftmodule/{{.*}}
34
+ // MAIN-NEXT: Unit | system | C | {{.*}}/C.swiftmodule/{{.*}}
35
+ // MAIN-NEXT: Unit | system | A | {{.*}}/__ABAdditionsCAdditions.swiftmodule/{{.*}}
36
+ // MAIN-NEXT: Record | user | {{.*}}/cross-import-overlay.swift
37
+ // MAIN-NEXT: DEPEND END
38
+ //
39
+ // RUN: %FileCheck %s --input-file %t/units --check-prefix=AB_OVERLAY
40
+ // AB_OVERLAY: module-name: A
41
+ // AB_OVERLAY: out-file:{{.*}}/_ABAdditions.swiftmodule/{{.*}}
42
+ // AB_OVERLAY-NEXT: target: {{.*}}
43
+ // AB_OVERLAY-NEXT: is-debug: 1
44
+ // AB_OVERLAY-NEXT: DEPEND START
45
+ // AB_OVERLAY-NEXT: Unit | system | A | {{.*}}/A.swiftmodule/{{.*}}
46
+ // AB_OVERLAY-NEXT: Unit | system | B | {{.*}}/B.swiftmodule/{{.*}}
47
+ // AB_OVERLAY-NEXT: Unit | system | Swift | {{.*}}/Swift.swiftmodule
48
+ // AB_OVERLAY-NEXT: Record | system | A | {{.*}}/_ABAdditions.swiftmodule/{{.*}}
49
+ // AB_OVERLAY-NEXT: DEPEND END
50
+ //
51
+ // RUN: %FileCheck %s --input-file %t/units --check-prefix=ABC_OVERLAY
52
+ // ABC_OVERLAY: module-name: A
53
+ // ABC_OVERLAY: out-file: {{.*}}/__ABAdditionsCAdditions.swiftmodule/{{.*}}
54
+ // ABC_OVERLAY-NEXT: target: {{.*}}
55
+ // ABC_OVERLAY-NEXT: is-debug: 1
56
+ // ABC_OVERLAY-NEXT: DEPEND START
57
+ // ABC_OVERLAY-NEXT: Unit | system | C | {{.*}}/C.swiftmodule/{{.*}}
58
+ // ABC_OVERLAY-NEXT: Unit | system | Swift | {{.*}}/Swift.swiftmodule
59
+ // ABC_OVERLAY-NEXT: Unit | system | A | {{.*}}/_ABAdditions.swiftmodule/{{.*}}
60
+ // ABC_OVERLAY-NEXT: Record | system | A | {{.*}}/__ABAdditionsCAdditions.swiftmodule/{{.*}}
61
+ // ABC_OVERLAY-NEXT: DEPEND END
62
+ //
63
+ // RUN: %FileCheck %s --input-file %t/units --check-prefix=C_MODULE
64
+ // C_MODULE: module-name: C
65
+ // C_MODULE: out-file: {{.*}}/C.swiftmodule/{{.*}}
66
+ // C_MODULE-NEXT: target: {{.*}}
67
+ // C_MODULE-NEXT: is-debug: 1
68
+ // C_MODULE-NEXT: DEPEND START
69
+ // C_MODULE-NEXT: Unit | system | Swift | {{.*}}/Swift.swiftmodule
70
+ // C_MODULE-NEXT: Record | system | C | {{.*}}/C.swiftmodule/{{.*}}
71
+ // C_MODULE-NEXT: DEPEND END
72
+ //
73
+ // RUN: %FileCheck %s --input-file %t/units --check-prefix=B_MODULE
74
+ // B_MODULE: module-name: B
75
+ // B_MODULE: out-file: {{.*}}/B.swiftmodule/{{.*}}
76
+ // B_MODULE-NEXT: target: {{.*}}
77
+ // B_MODULE-NEXT: is-debug: 1
78
+ // B_MODULE-NEXT: DEPEND START
79
+ // B_MODULE-NEXT: Unit | system | Swift | {{.*}}/Swift.swiftmodule
80
+ // B_MODULE-NEXT: Record | system | B | {{.*}}/B.swiftmodule/{{.*}}
81
+ // B_MODULE-NEXT: DEPEND END
82
+ //
83
+ // RUN: %FileCheck %s --input-file %t/units --check-prefix=A_MODULE
84
+ // A_MODULE: module-name: A
85
+ // A_MODULE: out-file: {{.*}}/A.swiftmodule/{{.*}}
86
+ // A_MODULE-NEXT: target: {{.*}}
87
+ // A_MODULE-NEXT: is-debug: 1
88
+ // A_MODULE-NEXT: DEPEND START
89
+ // A_MODULE-NEXT: Unit | system | Swift | {{.*}}/Swift.swiftmodule
90
+ // A_MODULE-NEXT: Record | system | A | {{.*}}/A.swiftmodule/{{.*}}
91
+ // A_MODULE-NEXT: DEPEND END
92
+
63
93
64
- // Make sure we aren't leaking the underscored overlay names anywhere
94
+ // Make sure there are three units with module-name 'A' (A, _ABAdditions and
95
+ // __ABAdditionsCAdditions) in case we matched across unit boundaries above
96
+ // due to the nondeterministic ordering.
65
97
//
66
- // UNIT-NEGATIVE-NOT: Unit | {{.*}} | _ABAdditions |
67
- // UNIT-NEGATIVE-NOT: Record | {{.*}} | _ABAdditions |
68
- // UNIT-NEGATIVE-NOT: Unit | {{.*}} | __ABAdditionsCAdditions |
69
- // UNIT-NEGATIVE-NOT: Record | {{.*}} | __ABAdditionsCAdditions |
98
+ // RUN: %FileCheck %s --input-file %t/units --check-prefix=UNITS
99
+ // UNITS-COUNT-3: module-name: A
70
100
71
- // Make sure we don't regress test performance by indexing the stdlib.
101
+ // Make sure we aren't leaking the underscored overlay names anywhere and don't
102
+ // regress test performance by indexing the stdlib.
72
103
//
73
- // UNIT-NEGATIVE-NOT: Record | system | Swift |
104
+ // RUN: %FileCheck %s --input-file %t/units --check-prefix=UNITS-NEGATIVE
105
+ // UNITS-NEGATIVE-NOT: Unit | {{.*}} | _ABAdditions
106
+ // UNITS-NEGATIVE-NOT: Record | {{.*}} | _ABAdditions
107
+ // UNITS-NEGATIVE-NOT: Unit | {{.*}} | __ABAdditionsCAdditions
108
+ // UNITS-NEGATIVE-NOT: Record | {{.*}} | __ABAdditionsCAdditions
109
+ // UNITS-NEGATIVE-NOT: Record | system | Swift
74
110
0 commit comments