Skip to content

Commit 9154bd1

Browse files
authored
Merge branch 'main' into main
2 parents 0f350a6 + b3c9ed1 commit 9154bd1

File tree

7,657 files changed

+585710
-301252
lines changed

Some content is hidden

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

7,657 files changed

+585710
-301252
lines changed

.ci/compute_projects.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
PROJECT_DEPENDENCIES = {
2020
"llvm": set(),
2121
"clang": {"llvm"},
22+
"CIR": {"clang", "mlir"},
2223
"bolt": {"clang", "lld", "llvm"},
2324
"clang-tools-extra": {"clang", "llvm"},
2425
"compiler-rt": {"clang", "lld"},
@@ -55,6 +56,7 @@
5556
".ci": {
5657
"llvm",
5758
"clang",
59+
"CIR",
5860
"lld",
5961
"lldb",
6062
"bolt",
@@ -128,6 +130,7 @@
128130
"lldb": "check-lldb",
129131
"llvm": "check-llvm",
130132
"clang": "check-clang",
133+
"CIR": "check-clang-cir",
131134
"bolt": "check-bolt",
132135
"lld": "check-lld",
133136
"flang": "check-flang",
@@ -247,6 +250,14 @@ def _get_modified_projects(modified_files: list[str]) -> Set[str]:
247250
# capacity.
248251
if len(path_parts) > 3 and path_parts[:3] == ("llvm", "utils", "gn"):
249252
continue
253+
# If the file is in the clang/lib/CIR directory, add the CIR project.
254+
if len(path_parts) > 3 and (
255+
path_parts[:3] == ("clang", "lib", "CIR")
256+
or path_parts[:3] == ("clang", "test", "CIR")
257+
or path_parts[:4] == ("clang", "include", "clang", "CIR")
258+
):
259+
modified_projects.add("CIR")
260+
# Fall through to add clang.
250261
modified_projects.add(pathlib.Path(modified_file).parts[0])
251262
return modified_projects
252263

@@ -267,6 +278,13 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
267278
runtimes_check_targets_needs_reconfig = _compute_project_check_targets(
268279
runtimes_to_test_needs_reconfig
269280
)
281+
282+
# CIR is used as a pseudo-project in this script. It is built as part of the
283+
# clang build, but it requires an explicit option to enable. We set that
284+
# option here, and remove it from the projects_to_build list.
285+
enable_cir = "ON" if "CIR" in projects_to_build else "OFF"
286+
projects_to_build.discard("CIR")
287+
270288
# We use a semicolon to separate the projects/runtimes as they get passed
271289
# to the CMake invocation and thus we need to use the CMake list separator
272290
# (;). We use spaces to separate the check targets as they end up getting
@@ -279,6 +297,7 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
279297
"runtimes_check_targets_needs_reconfig": " ".join(
280298
sorted(runtimes_check_targets_needs_reconfig)
281299
),
300+
"enable_cir": enable_cir,
282301
}
283302

284303

.ci/compute_projects_test.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ def test_clang(self):
104104
env_variables["runtimes_check_targets_needs_reconfig"],
105105
"check-cxx check-cxxabi check-unwind",
106106
)
107+
self.assertEqual(
108+
env_variables["enable_cir"],
109+
"OFF",
110+
)
107111

108112
def test_clang_windows(self):
109113
env_variables = compute_projects.get_env_variables(
@@ -126,6 +130,32 @@ def test_clang_windows(self):
126130
env_variables["runtimes_check_targets_needs_reconfig"],
127131
"check-cxx check-cxxabi check-unwind",
128132
)
133+
self.assertEqual(env_variables["enable_cir"], "OFF")
134+
135+
def test_cir(self):
136+
env_variables = compute_projects.get_env_variables(
137+
["clang/lib/CIR/CMakeLists.txt"], "Linux"
138+
)
139+
self.assertEqual(
140+
env_variables["projects_to_build"],
141+
"clang;clang-tools-extra;lld;llvm;mlir",
142+
)
143+
self.assertEqual(
144+
env_variables["project_check_targets"],
145+
"check-clang check-clang-cir check-clang-tools",
146+
)
147+
self.assertEqual(
148+
env_variables["runtimes_to_build"], "compiler-rt;libcxx;libcxxabi;libunwind"
149+
)
150+
self.assertEqual(
151+
env_variables["runtimes_check_targets"],
152+
"check-compiler-rt",
153+
)
154+
self.assertEqual(
155+
env_variables["runtimes_check_targets_needs_reconfig"],
156+
"check-cxx check-cxxabi check-unwind",
157+
)
158+
self.assertEqual(env_variables["enable_cir"], "ON")
129159

130160
def test_bolt(self):
131161
env_variables = compute_projects.get_env_variables(
@@ -158,6 +188,7 @@ def test_mlir(self):
158188
self.assertEqual(env_variables["runtimes_to_build"], "")
159189
self.assertEqual(env_variables["runtimes_check_targets"], "")
160190
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
191+
self.assertEqual(env_variables["enable_cir"], "OFF")
161192

162193
def test_flang(self):
163194
env_variables = compute_projects.get_env_variables(
@@ -168,6 +199,7 @@ def test_flang(self):
168199
self.assertEqual(env_variables["runtimes_to_build"], "")
169200
self.assertEqual(env_variables["runtimes_check_targets"], "")
170201
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
202+
self.assertEqual(env_variables["enable_cir"], "OFF")
171203

172204
def test_invalid_subproject(self):
173205
env_variables = compute_projects.get_env_variables(
@@ -237,7 +269,7 @@ def test_ci(self):
237269
)
238270
self.assertEqual(
239271
env_variables["project_check_targets"],
240-
"check-bolt check-clang check-clang-tools check-flang check-lld check-lldb check-llvm check-mlir check-polly",
272+
"check-bolt check-clang check-clang-cir check-clang-tools check-flang check-lld check-lldb check-llvm check-mlir check-polly",
241273
)
242274
self.assertEqual(
243275
env_variables["runtimes_to_build"],

.ci/generate_test_report_github.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
parser.add_argument("junit_files", help="Paths to JUnit report files.", nargs="*")
1717
args = parser.parse_args()
1818

19-
report, _ = generate_test_report_lib.generate_report_from_files(
20-
args.title, args.return_code, args.junit_files, None
19+
report = generate_test_report_lib.generate_report_from_files(
20+
args.title, args.return_code, args.junit_files
2121
)
2222

2323
print(report)

.ci/generate_test_report_lib.py

Lines changed: 33 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55

66
from junitparser import JUnitXml, Failure
77

8+
SEE_BUILD_FILE_STR = "Download the build's log file to see the details."
9+
UNRELATED_FAILURES_STR = (
10+
"If these failures are unrelated to your changes (for example "
11+
"tests are broken or flaky at HEAD), please open an issue at "
12+
"https://github.com/llvm/llvm-project/issues and add the "
13+
"`infrastructure` label."
14+
)
15+
816

917
# Set size_limit to limit the byte size of the report. The default is 1MB as this
1018
# is the most that can be put into an annotation. If the generated report exceeds
@@ -18,16 +26,7 @@ def generate_report(
1826
junit_objects,
1927
size_limit=1024 * 1024,
2028
list_failures=True,
21-
buildkite_info=None,
2229
):
23-
if not junit_objects:
24-
# Note that we do not post an empty report, therefore we can ignore a
25-
# non-zero return code in situations like this.
26-
#
27-
# If we were going to post a report, then yes, it would be misleading
28-
# to say we succeeded when the final return code was non-zero.
29-
return ("", "success")
30-
3130
failures = {}
3231
tests_run = 0
3332
tests_skipped = 0
@@ -51,16 +50,28 @@ def generate_report(
5150
(test.classname + "/" + test.name, test.result[0].text)
5251
)
5352

54-
if not tests_run:
55-
return ("", None)
56-
57-
style = "success"
58-
# Either tests failed, or all tests passed but something failed to build.
59-
if tests_failed or return_code != 0:
60-
style = "error"
61-
6253
report = [f"# {title}", ""]
6354

55+
if tests_run == 0:
56+
if return_code == 0:
57+
report.extend(
58+
[
59+
"The build succeeded and no tests ran. This is expected in some "
60+
"build configurations."
61+
]
62+
)
63+
else:
64+
report.extend(
65+
[
66+
"The build failed before running any tests.",
67+
"",
68+
SEE_BUILD_FILE_STR,
69+
"",
70+
UNRELATED_FAILURES_STR,
71+
]
72+
)
73+
return "\n".join(report)
74+
6475
tests_passed = tests_run - tests_skipped - tests_failed
6576

6677
def plural(num_tests):
@@ -73,22 +84,12 @@ def plural(num_tests):
7384
if tests_failed:
7485
report.append(f"* {tests_failed} {plural(tests_failed)} failed")
7586

76-
if buildkite_info is not None:
77-
log_url = (
78-
"https://buildkite.com/organizations/{BUILDKITE_ORGANIZATION_SLUG}/"
79-
"pipelines/{BUILDKITE_PIPELINE_SLUG}/builds/{BUILDKITE_BUILD_NUMBER}/"
80-
"jobs/{BUILDKITE_JOB_ID}/download.txt".format(**buildkite_info)
81-
)
82-
download_text = f"[Download]({log_url})"
83-
else:
84-
download_text = "Download"
85-
8687
if not list_failures:
8788
report.extend(
8889
[
8990
"",
9091
"Failed tests and their output was too large to report. "
91-
f"{download_text} the build's log file to see the details.",
92+
+ SEE_BUILD_FILE_STR,
9293
]
9394
)
9495
elif failures:
@@ -118,20 +119,12 @@ def plural(num_tests):
118119
"",
119120
"All tests passed but another part of the build **failed**.",
120121
"",
121-
f"{download_text} the build's log file to see the details.",
122+
SEE_BUILD_FILE_STR,
122123
]
123124
)
124125

125126
if failures or return_code != 0:
126-
report.extend(
127-
[
128-
"",
129-
"If these failures are unrelated to your changes (for example "
130-
"tests are broken or flaky at HEAD), please open an issue at "
131-
"https://github.com/llvm/llvm-project/issues and add the "
132-
"`infrastructure` label.",
133-
]
134-
)
127+
report.extend(["", UNRELATED_FAILURES_STR])
135128

136129
report = "\n".join(report)
137130
if len(report.encode("utf-8")) > size_limit:
@@ -141,16 +134,14 @@ def plural(num_tests):
141134
junit_objects,
142135
size_limit,
143136
list_failures=False,
144-
buildkite_info=buildkite_info,
145137
)
146138

147-
return report, style
139+
return report
148140

149141

150-
def generate_report_from_files(title, return_code, junit_files, buildkite_info):
142+
def generate_report_from_files(title, return_code, junit_files):
151143
return generate_report(
152144
title,
153145
return_code,
154146
[JUnitXml.fromfile(p) for p in junit_files],
155-
buildkite_info=buildkite_info,
156147
)

0 commit comments

Comments
 (0)