Skip to content

Commit 41c53fb

Browse files
authored
Merge branch 'main' into cir_vec_cmp_fold
2 parents 655fd1f + 8d7da9a commit 41c53fb

File tree

640 files changed

+19228
-7066
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

640 files changed

+19228
-7066
lines changed

.ci/compute_projects.py

Lines changed: 41 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
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.
@@ -63,15 +64,7 @@
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

7669
EXCLUDE_LINUX = {
7770
"cross-project-tests", # TODO(issues/132796): Tests are failing.
@@ -100,6 +93,9 @@
10093
"cross-project-tests",
10194
"flang",
10295
"libc",
96+
"libcxx",
97+
"libcxxabi",
98+
"libunwind",
10399
"lldb",
104100
"openmp",
105101
"polly",
@@ -126,10 +122,10 @@
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-
160140
def _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

187178
def _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

228207
def _get_modified_projects(modified_files: list[str]) -> Set[str]:
@@ -246,19 +225,10 @@ def _get_modified_projects(modified_files: list[str]) -> Set[str]:
246225
def 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

.ci/compute_projects_test.py

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ def test_llvm(self):
2626
)
2727
self.assertEqual(
2828
env_variables["runtimes_check_targets"],
29-
"",
30-
)
31-
self.assertEqual(
32-
env_variables["runtimes_check_targets_needs_reconfig"],
3329
"check-cxx check-cxxabi check-unwind",
3430
)
3531

@@ -50,10 +46,6 @@ def test_llvm_windows(self):
5046
)
5147
self.assertEqual(
5248
env_variables["runtimes_check_targets"],
53-
"",
54-
)
55-
self.assertEqual(
56-
env_variables["runtimes_check_targets_needs_reconfig"],
5749
"check-cxx check-cxxabi check-unwind",
5850
)
5951

@@ -74,10 +66,6 @@ def test_llvm_mac(self):
7466
)
7567
self.assertEqual(
7668
env_variables["runtimes_check_targets"],
77-
"",
78-
)
79-
self.assertEqual(
80-
env_variables["runtimes_check_targets_needs_reconfig"],
8169
"check-cxx check-cxxabi check-unwind",
8270
)
8371

@@ -87,21 +75,17 @@ def test_clang(self):
8775
)
8876
self.assertEqual(
8977
env_variables["projects_to_build"],
90-
"clang;clang-tools-extra;lld;llvm",
78+
"clang;clang-tools-extra;compiler-rt;lld;llvm",
9179
)
9280
self.assertEqual(
9381
env_variables["project_check_targets"],
94-
"check-clang check-clang-tools",
82+
"check-clang check-clang-tools check-compiler-rt",
9583
)
9684
self.assertEqual(
97-
env_variables["runtimes_to_build"], "compiler-rt;libcxx;libcxxabi;libunwind"
85+
env_variables["runtimes_to_build"], "libcxx;libcxxabi;libunwind"
9886
)
9987
self.assertEqual(
10088
env_variables["runtimes_check_targets"],
101-
"check-compiler-rt",
102-
)
103-
self.assertEqual(
104-
env_variables["runtimes_check_targets_needs_reconfig"],
10589
"check-cxx check-cxxabi check-unwind",
10690
)
10791

@@ -120,10 +104,6 @@ def test_clang_windows(self):
120104
)
121105
self.assertEqual(
122106
env_variables["runtimes_check_targets"],
123-
"",
124-
)
125-
self.assertEqual(
126-
env_variables["runtimes_check_targets_needs_reconfig"],
127107
"check-cxx check-cxxabi check-unwind",
128108
)
129109

@@ -135,7 +115,6 @@ def test_bolt(self):
135115
self.assertEqual(env_variables["project_check_targets"], "check-bolt")
136116
self.assertEqual(env_variables["runtimes_to_build"], "")
137117
self.assertEqual(env_variables["runtimes_check_targets"], "")
138-
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
139118

140119
def test_lldb(self):
141120
env_variables = compute_projects.get_env_variables(
@@ -145,7 +124,6 @@ def test_lldb(self):
145124
self.assertEqual(env_variables["project_check_targets"], "check-lldb")
146125
self.assertEqual(env_variables["runtimes_to_build"], "")
147126
self.assertEqual(env_variables["runtimes_check_targets"], "")
148-
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
149127

150128
def test_mlir(self):
151129
env_variables = compute_projects.get_env_variables(
@@ -157,7 +135,6 @@ def test_mlir(self):
157135
)
158136
self.assertEqual(env_variables["runtimes_to_build"], "")
159137
self.assertEqual(env_variables["runtimes_check_targets"], "")
160-
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
161138

162139
def test_flang(self):
163140
env_variables = compute_projects.get_env_variables(
@@ -167,7 +144,6 @@ def test_flang(self):
167144
self.assertEqual(env_variables["project_check_targets"], "check-flang")
168145
self.assertEqual(env_variables["runtimes_to_build"], "")
169146
self.assertEqual(env_variables["runtimes_check_targets"], "")
170-
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
171147

172148
def test_invalid_subproject(self):
173149
env_variables = compute_projects.get_env_variables(
@@ -177,15 +153,13 @@ def test_invalid_subproject(self):
177153
self.assertEqual(env_variables["project_check_targets"], "")
178154
self.assertEqual(env_variables["runtimes_to_build"], "")
179155
self.assertEqual(env_variables["runtimes_check_targets"], "")
180-
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
181156

182157
def test_top_level_file(self):
183158
env_variables = compute_projects.get_env_variables(["README.md"], "Linux")
184159
self.assertEqual(env_variables["projects_to_build"], "")
185160
self.assertEqual(env_variables["project_check_targets"], "")
186161
self.assertEqual(env_variables["runtimes_to_build"], "")
187162
self.assertEqual(env_variables["runtimes_check_targets"], "")
188-
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
189163

190164
def test_exclude_runtiems_in_projects(self):
191165
env_variables = compute_projects.get_env_variables(
@@ -195,7 +169,6 @@ def test_exclude_runtiems_in_projects(self):
195169
self.assertEqual(env_variables["project_check_targets"], "")
196170
self.assertEqual(env_variables["runtimes_to_build"], "")
197171
self.assertEqual(env_variables["runtimes_check_targets"], "")
198-
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
199172

200173
def test_exclude_docs(self):
201174
env_variables = compute_projects.get_env_variables(
@@ -205,7 +178,6 @@ def test_exclude_docs(self):
205178
self.assertEqual(env_variables["project_check_targets"], "")
206179
self.assertEqual(env_variables["runtimes_to_build"], "")
207180
self.assertEqual(env_variables["runtimes_check_targets"], "")
208-
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
209181

210182
def test_exclude_gn(self):
211183
env_variables = compute_projects.get_env_variables(
@@ -215,7 +187,6 @@ def test_exclude_gn(self):
215187
self.assertEqual(env_variables["project_check_targets"], "")
216188
self.assertEqual(env_variables["runtimes_to_build"], "")
217189
self.assertEqual(env_variables["runtimes_check_targets"], "")
218-
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
219190

220191
def test_ci(self):
221192
env_variables = compute_projects.get_env_variables(
@@ -227,15 +198,10 @@ def test_ci(self):
227198
"check-clang check-lld check-lldb check-llvm",
228199
)
229200
self.assertEqual(
230-
env_variables["runtimes_to_build"],
231-
"libcxx;libcxxabi;libunwind",
201+
env_variables["runtimes_to_build"], "libcxx;libcxxabi;libunwind"
232202
)
233203
self.assertEqual(
234204
env_variables["runtimes_check_targets"],
235-
"",
236-
)
237-
self.assertEqual(
238-
env_variables["runtimes_check_targets_needs_reconfig"],
239205
"check-cxx check-cxxabi check-unwind",
240206
)
241207

@@ -249,19 +215,6 @@ def test_lldb(self):
249215
env_variables["runtimes_to_build"], "libcxx;libcxxabi;libunwind"
250216
)
251217
self.assertEqual(env_variables["runtimes_check_targets"], "")
252-
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
253-
254-
def test_clang_tools_extra(self):
255-
env_variables = compute_projects.get_env_variables(
256-
["clang-tools-extra/CMakeLists.txt"], "Linux"
257-
)
258-
self.assertEqual(
259-
env_variables["projects_to_build"], "clang;clang-tools-extra;lld;llvm"
260-
)
261-
self.assertEqual(env_variables["project_check_targets"], "check-clang-tools")
262-
self.assertEqual(env_variables["runtimes_to_build"], "libc")
263-
self.assertEqual(env_variables["runtimes_check_targets"], "check-libc")
264-
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
265218

266219

267220
if __name__ == "__main__":

0 commit comments

Comments
 (0)