@@ -18,10 +18,17 @@ load("@bazel_skylib//rules:build_test.bzl", "build_test")
18
18
load (
19
19
"@build_bazel_rules_swift//test/rules:actions_created_test.bzl" ,
20
20
"actions_created_test" ,
21
+ "make_actions_created_test_rule" ,
21
22
)
22
23
23
24
visibility ("private" )
24
25
26
+ opt_actions_create_test = make_actions_created_test_rule (
27
+ config_settings = {
28
+ "//command_line_option:compilation_mode" : "opt" ,
29
+ },
30
+ )
31
+
25
32
def parallel_compilation_test_suite (name , tags = []):
26
33
"""Test suite for parallel compilation.
27
34
@@ -47,25 +54,46 @@ def parallel_compilation_test_suite(name, tags = []):
47
54
target_under_test = "@build_bazel_rules_swift//test/fixtures/parallel_compilation:no_opt_with_wmo" ,
48
55
)
49
56
50
- # Optimized, non-WMO cannot be compiled in parallel.
51
- # TODO: b/351801556 - This is actually incorrect based on further driver
52
- # testing; update the rules to allow compiling these in parallel.
57
+ # Optimized, non-WMO can be compiled in parallel.
53
58
actions_created_test (
54
59
name = "{}_with_opt_no_wmo" .format (name ),
55
- mnemonics = ["- SwiftCompileModule" , "- SwiftCompileCodegen" , "SwiftCompile" ],
60
+ mnemonics = ["SwiftCompileModule" , "SwiftCompileCodegen" , "- SwiftCompile" ],
56
61
tags = all_tags ,
57
62
target_under_test = "@build_bazel_rules_swift//test/fixtures/parallel_compilation:with_opt_no_wmo" ,
58
63
)
59
64
60
- # Optimized, with-WMO cannot be compiled in parallel.
61
- # TODO: b/351801556 - This should be allowed if cross-module-optimization is
62
- # disabled. Update the rules to allow this and add a new version of this
63
- # target that disables CMO so we can test both situtations.
65
+ # Optimized, with-WMO can be compiled in parallel if CMO is also disabled.
66
+ actions_created_test (
67
+ name = "{}_with_opt_with_wmo_no_cmo" .format (name ),
68
+ mnemonics = ["SwiftCompileModule" , "SwiftCompileCodegen" , "-SwiftCompile" ],
69
+ tags = all_tags ,
70
+ target_under_test = "@build_bazel_rules_swift//test/fixtures/parallel_compilation:with_opt_with_wmo_no_cmo" ,
71
+ )
72
+
73
+ # Optimized, with-WMO cannot be compiled in parallel if CMO is enabled.
64
74
actions_created_test (
65
- name = "{}_with_opt_with_wmo " .format (name ),
75
+ name = "{}_with_opt_with_wmo_with_cmo " .format (name ),
66
76
mnemonics = ["-SwiftCompileModule" , "-SwiftCompileCodegen" , "SwiftCompile" ],
67
77
tags = all_tags ,
68
- target_under_test = "@build_bazel_rules_swift//test/fixtures/parallel_compilation:with_opt_with_wmo" ,
78
+ target_under_test = "@build_bazel_rules_swift//test/fixtures/parallel_compilation:with_opt_with_wmo_with_cmo" ,
79
+ )
80
+
81
+ # Force `-c opt` on a non-optimized, with-WMO target and make sure we don't
82
+ # plan parallel compilation there.
83
+ opt_actions_create_test (
84
+ name = "{}_no_opt_with_wmo_but_compilation_mode_opt" .format (name ),
85
+ mnemonics = ["-SwiftCompileModule" , "-SwiftCompileCodegen" , "SwiftCompile" ],
86
+ tags = all_tags ,
87
+ target_under_test = "@build_bazel_rules_swift//test/fixtures/parallel_compilation:no_opt_with_wmo" ,
88
+ )
89
+
90
+ # Optimized, with-WMO can be compiled in parallel if library evolution is
91
+ # enabled (which implicitly disables CMO).
92
+ actions_created_test (
93
+ name = "{}_with_opt_with_wmo_with_library_evolution" .format (name ),
94
+ mnemonics = ["SwiftCompileModule" , "SwiftCompileCodegen" , "-SwiftCompile" ],
95
+ tags = all_tags ,
96
+ target_under_test = "@build_bazel_rules_swift//test/fixtures/parallel_compilation:with_opt_with_wmo_with_library_evolution" ,
69
97
)
70
98
71
99
# Make sure that when we look for optimizer flags, we don't treat `-Onone`
@@ -85,7 +113,9 @@ def parallel_compilation_test_suite(name, tags = []):
85
113
"@build_bazel_rules_swift//test/fixtures/parallel_compilation:no_opt_no_wmo" ,
86
114
"@build_bazel_rules_swift//test/fixtures/parallel_compilation:no_opt_with_wmo" ,
87
115
"@build_bazel_rules_swift//test/fixtures/parallel_compilation:with_opt_no_wmo" ,
88
- "@build_bazel_rules_swift//test/fixtures/parallel_compilation:with_opt_with_wmo" ,
116
+ "@build_bazel_rules_swift//test/fixtures/parallel_compilation:with_opt_with_wmo_no_cmo" ,
117
+ "@build_bazel_rules_swift//test/fixtures/parallel_compilation:with_opt_with_wmo_with_cmo" ,
118
+ "@build_bazel_rules_swift//test/fixtures/parallel_compilation:with_opt_with_wmo_with_library_evolution" ,
89
119
"@build_bazel_rules_swift//test/fixtures/parallel_compilation:onone_with_wmo" ,
90
120
],
91
121
tags = all_tags ,
0 commit comments