4949 },
5050 "lld" : {"bolt" , "cross-project-tests" },
5151 # TODO(issues/132795): LLDB should be enabled on clang changes.
52- "clang" : {"clang-tools-extra" , "cross-project-tests" },
52+ "clang" : {"clang-tools-extra" , "compiler-rt" , "cross-project-tests" },
53+ "clang-tools-extra" : {"libc" },
5354 "mlir" : {"flang" },
5455 # Test everything if ci scripts are changed.
5556 ".ci" : {
7475
7576# This mapping describes runtimes that should be tested when the key project is
7677# touched.
77- DEPENDENT_RUNTIMES_TO_TEST = {
78- "clang" : {"compiler-rt" },
79- "clang-tools-extra" : {"libc" },
80- ".ci" : {"compiler-rt" , "libc" },
81- }
82- DEPENDENT_RUNTIMES_TO_TEST_NEEDS_RECONFIG = {
83- "llvm" : {"libcxx" , "libcxxabi" , "libunwind" },
84- "clang" : {"libcxx" , "libcxxabi" , "libunwind" },
85- ".ci" : {"libcxx" , "libcxxabi" , "libunwind" },
86- }
78+ DEPENDENT_RUNTIMES_TO_TEST = {"clang" : {"libcxx" , "libcxxabi" , "libunwind" }}
8779
8880EXCLUDE_LINUX = {
8981 "cross-project-tests" , # TODO(issues/132796): Tests are failing.
112104 "cross-project-tests" ,
113105 "flang" ,
114106 "libc" ,
107+ "libcxx" ,
108+ "libcxxabi" ,
109+ "libunwind" ,
115110 "lldb" ,
116111 "openmp" ,
117112 "polly" ,
138133 "polly" : "check-polly" ,
139134}
140135
141- RUNTIMES = {"libcxx" , "libcxxabi" , "libunwind" , "compiler-rt" , "libc" }
136+ RUNTIMES = {"libcxx" , "libcxxabi" , "libunwind" }
142137
143138
144- def _add_dependencies (projects : Set [str ], runtimes : Set [ str ] ) -> Set [str ]:
139+ def _add_dependencies (projects : Set [str ]) -> Set [str ]:
145140 projects_with_dependents = set (projects )
146141 current_projects_count = 0
147142 while current_projects_count != len (projects_with_dependents ):
148143 current_projects_count = len (projects_with_dependents )
149144 for project in list (projects_with_dependents ):
150- if project in PROJECT_DEPENDENCIES :
151- projects_with_dependents .update (PROJECT_DEPENDENCIES [project ])
152- for runtime in runtimes :
153- if runtime in PROJECT_DEPENDENCIES :
154- projects_with_dependents .update (PROJECT_DEPENDENCIES [runtime ])
145+ if project not in PROJECT_DEPENDENCIES :
146+ continue
147+ projects_with_dependents .update (PROJECT_DEPENDENCIES [project ])
155148 return projects_with_dependents
156149
157150
158- def _exclude_projects (current_projects : Set [str ], platform : str ) -> Set [str ]:
159- if platform == "Linux" :
160- to_exclude = EXCLUDE_LINUX
161- elif platform == "Windows" :
162- to_exclude = EXCLUDE_WINDOWS
163- elif platform == "Darwin" :
164- to_exclude = EXCLUDE_MAC
165- else :
166- raise ValueError (f"Unexpected platform: { platform } " )
167- return current_projects .difference (to_exclude )
168-
169-
170151def _compute_projects_to_test (modified_projects : Set [str ], platform : str ) -> Set [str ]:
171152 projects_to_test = set ()
172153 for modified_project in modified_projects :
@@ -184,14 +165,25 @@ def _compute_projects_to_test(modified_projects: Set[str], platform: str) -> Set
184165 ):
185166 continue
186167 projects_to_test .add (dependent_project )
187- projects_to_test = _exclude_projects (projects_to_test , platform )
168+ if platform == "Linux" :
169+ for to_exclude in EXCLUDE_LINUX :
170+ if to_exclude in projects_to_test :
171+ projects_to_test .remove (to_exclude )
172+ elif platform == "Windows" :
173+ for to_exclude in EXCLUDE_WINDOWS :
174+ if to_exclude in projects_to_test :
175+ projects_to_test .remove (to_exclude )
176+ elif platform == "Darwin" :
177+ for to_exclude in EXCLUDE_MAC :
178+ if to_exclude in projects_to_test :
179+ projects_to_test .remove (to_exclude )
180+ else :
181+ raise ValueError ("Unexpected platform." )
188182 return projects_to_test
189183
190184
191- def _compute_projects_to_build (
192- projects_to_test : Set [str ], runtimes : Set [str ]
193- ) -> Set [str ]:
194- return _add_dependencies (projects_to_test , runtimes )
185+ def _compute_projects_to_build (projects_to_test : Set [str ]) -> Set [str ]:
186+ return _add_dependencies (projects_to_test )
195187
196188
197189def _compute_project_check_targets (projects_to_test : Set [str ]) -> Set [str ]:
@@ -202,34 +194,24 @@ def _compute_project_check_targets(projects_to_test: Set[str]) -> Set[str]:
202194 return check_targets
203195
204196
205- def _compute_runtimes_to_test (modified_projects : Set [str ], platform : str ) -> Set [str ]:
197+ def _compute_runtimes_to_test (projects_to_test : Set [str ]) -> Set [str ]:
206198 runtimes_to_test = set ()
207- for modified_project in modified_projects :
208- if modified_project in DEPENDENT_RUNTIMES_TO_TEST :
209- runtimes_to_test .update (DEPENDENT_RUNTIMES_TO_TEST [modified_project ])
210- return _exclude_projects (runtimes_to_test , platform )
211-
212-
213- def _compute_runtimes_to_test_needs_reconfig (
214- modified_projects : Set [str ], platform : str
215- ) -> Set [str ]:
216- runtimes_to_test = set ()
217- for modified_project in modified_projects :
218- if modified_project in DEPENDENT_RUNTIMES_TO_TEST_NEEDS_RECONFIG :
219- runtimes_to_test .update (
220- DEPENDENT_RUNTIMES_TO_TEST_NEEDS_RECONFIG [modified_project ]
221- )
222- return _exclude_projects (runtimes_to_test , platform )
199+ for project_to_test in projects_to_test :
200+ if project_to_test in DEPENDENT_RUNTIMES_TO_TEST :
201+ runtimes_to_test .update (DEPENDENT_RUNTIMES_TO_TEST [project_to_test ])
202+ if project_to_test in DEPENDENT_RUNTIMES_TO_BUILD :
203+ runtimes_to_test .update (DEPENDENT_RUNTIMES_TO_BUILD [project_to_test ])
204+ return runtimes_to_test
223205
224206
225- def _compute_runtimes_to_build (
226- runtimes_to_test : Set [ str ], modified_projects : Set [ str ], platform : str
227- ) -> Set [ str ] :
228- runtimes_to_build = set ( runtimes_to_test )
229- for modified_project in modified_projects :
230- if modified_project in DEPENDENT_RUNTIMES_TO_BUILD :
231- runtimes_to_build . update ( DEPENDENT_RUNTIMES_TO_BUILD [ modified_project ])
232- return _exclude_projects ( runtimes_to_build , platform )
207+ def _compute_runtime_check_targets ( projects_to_test : Set [ str ]) -> Set [ str ]:
208+ check_targets = set ()
209+ for project_to_test in projects_to_test :
210+ if project_to_test not in DEPENDENT_RUNTIMES_TO_TEST :
211+ continue
212+ for runtime_to_test in DEPENDENT_RUNTIMES_TO_TEST [ project_to_test ] :
213+ check_targets . add ( PROJECT_CHECK_TARGETS [ runtime_to_test ])
214+ return check_targets
233215
234216
235217def _get_modified_projects (modified_files : list [str ]) -> Set [str ]:
@@ -253,19 +235,10 @@ def _get_modified_projects(modified_files: list[str]) -> Set[str]:
253235def get_env_variables (modified_files : list [str ], platform : str ) -> Set [str ]:
254236 modified_projects = _get_modified_projects (modified_files )
255237 projects_to_test = _compute_projects_to_test (modified_projects , platform )
256- runtimes_to_test = _compute_runtimes_to_test (modified_projects , platform )
257- runtimes_to_test_needs_reconfig = _compute_runtimes_to_test_needs_reconfig (
258- modified_projects , platform
259- )
260- runtimes_to_build = _compute_runtimes_to_build (
261- runtimes_to_test | runtimes_to_test_needs_reconfig , modified_projects , platform
262- )
263- projects_to_build = _compute_projects_to_build (projects_to_test , runtimes_to_build )
238+ projects_to_build = _compute_projects_to_build (projects_to_test )
264239 projects_check_targets = _compute_project_check_targets (projects_to_test )
265- runtimes_check_targets = _compute_project_check_targets (runtimes_to_test )
266- runtimes_check_targets_needs_reconfig = _compute_project_check_targets (
267- runtimes_to_test_needs_reconfig
268- )
240+ runtimes_to_build = _compute_runtimes_to_test (projects_to_test )
241+ runtimes_check_targets = _compute_runtime_check_targets (projects_to_test )
269242 # We use a semicolon to separate the projects/runtimes as they get passed
270243 # to the CMake invocation and thus we need to use the CMake list separator
271244 # (;). We use spaces to separate the check targets as they end up getting
@@ -275,9 +248,6 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
275248 "project_check_targets" : " " .join (sorted (projects_check_targets )),
276249 "runtimes_to_build" : ";" .join (sorted (runtimes_to_build )),
277250 "runtimes_check_targets" : " " .join (sorted (runtimes_check_targets )),
278- "runtimes_check_targets_needs_reconfig" : " " .join (
279- sorted (runtimes_check_targets_needs_reconfig )
280- ),
281251 }
282252
283253
0 commit comments