49
49
},
50
50
"lld" : {"bolt" , "cross-project-tests" },
51
51
# TODO(issues/132795): LLDB should be enabled on clang changes.
52
- "clang" : {"clang-tools-extra" , "compiler-rt" , "cross-project-tests" },
53
- "clang-tools-extra" : {"libc" },
52
+ "clang" : {"clang-tools-extra" , "cross-project-tests" },
54
53
"mlir" : {"flang" },
55
54
# Test everything if ci scripts are changed.
56
55
# FIXME: Figure out what is missing and add here.
64
63
65
64
# This mapping describes runtimes that should be tested when the key project is
66
65
# touched.
67
- DEPENDENT_RUNTIMES_TO_TEST = {"clang" : {"libcxx" , "libcxxabi" , "libunwind" }}
66
+ DEPENDENT_RUNTIMES_TO_TEST = {
67
+ "clang" : {"compiler-rt" },
68
+ }
69
+ DEPENDENT_RUNTIMES_TO_TEST_MULTICONFIG = {
70
+ "llvm" : {"libcxx" , "libcxxabi" , "libunwind" },
71
+ "clang" : {"libcxx" , "libcxxabi" , "libunwind" },
72
+ ".ci" : {"libcxx" , "libcxxabi" , "libunwind" },
73
+ }
68
74
69
75
EXCLUDE_LINUX = {
70
76
"cross-project-tests" , # TODO(issues/132796): Tests are failing.
93
99
"cross-project-tests" ,
94
100
"flang" ,
95
101
"libc" ,
96
- "libcxx" ,
97
- "libcxxabi" ,
98
- "libunwind" ,
99
102
"lldb" ,
100
103
"openmp" ,
101
104
"polly" ,
122
125
"polly" : "check-polly" ,
123
126
}
124
127
125
- RUNTIMES = {"libcxx" , "libcxxabi" , "libunwind" }
128
+ RUNTIMES = {"libcxx" , "libcxxabi" , "libunwind" , "compiler-rt" , "libc" }
126
129
127
130
128
- def _add_dependencies (projects : Set [str ]) -> Set [str ]:
131
+ def _add_dependencies (projects : Set [str ], runtimes : Set [ str ] ) -> Set [str ]:
129
132
projects_with_dependents = set (projects )
130
133
current_projects_count = 0
131
134
while current_projects_count != len (projects_with_dependents ):
@@ -134,9 +137,25 @@ def _add_dependencies(projects: Set[str]) -> Set[str]:
134
137
if project not in PROJECT_DEPENDENCIES :
135
138
continue
136
139
projects_with_dependents .update (PROJECT_DEPENDENCIES [project ])
140
+ for runtime in runtimes :
141
+ if runtime not in PROJECT_DEPENDENCIES :
142
+ continue
143
+ projects_with_dependents .update (PROJECT_DEPENDENCIES [runtime ])
137
144
return projects_with_dependents
138
145
139
146
147
+ def _exclude_projects (current_projects : Set [str ], platform : str ) -> Set [str ]:
148
+ if platform == "Linux" :
149
+ to_exclude = EXCLUDE_LINUX
150
+ elif platform == "Windows" :
151
+ to_exclude = EXCLUDE_WINDOWS
152
+ elif platform == "Darwin" :
153
+ to_exclude = EXCLUDE_MAC
154
+ else :
155
+ raise ValueError (f"Unexpected platform: { platform } " )
156
+ return current_projects .difference (to_exclude )
157
+
158
+
140
159
def _compute_projects_to_test (modified_projects : Set [str ], platform : str ) -> Set [str ]:
141
160
projects_to_test = set ()
142
161
for modified_project in modified_projects :
@@ -154,25 +173,14 @@ def _compute_projects_to_test(modified_projects: Set[str], platform: str) -> Set
154
173
):
155
174
continue
156
175
projects_to_test .add (dependent_project )
157
- if platform == "Linux" :
158
- for to_exclude in EXCLUDE_LINUX :
159
- if to_exclude in projects_to_test :
160
- projects_to_test .remove (to_exclude )
161
- elif platform == "Windows" :
162
- for to_exclude in EXCLUDE_WINDOWS :
163
- if to_exclude in projects_to_test :
164
- projects_to_test .remove (to_exclude )
165
- elif platform == "Darwin" :
166
- for to_exclude in EXCLUDE_MAC :
167
- if to_exclude in projects_to_test :
168
- projects_to_test .remove (to_exclude )
169
- else :
170
- raise ValueError ("Unexpected platform." )
176
+ projects_to_test = _exclude_projects (projects_to_test , platform )
171
177
return projects_to_test
172
178
173
179
174
- def _compute_projects_to_build (projects_to_test : Set [str ]) -> Set [str ]:
175
- return _add_dependencies (projects_to_test )
180
+ def _compute_projects_to_build (
181
+ projects_to_test : Set [str ], runtimes : Set [str ]
182
+ ) -> Set [str ]:
183
+ return _add_dependencies (projects_to_test , runtimes )
176
184
177
185
178
186
def _compute_project_check_targets (projects_to_test : Set [str ]) -> Set [str ]:
@@ -184,24 +192,36 @@ def _compute_project_check_targets(projects_to_test: Set[str]) -> Set[str]:
184
192
return check_targets
185
193
186
194
187
- def _compute_runtimes_to_test (projects_to_test : Set [str ]) -> Set [str ]:
195
+ def _compute_runtimes_to_test (modified_projects : Set [str ], platform : str ) -> Set [str ]:
188
196
runtimes_to_test = set ()
189
- for project_to_test in projects_to_test :
190
- if project_to_test in DEPENDENT_RUNTIMES_TO_TEST :
191
- runtimes_to_test .update (DEPENDENT_RUNTIMES_TO_TEST [project_to_test ])
192
- if project_to_test in DEPENDENT_RUNTIMES_TO_BUILD :
193
- runtimes_to_test .update (DEPENDENT_RUNTIMES_TO_BUILD [project_to_test ])
194
- return runtimes_to_test
197
+ for modified_project in modified_projects :
198
+ if modified_project not in DEPENDENT_RUNTIMES_TO_TEST :
199
+ continue
200
+ runtimes_to_test .update (DEPENDENT_RUNTIMES_TO_TEST [modified_project ])
201
+ return _exclude_projects (runtimes_to_test , platform )
195
202
196
203
197
- def _compute_runtime_check_targets (projects_to_test : Set [str ]) -> Set [str ]:
198
- check_targets = set ()
199
- for project_to_test in projects_to_test :
200
- if project_to_test not in DEPENDENT_RUNTIMES_TO_TEST :
204
+ def _compute_runtimes_to_test_multiconfig (
205
+ modified_projects : Set [str ], platform : str
206
+ ) -> Set [str ]:
207
+ runtimes_to_test = set ()
208
+ for modified_project in modified_projects :
209
+ if modified_project not in DEPENDENT_RUNTIMES_TO_TEST_MULTICONFIG :
201
210
continue
202
- for runtime_to_test in DEPENDENT_RUNTIMES_TO_TEST [project_to_test ]:
203
- check_targets .add (PROJECT_CHECK_TARGETS [runtime_to_test ])
204
- return check_targets
211
+ runtimes_to_test .update (
212
+ DEPENDENT_RUNTIMES_TO_TEST_MULTICONFIG [modified_project ]
213
+ )
214
+ return _exclude_projects (runtimes_to_test , platform )
215
+
216
+
217
+ def _compute_runtimes_to_build (
218
+ runtimes_to_test : Set [str ], modified_projects : Set [str ], platform : str
219
+ ) -> Set [str ]:
220
+ runtimes_to_build = set (runtimes_to_test )
221
+ for modified_project in modified_projects :
222
+ if modified_project in DEPENDENT_RUNTIMES_TO_BUILD :
223
+ runtimes_to_build .update (DEPENDENT_RUNTIMES_TO_BUILD [modified_project ])
224
+ return _exclude_projects (runtimes_to_build , platform )
205
225
206
226
207
227
def _get_modified_projects (modified_files : list [str ]) -> Set [str ]:
@@ -225,10 +245,19 @@ def _get_modified_projects(modified_files: list[str]) -> Set[str]:
225
245
def get_env_variables (modified_files : list [str ], platform : str ) -> Set [str ]:
226
246
modified_projects = _get_modified_projects (modified_files )
227
247
projects_to_test = _compute_projects_to_test (modified_projects , platform )
228
- projects_to_build = _compute_projects_to_build (projects_to_test )
248
+ runtimes_to_test = _compute_runtimes_to_test (modified_projects , platform )
249
+ runtimes_to_test_multiconfig = _compute_runtimes_to_test_multiconfig (
250
+ modified_projects , platform
251
+ )
252
+ runtimes_to_build = _compute_runtimes_to_build (
253
+ runtimes_to_test | runtimes_to_test_multiconfig , modified_projects , platform
254
+ )
255
+ projects_to_build = _compute_projects_to_build (projects_to_test , runtimes_to_build )
229
256
projects_check_targets = _compute_project_check_targets (projects_to_test )
230
- runtimes_to_build = _compute_runtimes_to_test (projects_to_test )
231
- runtimes_check_targets = _compute_runtime_check_targets (projects_to_test )
257
+ runtimes_check_targets = _compute_project_check_targets (runtimes_to_test )
258
+ runtimes_check_targets_multiconfig = _compute_project_check_targets (
259
+ runtimes_to_test_multiconfig
260
+ )
232
261
# We use a semicolon to separate the projects/runtimes as they get passed
233
262
# to the CMake invocation and thus we need to use the CMake list separator
234
263
# (;). We use spaces to separate the check targets as they end up getting
@@ -238,6 +267,9 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
238
267
"project_check_targets" : " " .join (sorted (projects_check_targets )),
239
268
"runtimes_to_build" : ";" .join (sorted (runtimes_to_build )),
240
269
"runtimes_check_targets" : " " .join (sorted (runtimes_check_targets )),
270
+ "runtimes_check_targets_multiconfig" : " " .join (
271
+ sorted (runtimes_check_targets_multiconfig )
272
+ ),
241
273
}
242
274
243
275
0 commit comments