Skip to content

Commit 00a74af

Browse files
author
joaosaffran
committed
Merge branch 'main' into validation/check-descriptors-are-bound
2 parents b5a0b32 + d60da27 commit 00a74af

File tree

7,127 files changed

+357806
-245998
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,127 files changed

+357806
-245998
lines changed

.ci/compute_projects.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
DEPENDENT_RUNTIMES_TO_TEST = {
7878
"clang": {"compiler-rt"},
7979
"clang-tools-extra": {"libc"},
80+
"libc": {"libc"},
8081
".ci": {"compiler-rt", "libc"},
8182
}
8283
DEPENDENT_RUNTIMES_TO_TEST_NEEDS_RECONFIG = {

.ci/compute_projects_test.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def test_top_level_file(self):
187187
self.assertEqual(env_variables["runtimes_check_targets"], "")
188188
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
189189

190-
def test_exclude_runtiems_in_projects(self):
190+
def test_exclude_libcxx_in_projects(self):
191191
env_variables = compute_projects.get_env_variables(
192192
["libcxx/CMakeLists.txt"], "Linux"
193193
)
@@ -197,6 +197,16 @@ def test_exclude_runtiems_in_projects(self):
197197
self.assertEqual(env_variables["runtimes_check_targets"], "")
198198
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
199199

200+
def test_include_libc_in_runtimes(self):
201+
env_variables = compute_projects.get_env_variables(
202+
["libc/CMakeLists.txt"], "Linux"
203+
)
204+
self.assertEqual(env_variables["projects_to_build"], "clang;lld")
205+
self.assertEqual(env_variables["project_check_targets"], "")
206+
self.assertEqual(env_variables["runtimes_to_build"], "libc")
207+
self.assertEqual(env_variables["runtimes_check_targets"], "check-libc")
208+
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
209+
200210
def test_exclude_docs(self):
201211
env_variables = compute_projects.get_env_variables(
202212
["llvm/docs/CIBestPractices.rst"], "Linux"

.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
)

.ci/generate_test_report_lib_test.py

Lines changed: 42 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,28 @@ def junit_from_xml(xml):
2121
class TestReports(unittest.TestCase):
2222
def test_title_only(self):
2323
self.assertEqual(
24-
generate_test_report_lib.generate_report("Foo", 0, []), ("", "success")
24+
generate_test_report_lib.generate_report("Foo", 0, []),
25+
dedent(
26+
"""\
27+
# Foo
28+
29+
The build succeeded and no tests ran. This is expected in some build configurations."""
30+
),
31+
)
32+
33+
def test_title_only_failure(self):
34+
self.assertEqual(
35+
generate_test_report_lib.generate_report("Foo", 1, []),
36+
dedent(
37+
"""\
38+
# Foo
39+
40+
The build failed before running any tests.
41+
42+
Download the build's log file to see the details.
43+
44+
If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label."""
45+
),
2546
)
2647

2748
def test_no_tests_in_testsuite(self):
@@ -42,7 +63,16 @@ def test_no_tests_in_testsuite(self):
4263
)
4364
],
4465
),
45-
("", None),
66+
dedent(
67+
"""\
68+
# Foo
69+
70+
The build failed before running any tests.
71+
72+
Download the build's log file to see the details.
73+
74+
If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label."""
75+
),
4676
)
4777

4878
def test_no_failures(self):
@@ -70,8 +100,7 @@ def test_no_failures(self):
70100
# Foo
71101
72102
* 1 test passed"""
73-
),
74-
"success",
103+
)
75104
),
76105
)
77106

@@ -93,12 +122,6 @@ def test_no_failures_build_failed(self):
93122
)
94123
)
95124
],
96-
buildkite_info={
97-
"BUILDKITE_ORGANIZATION_SLUG": "organization_slug",
98-
"BUILDKITE_PIPELINE_SLUG": "pipeline_slug",
99-
"BUILDKITE_BUILD_NUMBER": "build_number",
100-
"BUILDKITE_JOB_ID": "job_id",
101-
},
102125
),
103126
(
104127
dedent(
@@ -109,11 +132,10 @@ def test_no_failures_build_failed(self):
109132
110133
All tests passed but another part of the build **failed**.
111134
112-
[Download](https://buildkite.com/organizations/organization_slug/pipelines/pipeline_slug/builds/build_number/jobs/job_id/download.txt) the build's log file to see the details.
135+
Download the build's log file to see the details.
113136
114137
If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label."""
115-
),
116-
"error",
138+
)
117139
),
118140
)
119141

@@ -174,14 +196,12 @@ def test_report_single_file_single_testsuite(self):
174196
</details>
175197
176198
If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label."""
177-
),
178-
"error",
199+
)
179200
),
180201
)
181202

182-
MULTI_SUITE_OUTPUT = (
183-
dedent(
184-
"""\
203+
MULTI_SUITE_OUTPUT = dedent(
204+
"""\
185205
# ABC and DEF
186206
187207
* 1 test passed
@@ -210,8 +230,6 @@ def test_report_single_file_single_testsuite(self):
210230
</details>
211231
212232
If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label."""
213-
),
214-
"error",
215233
)
216234

217235
def test_report_single_file_multiple_testsuites(self):
@@ -320,8 +338,7 @@ def test_report_dont_list_failures(self):
320338
Failed tests and their output was too large to report. Download the build's log file to see the details.
321339
322340
If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label."""
323-
),
324-
"error",
341+
)
325342
),
326343
)
327344

@@ -346,12 +363,6 @@ def test_report_dont_list_failures_link_to_log(self):
346363
)
347364
],
348365
list_failures=False,
349-
buildkite_info={
350-
"BUILDKITE_ORGANIZATION_SLUG": "organization_slug",
351-
"BUILDKITE_PIPELINE_SLUG": "pipeline_slug",
352-
"BUILDKITE_BUILD_NUMBER": "build_number",
353-
"BUILDKITE_JOB_ID": "job_id",
354-
},
355366
),
356367
(
357368
dedent(
@@ -360,11 +371,10 @@ def test_report_dont_list_failures_link_to_log(self):
360371
361372
* 1 test failed
362373
363-
Failed tests and their output was too large to report. [Download](https://buildkite.com/organizations/organization_slug/pipelines/pipeline_slug/builds/build_number/jobs/job_id/download.txt) the build's log file to see the details.
374+
Failed tests and their output was too large to report. Download the build's log file to see the details.
364375
365376
If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label."""
366-
),
367-
"error",
377+
)
368378
),
369379
)
370380

@@ -403,7 +413,6 @@ def test_report_size_limit(self):
403413
Failed tests and their output was too large to report. Download the build's log file to see the details.
404414
405415
If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label."""
406-
),
407-
"error",
416+
)
408417
),
409418
)

0 commit comments

Comments
 (0)