Skip to content

Commit 070ce86

Browse files
committed
Revert "Reapply "[CI] Migrate to runtimes build""
Looks like reverting this commit solves the broken presubmit. Fixes #145703
1 parent 63f30d7 commit 070ce86

File tree

4 files changed

+53
-138
lines changed

4 files changed

+53
-138
lines changed

.ci/compute_projects.py

Lines changed: 45 additions & 75 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
".ci": {
@@ -74,16 +75,7 @@
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

8880
EXCLUDE_LINUX = {
8981
"cross-project-tests", # TODO(issues/132796): Tests are failing.
@@ -112,6 +104,9 @@
112104
"cross-project-tests",
113105
"flang",
114106
"libc",
107+
"libcxx",
108+
"libcxxabi",
109+
"libunwind",
115110
"lldb",
116111
"openmp",
117112
"polly",
@@ -138,35 +133,21 @@
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-
170151
def _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

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

235217
def _get_modified_projects(modified_files: list[str]) -> Set[str]:
@@ -253,19 +235,10 @@ def _get_modified_projects(modified_files: list[str]) -> Set[str]:
253235
def 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

.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(
@@ -230,15 +201,10 @@ def test_ci(self):
230201
"check-bolt check-clang check-clang-tools check-flang check-lld check-lldb check-llvm check-mlir check-polly",
231202
)
232203
self.assertEqual(
233-
env_variables["runtimes_to_build"],
234-
"compiler-rt;libc;libcxx;libcxxabi;libunwind",
204+
env_variables["runtimes_to_build"], "libcxx;libcxxabi;libunwind"
235205
)
236206
self.assertEqual(
237207
env_variables["runtimes_check_targets"],
238-
"check-compiler-rt check-libc",
239-
)
240-
self.assertEqual(
241-
env_variables["runtimes_check_targets_needs_reconfig"],
242208
"check-cxx check-cxxabi check-unwind",
243209
)
244210

@@ -252,19 +218,6 @@ def test_lldb(self):
252218
env_variables["runtimes_to_build"], "libcxx;libcxxabi;libunwind"
253219
)
254220
self.assertEqual(env_variables["runtimes_check_targets"], "")
255-
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
256-
257-
def test_clang_tools_extra(self):
258-
env_variables = compute_projects.get_env_variables(
259-
["clang-tools-extra/CMakeLists.txt"], "Linux"
260-
)
261-
self.assertEqual(
262-
env_variables["projects_to_build"], "clang;clang-tools-extra;lld;llvm"
263-
)
264-
self.assertEqual(env_variables["project_check_targets"], "check-clang-tools")
265-
self.assertEqual(env_variables["runtimes_to_build"], "libc")
266-
self.assertEqual(env_variables["runtimes_check_targets"], "check-libc")
267-
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
268221

269222

270223
if __name__ == "__main__":

0 commit comments

Comments
 (0)