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    # FIXME: Figure out what is missing and add here. 
6364
6465# This mapping describes runtimes that should be tested when the key project is 
6566# touched. 
66- DEPENDENT_RUNTIMES_TO_TEST  =  {
67-     "clang" : {"compiler-rt" },
68-     "clang-tools-extra" : {"libc" },
69- }
70- DEPENDENT_RUNTIMES_TO_TEST_NEEDS_RECONFIG  =  {
71-     "llvm" : {"libcxx" , "libcxxabi" , "libunwind" },
72-     "clang" : {"libcxx" , "libcxxabi" , "libunwind" },
73-     ".ci" : {"libcxx" , "libcxxabi" , "libunwind" },
74- }
67+ DEPENDENT_RUNTIMES_TO_TEST  =  {"clang" : {"libcxx" , "libcxxabi" , "libunwind" }}
7568
7669EXCLUDE_LINUX  =  {
7770    "cross-project-tests" ,  # TODO(issues/132796): Tests are failing. 
10093    "cross-project-tests" ,
10194    "flang" ,
10295    "libc" ,
96+     "libcxx" ,
97+     "libcxxabi" ,
98+     "libunwind" ,
10399    "lldb" ,
104100    "openmp" ,
105101    "polly" ,
126122    "polly" : "check-polly" ,
127123}
128124
129- RUNTIMES  =  {"libcxx" , "libcxxabi" , "libunwind" ,  "compiler-rt" ,  "libc" }
125+ RUNTIMES  =  {"libcxx" , "libcxxabi" , "libunwind" }
130126
131127
132- def  _add_dependencies (projects : Set [str ],  runtimes :  Set [ str ] ) ->  Set [str ]:
128+ def  _add_dependencies (projects : Set [str ]) ->  Set [str ]:
133129    projects_with_dependents  =  set (projects )
134130    current_projects_count  =  0 
135131    while  current_projects_count  !=  len (projects_with_dependents ):
@@ -138,25 +134,9 @@ def _add_dependencies(projects: Set[str], runtimes: Set[str]) -> Set[str]:
138134            if  project  not  in   PROJECT_DEPENDENCIES :
139135                continue 
140136            projects_with_dependents .update (PROJECT_DEPENDENCIES [project ])
141-     for  runtime  in  runtimes :
142-         if  runtime  not  in   PROJECT_DEPENDENCIES :
143-             continue 
144-         projects_with_dependents .update (PROJECT_DEPENDENCIES [runtime ])
145137    return  projects_with_dependents 
146138
147139
148- def  _exclude_projects (current_projects : Set [str ], platform : str ) ->  Set [str ]:
149-     if  platform  ==  "Linux" :
150-         to_exclude  =  EXCLUDE_LINUX 
151-     elif  platform  ==  "Windows" :
152-         to_exclude  =  EXCLUDE_WINDOWS 
153-     elif  platform  ==  "Darwin" :
154-         to_exclude  =  EXCLUDE_MAC 
155-     else :
156-         raise  ValueError (f"Unexpected platform: { platform }  " )
157-     return  current_projects .difference (to_exclude )
158- 
159- 
160140def  _compute_projects_to_test (modified_projects : Set [str ], platform : str ) ->  Set [str ]:
161141    projects_to_test  =  set ()
162142    for  modified_project  in  modified_projects :
@@ -174,14 +154,25 @@ def _compute_projects_to_test(modified_projects: Set[str], platform: str) -> Set
174154            ):
175155                continue 
176156            projects_to_test .add (dependent_project )
177-     projects_to_test  =  _exclude_projects (projects_to_test , platform )
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." )
178171    return  projects_to_test 
179172
180173
181- def  _compute_projects_to_build (
182-     projects_to_test : Set [str ], runtimes : Set [str ]
183- ) ->  Set [str ]:
184-     return  _add_dependencies (projects_to_test , runtimes )
174+ def  _compute_projects_to_build (projects_to_test : Set [str ]) ->  Set [str ]:
175+     return  _add_dependencies (projects_to_test )
185176
186177
187178def  _compute_project_check_targets (projects_to_test : Set [str ]) ->  Set [str ]:
@@ -193,36 +184,24 @@ def _compute_project_check_targets(projects_to_test: Set[str]) -> Set[str]:
193184    return  check_targets 
194185
195186
196- def  _compute_runtimes_to_test (modified_projects : Set [str ],  platform :  str ) ->  Set [str ]:
187+ def  _compute_runtimes_to_test (projects_to_test : Set [str ]) ->  Set [str ]:
197188    runtimes_to_test  =  set ()
198-     for  modified_project  in  modified_projects :
199-         if  modified_project  not  in   DEPENDENT_RUNTIMES_TO_TEST :
200-             continue 
201-         runtimes_to_test .update (DEPENDENT_RUNTIMES_TO_TEST [modified_project ])
202-     return  _exclude_projects (runtimes_to_test , platform )
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 
203195
204196
205- def  _compute_runtimes_to_test_needs_reconfig (
206-     modified_projects : Set [str ], platform : str 
207- ) ->  Set [str ]:
208-     runtimes_to_test  =  set ()
209-     for  modified_project  in  modified_projects :
210-         if  modified_project  not  in   DEPENDENT_RUNTIMES_TO_TEST_NEEDS_RECONFIG :
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 :
211201            continue 
212-         runtimes_to_test .update (
213-             DEPENDENT_RUNTIMES_TO_TEST_NEEDS_RECONFIG [modified_project ]
214-         )
215-     return  _exclude_projects (runtimes_to_test , platform )
216- 
217- 
218- def  _compute_runtimes_to_build (
219-     runtimes_to_test : Set [str ], modified_projects : Set [str ], platform : str 
220- ) ->  Set [str ]:
221-     runtimes_to_build  =  set (runtimes_to_test )
222-     for  modified_project  in  modified_projects :
223-         if  modified_project  in  DEPENDENT_RUNTIMES_TO_BUILD :
224-             runtimes_to_build .update (DEPENDENT_RUNTIMES_TO_BUILD [modified_project ])
225-     return  _exclude_projects (runtimes_to_build , platform )
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 
226205
227206
228207def  _get_modified_projects (modified_files : list [str ]) ->  Set [str ]:
@@ -246,19 +225,10 @@ def _get_modified_projects(modified_files: list[str]) -> Set[str]:
246225def  get_env_variables (modified_files : list [str ], platform : str ) ->  Set [str ]:
247226    modified_projects  =  _get_modified_projects (modified_files )
248227    projects_to_test  =  _compute_projects_to_test (modified_projects , platform )
249-     runtimes_to_test  =  _compute_runtimes_to_test (modified_projects , platform )
250-     runtimes_to_test_needs_reconfig  =  _compute_runtimes_to_test_needs_reconfig (
251-         modified_projects , platform 
252-     )
253-     runtimes_to_build  =  _compute_runtimes_to_build (
254-         runtimes_to_test  |  runtimes_to_test_needs_reconfig , modified_projects , platform 
255-     )
256-     projects_to_build  =  _compute_projects_to_build (projects_to_test , runtimes_to_build )
228+     projects_to_build  =  _compute_projects_to_build (projects_to_test )
257229    projects_check_targets  =  _compute_project_check_targets (projects_to_test )
258-     runtimes_check_targets  =  _compute_project_check_targets (runtimes_to_test )
259-     runtimes_check_targets_needs_reconfig  =  _compute_project_check_targets (
260-         runtimes_to_test_needs_reconfig 
261-     )
230+     runtimes_to_build  =  _compute_runtimes_to_test (projects_to_test )
231+     runtimes_check_targets  =  _compute_runtime_check_targets (projects_to_test )
262232    # We use a semicolon to separate the projects/runtimes as they get passed 
263233    # to the CMake invocation and thus we need to use the CMake list separator 
264234    # (;). We use spaces to separate the check targets as they end up getting 
@@ -268,9 +238,6 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
268238        "project_check_targets" : " " .join (sorted (projects_check_targets )),
269239        "runtimes_to_build" : ";" .join (sorted (runtimes_to_build )),
270240        "runtimes_check_targets" : " " .join (sorted (runtimes_check_targets )),
271-         "runtimes_check_targets_needs_reconfig" : " " .join (
272-             sorted (runtimes_check_targets_needs_reconfig )
273-         ),
274241    }
275242
276243
0 commit comments