Skip to content

Commit ad889ee

Browse files
authored
Merge pull request #23501 from compnerd/module-wrapping-actions
2 parents 821d45b + b001aa7 commit ad889ee

File tree

1 file changed

+73
-32
lines changed

1 file changed

+73
-32
lines changed

test/Driver/actions.swift

Lines changed: 73 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
// RUN: %empty-directory(%t)
22

3-
// XFAIL: freebsd, linux
4-
5-
// RUN: %swiftc_driver -driver-print-actions %s 2>&1 | %FileCheck %s -check-prefix=BASIC
3+
// RUN: %swiftc_driver -driver-print-actions %s 2>&1 | %FileCheck %s -check-prefix=BASIC -check-prefix BASIC-%target-object-format
64
// BASIC: 0: input, "{{.*}}actions.swift", swift
75
// BASIC: 1: compile, {0}, object
8-
// BASIC: 2: link, {1}, image
6+
// BASIC-COFF: 2: link, {1}, image
7+
// BASIC-ELF: 2: swift-autolink-extract, {1}, autolink
8+
// BASIC-ELF: 3: link, {1, 2}, image
9+
// BASIC-MACHO: 2: link, {1}, image
910

1011
// RUN: %swiftc_driver -driver-print-actions -c %s 2>&1 | %FileCheck %s -check-prefix=BASICC
1112
// BASICC: 0: input, "{{.*}}actions.swift", swift
@@ -45,18 +46,25 @@
4546
// SWIFTMODULE-DEBUG-INPUT: 2: input, "{{.*}}a.swiftmodule", swift
4647
// SWIFTMODULE-DEBUG-INPUT: 3: merge-module, {1, 2}, swiftmodule
4748

48-
// RUN: %swiftc_driver -driver-print-actions -emit-executable -emit-module %s 2>&1 | %FileCheck %s -check-prefix=EXEC-AND-MODULE
49+
// RUN: %swiftc_driver -driver-print-actions -emit-executable -emit-module %s 2>&1 | %FileCheck %s -check-prefix=EXEC-AND-MODULE -check-prefix EXEC-AND-MODULE-%target-object-format
4950
// EXEC-AND-MODULE: 0: input, "{{.*}}actions.swift", swift
5051
// EXEC-AND-MODULE: 1: compile, {0}, object
5152
// EXEC-AND-MODULE: 2: merge-module, {1}, swiftmodule
52-
// EXEC-AND-MODULE: 3: link, {1}, image
53+
// EXEC-AND-MODULE-COFF: 3: link, {1}, image
54+
// EXEC-AND-MODULE-ELF: 3: swift-autolink-extract, {1}, autolink
55+
// EXEC-AND-MODULE-ELF: 4: link, {1, 3}, image
56+
// EXEC-AND-MODULE-MACHO: 3: link, {1}, image
5357

54-
// RUN: %swiftc_driver -driver-print-actions -g %s 2>&1 | %FileCheck %s -check-prefix=DEBUG
55-
// RUN: %swiftc_driver -driver-print-actions -gnone -g %s 2>&1 | %FileCheck %s -check-prefix=DEBUG
58+
// RUN: %swiftc_driver -driver-print-actions -g %s 2>&1 | %FileCheck %s -check-prefix=DEBUG -check-prefix DEBUG-%target-object-format
59+
// RUN: %swiftc_driver -driver-print-actions -gnone -g %s 2>&1 | %FileCheck %s -check-prefix=DEBUG -check-prefix DEBUG-%target-object-format
5660
// DEBUG: 0: input, "{{.*}}actions.swift", swift
5761
// DEBUG: 1: compile, {0}, object
5862
// DEBUG: 2: merge-module, {1}, swiftmodule
59-
// DEBUG: 3: link, {1, 2}, image
63+
// DEBUG-COFF: 3: modulewrap, {2}, object
64+
// DEBUG-COFF: 4: line, {1, 3}, image
65+
// DEBUG-ELF: 3: modulewrap, {2}, object
66+
// DEBUG-ELF: 4: line, {1, 3}, image
67+
// DEBUG-MACHO: 3: link, {1, 2}, image
6068

6169
// RUN: %swiftc_driver -driver-print-actions -gnone %s 2>&1 | %FileCheck %s -check-prefix=BASIC
6270
// RUN: %swiftc_driver -driver-print-actions -g -gnone %s 2>&1 | %FileCheck %s -check-prefix=BASIC
@@ -70,94 +78,127 @@
7078
// RUN: %swiftc_driver -driver-print-actions -gline-tables-only -verify-debug-info %s 2>&1 | %FileCheck %s -check-prefixes=BASIC,VERIFY-DEBUG-LINE-TABLES
7179
// VERIFY-DEBUG-LINE-TABLES-ONLY: 0: verify-debug-info, {3}, none
7280

73-
// RUN: %swiftc_driver -driver-print-actions -gnone -verify-debug-info %s 2>&1 | %FileCheck %s -check-prefixes=MISSING-DEBUG-OPTION
74-
// RUN: %swiftc_driver -driver-print-actions -g -gnone -verify-debug-info %s 2>&1 | %FileCheck %s -check-prefixes=MISSING-DEBUG-OPTION
81+
// RUN: %swiftc_driver -driver-print-actions -gnone -verify-debug-info %s 2>&1 | %FileCheck %s -check-prefixes=MISSING-DEBUG-OPTION -check-prefix MISSING-DEBUG-%target-object-format
82+
// RUN: %swiftc_driver -driver-print-actions -g -gnone -verify-debug-info %s 2>&1 | %FileCheck %s -check-prefixes=MISSING-DEBUG-OPTION -check-prefix MISSING-DEBUG-%target-object-format
7583
// MISSING-DEBUG-OPTION: warning: ignoring '-verify-debug-info'; no debug info is being generated
7684
// MISSING-DEBUG-OPTION: 0: input, "{{.*}}actions.swift", swift
7785
// MISSING-DEBUG-OPTION: 1: compile, {0}, object
78-
// MISSING-DEBUG-OPTION: 2: link, {1}, image
86+
// MISSING-DEBUG-OPTION-COFF: 2: link, {1}, image
87+
// MISSING-DEBUG-OPTION-ELF: 2: swift-autolink-extract, {1}, autolink
88+
// MISSING-DEBUG-OPTION-ELF: 3: link, {1, 2}, image
89+
// MISSING-DEBUG-OPTION-MACHO: 2: link, {1}, image
7990

8091
// RUN: %swiftc_driver -driver-print-actions -g -c %s 2>&1 | %FileCheck %s -check-prefix=DEBUG-OBJECT
8192
// DEBUG-OBJECT: 0: input, "{{.*}}actions.swift", swift
8293
// DEBUG-OBJECT: 1: compile, {0}, object
8394
// DEBUG-OBJECT-NOT: merge-module
8495

85-
// RUN: %swiftc_driver -driver-print-actions -g -emit-executable -emit-module %s 2>&1 | %FileCheck %s -check-prefix=DEBUG-MODULE
86-
// RUN: %swiftc_driver -driver-print-actions -gnone -g -emit-executable -emit-module %s 2>&1 | %FileCheck %s -check-prefix=DEBUG-MODULE
96+
// RUN: %swiftc_driver -driver-print-actions -g -emit-executable -emit-module %s 2>&1 | %FileCheck %s -check-prefix=DEBUG-MODULE -check-prefix DEBUG-MODULE-%target-object-format
97+
// RUN: %swiftc_driver -driver-print-actions -gnone -g -emit-executable -emit-module %s 2>&1 | %FileCheck %s -check-prefix=DEBUG-MODULE -check-prefix DEBUG-MODULE-%target-object-format
8798
// DEBUG-MODULE: 0: input, "{{.*}}actions.swift", swift
8899
// DEBUG-MODULE: 1: compile, {0}, object
89100
// DEBUG-MODULE: 2: merge-module, {1}, swiftmodule
90-
// DEBUG-MODULE: 3: link, {1, 2}, image
101+
// DEBUG-MODULE-COFF: 3: modulewrap, {2}, object
102+
// DEBUG-MODULE-COFF: 4: link, {1, 3}, image
103+
// DEBUG-MODULE-ELF: 3: modulewrap, {2}, object
104+
// DEBUG-MODULE-ELF: 4: link, {1, 3}, image
105+
// DEBUG-MODULE-MACHO: 3: link, {1, 2}, image
91106

92107
// RUN: %swiftc_driver -driver-print-actions -gnone -emit-executable -emit-module %s 2>&1 | %FileCheck %s -check-prefix=EXEC-AND-MODULE
93108
// RUN: %swiftc_driver -driver-print-actions -g -gnone -emit-executable -emit-module %s 2>&1 | %FileCheck %s -check-prefix=EXEC-AND-MODULE
94109

95-
// RUN: %swiftc_driver -driver-print-actions %S/Inputs/main.swift %S/../Inputs/empty.swift %s -module-name actions 2>&1 | %FileCheck %s -check-prefix=MULTI
110+
// RUN: %swiftc_driver -driver-print-actions %S/Inputs/main.swift %S/../Inputs/empty.swift %s -module-name actions 2>&1 | %FileCheck %s -check-prefix=MULTI -check-prefix MULTI-%target-object-format
96111
// MULTI: 0: input, "{{.*}}Inputs/main.swift", swift
97112
// MULTI: 1: compile, {0}, object
98113
// MULTI: 2: input, "{{.*}}Inputs/empty.swift", swift
99114
// MULTI: 3: compile, {2}, object
100115
// MULTI: 4: input, "{{.*}}actions.swift", swift
101116
// MULTI: 5: compile, {4}, object
102-
// MULTI: 6: link, {1, 3, 5}, image
117+
// MULTI-COFF: 6: link, {1, 3, 5}, image
118+
// MULTI-ELF: 6: swift-autolink-extract, {1, 3, 5}, autolink
119+
// MULTI-ELF: 7: link, {1, 3, 5, 6}, image
120+
// MULTI-MACHO: 6: link, {1, 3, 5}, image
103121

104-
// RUN: %swiftc_driver -driver-print-actions -g %S/Inputs/main.swift %S/../Inputs/empty.swift %s -module-name actions 2>&1 | %FileCheck %s -check-prefix=DEBUG-MULTI
122+
// RUN: %swiftc_driver -driver-print-actions -g %S/Inputs/main.swift %S/../Inputs/empty.swift %s -module-name actions 2>&1 | %FileCheck %s -check-prefix=DEBUG-MULTI -check-prefix DEBUG-MULTI-%target-object-format
105123
// DEBUG-MULTI: 0: input, "{{.*}}Inputs/main.swift", swift
106124
// DEBUG-MULTI: 1: compile, {0}, object
107125
// DEBUG-MULTI: 2: input, "{{.*}}Inputs/empty.swift", swift
108126
// DEBUG-MULTI: 3: compile, {2}, object
109127
// DEBUG-MULTI: 4: input, "{{.*}}actions.swift", swift
110128
// DEBUG-MULTI: 5: compile, {4}, object
111129
// DEBUG-MULTI: 6: merge-module, {1, 3, 5}, swiftmodule
112-
// DEBUG-MULTI: 7: link, {1, 3, 5, 6}, image
130+
// DEBUG-MULTI-COFF: 7: modulewrap, {6}, object
131+
// DEBUG-MULTI-COFF: 8: link, {1, 3, 5, 7}, image
132+
// DEBUG-MULTI-ELF: 7: modulewrap, {6}, object
133+
// DEBUG-MULTI-ELF: 8: link, {1, 3, 5, 7}, image
134+
// DEBUG-MULTI-MACHO: 7: link, {1, 3, 5, 6}, image
113135

114136

115137
// RUN: touch %t/a.o %t/b.o
116-
// RUN: %swiftc_driver -driver-print-actions %t/a.o %t/b.o -o main 2>&1 | %FileCheck %s -check-prefix=LINK-ONLY
117-
// RUN: %swiftc_driver -driver-print-actions -g %t/a.o %t/b.o -o main 2>&1 | %FileCheck %s -check-prefix=LINK-ONLY
138+
// RUN: %swiftc_driver -driver-print-actions %t/a.o %t/b.o -o main 2>&1 | %FileCheck %s -check-prefix=LINK-ONLY -check-prefix LINK-ONLY-%target-object-format
139+
// RUN: %swiftc_driver -driver-print-actions -g %t/a.o %t/b.o -o main 2>&1 | %FileCheck %s -check-prefix=LINK-ONLY -check-prefix LINK-ONLY-%target-object-format
118140
// LINK-ONLY: 0: input, "{{.*}}/a.o", object
119141
// LINK-ONLY: 1: input, "{{.*}}/b.o", object
120-
// LINK-ONLY: 2: link, {0, 1}, image
142+
// LINK-ONLY-COFF: 2: link, {0, 1}, image
143+
// LINK-ONLY-ELF: 2: swift-autolink-extract, {0, 1}, autolink
144+
// LINK-ONLY-ELF: 3: link, {0, 1, 2}, image
145+
// LINK-ONLY-MACHO: 2: link, {0, 1}, image
121146

122147
// RUN: touch %t/a.swiftmodule %t/b.swiftmodule
123-
// RUN: %swiftc_driver -driver-print-actions -g %t/a.o %t/b.o %t/a.swiftmodule %t/b.swiftmodule -o main 2>&1 | %FileCheck %s -check-prefix=DEBUG-LINK-ONLY
148+
// RUN: %swiftc_driver -driver-print-actions -g %t/a.o %t/b.o %t/a.swiftmodule %t/b.swiftmodule -o main 2>&1 | %FileCheck %s -check-prefix=DEBUG-LINK-ONLY -check-prefix DEBUG-LINK-ONLY-%target-object-format
124149
// DEBUG-LINK-ONLY: 0: input, "{{.*}}/a.o", object
125150
// DEBUG-LINK-ONLY: 1: input, "{{.*}}/b.o", object
126151
// DEBUG-LINK-ONLY: 2: input, "{{.*}}/a.swiftmodule", swiftmodule
127152
// DEBUG-LINK-ONLY: 3: input, "{{.*}}/b.swiftmodule", swiftmodule
128-
// DEBUG-LINK-ONLY: 4: link, {0, 1, 2, 3}, image
153+
// DEBUG-LINK-ONLY-COFF: 4: link, {0, 1, 2, 3}, image
154+
// DEBUG-LINK-ONLY-ELF: 4: swift-autolink-extract, {0, 1, 2, 3}, autolink
155+
// DEBUG-LINK-ONLY-ELF: 4: link, {0, 1, 2, 3, 4}, image
156+
// DEBUG-LINK-ONLY-MACHO: 4: link, {0, 1, 2, 3}, image
129157

130158
// RUN: touch %t/c.swift
131-
// RUN: %swiftc_driver -driver-print-actions %t/c.swift %t/a.o %t/b.o %t/a.swiftmodule %t/b.swiftmodule -o main 2>&1 | %FileCheck %s -check-prefix=LINK-SWIFTMODULES
159+
// RUN: %swiftc_driver -driver-print-actions %t/c.swift %t/a.o %t/b.o %t/a.swiftmodule %t/b.swiftmodule -o main 2>&1 | %FileCheck %s -check-prefix=LINK-SWIFTMODULES -check-prefix LINK-SWIFTMODULES-%target-object-format
132160
// LINK-SWIFTMODULES: 0: input, "{{.*}}/c.swift", swift
133161
// LINK-SWIFTMODULES: 1: compile, {0}, object
134162
// LINK-SWIFTMODULES: 2: input, "{{.*}}/a.o", object
135163
// LINK-SWIFTMODULES: 3: input, "{{.*}}/b.o", object
136164
// LINK-SWIFTMODULES: 4: input, "{{.*}}/a.swiftmodule", swiftmodule
137165
// LINK-SWIFTMODULES: 5: input, "{{.*}}/b.swiftmodule", swiftmodule
138-
// LINK-SWIFTMODULES: 6: link, {1, 2, 3, 4, 5}, image
166+
// LINK-SWIFTMODULES-COFF: 6: link, {1, 2, 3, 4, 5}, image
167+
// LINK-SWIFTMODULES-ELF: 6: swift-autolink-extract, {1, 2, 3, 4, 5}, autolink
168+
// LINK-SWIFTMODULES-ELF: 6: link, {1, 2, 3, 4, 5, 6}, image
169+
// LINK-SWIFTMODULES-MACHO: 6: link, {1, 2, 3, 4, 5}, image
139170

140-
// RUN: %swiftc_driver -driver-print-actions -g %t/c.swift %t/a.o %t/b.o %t/a.swiftmodule %t/b.swiftmodule -o main 2>&1 | %FileCheck %s -check-prefix=LINK-DEBUG-SWIFTMODULES
171+
// RUN: %swiftc_driver -driver-print-actions -g %t/c.swift %t/a.o %t/b.o %t/a.swiftmodule %t/b.swiftmodule -o main 2>&1 | %FileCheck %s -check-prefix=LINK-DEBUG-SWIFTMODULES -check-prefix LINK-DEBUG-SWIFTMODULES-%target-object-format
141172
// LINK-DEBUG-SWIFTMODULES: 0: input, "{{.*}}/c.swift", swift
142173
// LINK-DEBUG-SWIFTMODULES: 1: compile, {0}, object
143174
// LINK-DEBUG-SWIFTMODULES: 2: input, "{{.*}}/a.o", object
144175
// LINK-DEBUG-SWIFTMODULES: 3: input, "{{.*}}/b.o", object
145176
// LINK-DEBUG-SWIFTMODULES: 4: input, "{{.*}}/a.swiftmodule", swiftmodule
146177
// LINK-DEBUG-SWIFTMODULES: 5: input, "{{.*}}/b.swiftmodule", swiftmodule
147178
// LINK-DEBUG-SWIFTMODULES: 6: merge-module, {1}, swiftmodule
148-
// LINK-DEBUG-SWIFTMODULES: 7: link, {1, 2, 3, 4, 5, 6}, image
179+
// LINK-DEBUG-SWIFTMODULES-COFF: 7: modulewrap, {6}, object
180+
// LINK-DEBUG-SWIFTMODULES-COFF: 8: link, {1, 2, 3, 4, 5, 7}, image
181+
// LINK-DEBUG-SWIFTMODULES-ELF: 7: modulewrap, {6}, object
182+
// LINK-DEBUG-SWIFTMODULES-ELF: 8: link, {1, 2, 3, 4, 5, 7}, image
183+
// LINK-DEBUG-SWIFTMODULES-MACHO: 7: link, {1, 2, 3, 4, 5, 6}, image
149184

150185
// RUN: touch %t/a.o %t/b.o
151-
// RUN: %swiftc_driver -driver-print-actions %t/a.o %s -o main 2>&1 | %FileCheck %s -check-prefix=COMPILE-PLUS-OBJECT
186+
// RUN: %swiftc_driver -driver-print-actions %t/a.o %s -o main 2>&1 | %FileCheck %s -check-prefix=COMPILE-PLUS-OBJECT -check-prefix COMPILE-PLUS-OBJECT-%target-object-format
152187
// COMPILE-PLUS-OBJECT: 0: input, "{{.*}}/a.o", object
153188
// COMPILE-PLUS-OBJECT: 1: input, "{{.*}}actions.swift", swift
154189
// COMPILE-PLUS-OBJECT: 2: compile, {1}, object
155-
// COMPILE-PLUS-OBJECT: 3: link, {0, 2}, image
190+
// COMPILE-PLUS-OBJECT-COFF: 3: link, {0, 2}, image
191+
// COMPILE-PLUS-OBJECT-ELF: 3: swift-autolink-extract, {0, 2}, autolink
192+
// COMPILE-PLUS-OBJECT-ELF: 4: link, {0, 2, 3}, image
193+
// COMPILE-PLUS-OBJECT-MACHO: 3: link, {0, 2}, image
156194

157195

158-
// RUN: %swiftc_driver -driver-print-actions %S/Inputs/main.swift %S/../Inputs/empty.swift %s -module-name actions -force-single-frontend-invocation 2>&1 | %FileCheck %s -check-prefix=WHOLE-MODULE
196+
// RUN: %swiftc_driver -driver-print-actions %S/Inputs/main.swift %S/../Inputs/empty.swift %s -module-name actions -force-single-frontend-invocation 2>&1 | %FileCheck %s -check-prefix=WHOLE-MODULE -check-prefix WHOLE-MODULE-%target-object-format
159197
// WHOLE-MODULE: 0: input, "{{.*}}Inputs/main.swift", swift
160198
// WHOLE-MODULE: 1: input, "{{.*}}Inputs/empty.swift", swift
161199
// WHOLE-MODULE: 2: input, "{{.*}}actions.swift", swift
162200
// WHOLE-MODULE: 3: compile, {0, 1, 2}, object
163-
// WHOLE-MODULE: 4: link, {3}, image
201+
// WHOLE-MODULE-COFF: 4: link, {3}, image
202+
// WHOLE-MODULE-ELF: 4: swift-autolink-extract, {3}, autolink
203+
// WHOLE-MODULE-ELF: 5: link, {3, 4}, image
204+
// WHOLE-MODULE-MACHO: 4: link, {3}, image

0 commit comments

Comments
 (0)