Skip to content

Commit b515a65

Browse files
committed
Add tests, inspired by Driver/batch_mode_with_WMO_or_index.swift
1 parent 9aa8bd0 commit b515a65

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

test/Driver/ast_dump_with_WMO.swift

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// RUN: %empty-directory(%t)
2+
3+
4+
// Check that -wmo is ignored when -dump-ast is present and that the AST gets
5+
// dumped to stdout, no matter the order of the options
6+
7+
// RUN: %swiftc_driver -whole-module-optimization -dump-ast -module-name=main %S/../Inputs/empty.swift -### 2>%t/stderr_WMO_dump | %FileCheck -check-prefix CHECK-STDOUT %s
8+
// RUN: %swiftc_driver -dump-ast -whole-module-optimization -module-name=main %S/../Inputs/empty.swift -### 2>%t/stderr_dump_WMO | %FileCheck -check-prefix CHECK-STDOUT %s
9+
// RUN: %FileCheck -check-prefix CHECK-WMO %s <%t/stderr_WMO_dump
10+
// RUN: %FileCheck -check-prefix CHECK-WMO %s <%t/stderr_dump_WMO
11+
12+
13+
// Check that ignoring -wmo doesn't affect the output file paths for the AST
14+
// dumps
15+
16+
// RUN: cd %t
17+
// RUN: echo ' ' > a.swift
18+
// RUN: echo ' ' > main.swift
19+
// RUN: echo '{ "a.swift": { "ast-dump": "a.ast" }, "main.swift": { "ast-dump": "main.ast" }}' > outputFileMap.json
20+
21+
// RUN: %swiftc_driver -whole-module-optimization -dump-ast -module-name=main -output-file-map=outputFileMap.json main.swift a.swift -### 2>%t/stderr_WMO_OFM | %FileCheck -check-prefix CHECK-OFM %s
22+
// RUN: %FileCheck -check-prefix CHECK-WMO %s <%t/stderr_WMO_OFM
23+
24+
25+
26+
// CHECK-WMO: warning: ignoring '-wmo' because '-dump-ast' was also specified
27+
28+
// CHECK-STDOUT-NOT: -whole-module-optimization
29+
// CHECK-STDOUT-NOT: -wmo
30+
// CHECK-STDOUT: -dump-ast
31+
// CHECK-STDOUT: -o -
32+
33+
// CHECK-OFM-NOT: -whole-module-optimization
34+
// CHECK-OFM-NOT: -wmo
35+
// CHECK-OFM: -dump-ast
36+
// CHECK-OFM-SAME: -o main.ast
37+
// CHECK-OFM-NEXT: -dump-ast
38+
// CHECK-OFM-SAME: -o a.ast

0 commit comments

Comments
 (0)