Skip to content

Commit 45324d7

Browse files
committed
Merge branch 'main' into add-pkey-x86
2 parents 75b4ab6 + e330985 commit 45324d7

File tree

1,457 files changed

+91672
-35692
lines changed

Some content is hidden

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

1,457 files changed

+91672
-35692
lines changed

.ci/generate_test_report_github.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,9 @@
44
"""Script to generate a build report for Github."""
55

66
import argparse
7-
import platform
87

98
import generate_test_report_lib
109

11-
def compute_platform_title() -> str:
12-
logo = ":window:" if platform.system() == "Windows" else ":penguin:"
13-
# On Linux the machine value is x86_64 on Windows it is AMD64.
14-
if platform.machine() == "x86_64" or platform.machine() == "AMD64":
15-
arch = "x64"
16-
else:
17-
arch = platform.machine()
18-
return f"{logo} {platform.system()} {arch} Test Results"
19-
2010

2111
if __name__ == "__main__":
2212
parser = argparse.ArgumentParser()
@@ -27,7 +17,9 @@ def compute_platform_title() -> str:
2717
args = parser.parse_args()
2818

2919
report = generate_test_report_lib.generate_report_from_files(
30-
compute_platform_title(), args.return_code, args.build_test_logs
20+
generate_test_report_lib.compute_platform_title(),
21+
args.return_code,
22+
args.build_test_logs,
3123
)
3224

3325
print(report)

.ci/generate_test_report_lib.py

Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,22 @@
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
"""Library to parse JUnit XML files and return a markdown report."""
55

6+
from typing import TypedDict, Optional
7+
import platform
8+
69
from junitparser import JUnitXml, Failure
710

11+
12+
# This data structure should match the definition in llvm-zorg in
13+
# premerge/advisor/advisor_lib.py
14+
# TODO(boomanaiden154): Drop the Optional here and switch to str | None when
15+
# we require Python 3.10.
16+
class FailureExplanation(TypedDict):
17+
name: str
18+
explained: bool
19+
reason: Optional[str]
20+
21+
822
SEE_BUILD_FILE_STR = "Download the build's log file to see the details."
923
UNRELATED_FAILURES_STR = (
1024
"If these failures are unrelated to your changes (for example "
@@ -82,16 +96,29 @@ def find_failure_in_ninja_logs(ninja_logs: list[list[str]]) -> list[tuple[str, s
8296
return failures
8397

8498

85-
def _format_ninja_failures(ninja_failures: list[tuple[str, str]]) -> list[str]:
86-
"""Formats ninja failures into summary views for the report."""
99+
def _format_failures(
100+
failures: list[tuple[str, str]], failure_explanations: dict[str, FailureExplanation]
101+
) -> list[str]:
102+
"""Formats failures into summary views for the report."""
87103
output = []
88-
for build_failure in ninja_failures:
104+
for build_failure in failures:
89105
failed_action, failure_message = build_failure
106+
failure_explanation = None
107+
if failed_action in failure_explanations:
108+
failure_explanation = failure_explanations[failed_action]
109+
output.append("<details>")
110+
if failure_explanation:
111+
output.extend(
112+
[
113+
f"<summary>{failed_action} (Likely Already Failing)</summary>" "",
114+
failure_explanation["reason"],
115+
"",
116+
]
117+
)
118+
else:
119+
output.extend([f"<summary>{failed_action}</summary>", ""])
90120
output.extend(
91121
[
92-
"<details>",
93-
f"<summary>{failed_action}</summary>",
94-
"",
95122
"```",
96123
failure_message,
97124
"```",
@@ -100,6 +127,7 @@ def _format_ninja_failures(ninja_failures: list[tuple[str, str]]) -> list[str]:
100127
)
101128
return output
102129

130+
103131
def get_failures(junit_objects) -> dict[str, list[tuple[str, str]]]:
104132
failures = {}
105133
for results in junit_objects:
@@ -131,12 +159,19 @@ def generate_report(
131159
ninja_logs: list[list[str]],
132160
size_limit=1024 * 1024,
133161
list_failures=True,
162+
failure_explanations_list: list[FailureExplanation] = [],
134163
):
135164
failures = get_failures(junit_objects)
136165
tests_run = 0
137166
tests_skipped = 0
138167
tests_failed = 0
139168

169+
failure_explanations: dict[str, FailureExplanation] = {}
170+
for failure_explanation in failure_explanations_list:
171+
if not failure_explanation["explained"]:
172+
continue
173+
failure_explanations[failure_explanation["name"]] = failure_explanation
174+
140175
for results in junit_objects:
141176
for testsuite in results:
142177
tests_run += testsuite.tests
@@ -175,7 +210,7 @@ def generate_report(
175210
"",
176211
]
177212
)
178-
report.extend(_format_ninja_failures(ninja_failures))
213+
report.extend(_format_failures(ninja_failures, failure_explanations))
179214
report.extend(
180215
[
181216
"",
@@ -211,18 +246,7 @@ def plural(num_tests):
211246

212247
for testsuite_name, failures in failures.items():
213248
report.extend(["", f"### {testsuite_name}"])
214-
for name, output in failures:
215-
report.extend(
216-
[
217-
"<details>",
218-
f"<summary>{name}</summary>",
219-
"",
220-
"```",
221-
output,
222-
"```",
223-
"</details>",
224-
]
225-
)
249+
report.extend(_format_failures(failures, failure_explanations))
226250
elif return_code != 0:
227251
# No tests failed but the build was in a failed state. Bring this to the user's
228252
# attention.
@@ -247,7 +271,7 @@ def plural(num_tests):
247271
"",
248272
]
249273
)
250-
report.extend(_format_ninja_failures(ninja_failures))
274+
report.extend(_format_failures(ninja_failures, failure_explanations))
251275

252276
if failures or return_code != 0:
253277
report.extend(["", UNRELATED_FAILURES_STR])
@@ -284,3 +308,13 @@ def load_info_from_files(build_log_files):
284308
def generate_report_from_files(title, return_code, build_log_files):
285309
junit_objects, ninja_logs = load_info_from_files(build_log_files)
286310
return generate_report(title, return_code, junit_objects, ninja_logs)
311+
312+
313+
def compute_platform_title() -> str:
314+
logo = ":window:" if platform.system() == "Windows" else ":penguin:"
315+
# On Linux the machine value is x86_64 on Windows it is AMD64.
316+
if platform.machine() == "x86_64" or platform.machine() == "AMD64":
317+
arch = "x64"
318+
else:
319+
arch = platform.machine()
320+
return f"{logo} {platform.system()} {arch} Test Results"

.ci/generate_test_report_lib_test.py

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,160 @@ def test_report_size_limit(self):
781781
),
782782
)
783783

784+
def test_report_ninja_explanation(self):
785+
self.assertEqual(
786+
generate_test_report_lib.generate_report(
787+
"Foo",
788+
1,
789+
[],
790+
[
791+
[
792+
"[1/5] test/1.stamp",
793+
"[2/5] test/2.stamp",
794+
"[3/5] test/3.stamp",
795+
"[4/5] test/4.stamp",
796+
"FAILED: test/4.stamp",
797+
"touch test/4.stamp",
798+
"Half Moon Bay.",
799+
"[5/5] test/5.stamp",
800+
]
801+
],
802+
failure_explanations_list=[
803+
{
804+
"name": "test/4.stamp",
805+
"explained": True,
806+
"reason": "Failing at head",
807+
}
808+
],
809+
),
810+
dedent(
811+
"""\
812+
# Foo
813+
814+
The build failed before running any tests. Click on a failure below to see the details.
815+
816+
<details>
817+
<summary>test/4.stamp (Likely Already Failing)</summary>
818+
Failing at head
819+
820+
```
821+
FAILED: test/4.stamp
822+
touch test/4.stamp
823+
Half Moon Bay.
824+
```
825+
</details>
826+
827+
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."""
828+
),
829+
)
830+
831+
def test_report_test_failure_explanation(self):
832+
self.assertEqual(
833+
generate_test_report_lib.generate_report(
834+
"Foo",
835+
1,
836+
[
837+
junit_from_xml(
838+
dedent(
839+
"""\
840+
<?xml version="1.0" encoding="UTF-8"?>
841+
<testsuites time="8.89">
842+
<testsuite name="Bar" tests="1" failures="1" skipped="0" time="410.63">
843+
<testcase classname="Bar/test_3" name="test_3" time="0.02">
844+
<failure><![CDATA[Error! Expected Big Sur to be next to the ocean.]]></failure>
845+
</testcase>
846+
</testsuite>
847+
</testsuites>"""
848+
)
849+
)
850+
],
851+
[],
852+
failure_explanations_list=[
853+
{
854+
"name": "Bar/test_3/test_3",
855+
"explained": True,
856+
"reason": "Big Sur is next to the Pacific.",
857+
}
858+
],
859+
),
860+
(
861+
dedent(
862+
"""\
863+
# Foo
864+
865+
* 1 test failed
866+
867+
## Failed Tests
868+
(click on a test name to see its output)
869+
870+
### Bar
871+
<details>
872+
<summary>Bar/test_3/test_3 (Likely Already Failing)</summary>
873+
Big Sur is next to the Pacific.
874+
875+
```
876+
Error! Expected Big Sur to be next to the ocean.
877+
```
878+
</details>
879+
880+
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."""
881+
)
882+
),
883+
)
884+
885+
def test_report_test_failure_have_explanation_explained_false(self):
886+
self.assertEqual(
887+
generate_test_report_lib.generate_report(
888+
"Foo",
889+
1,
890+
[
891+
junit_from_xml(
892+
dedent(
893+
"""\
894+
<?xml version="1.0" encoding="UTF-8"?>
895+
<testsuites time="8.89">
896+
<testsuite name="Bar" tests="1" failures="1" skipped="0" time="410.63">
897+
<testcase classname="Bar/test_3" name="test_3" time="0.02">
898+
<failure><![CDATA[Error! Expected Mt. Shasta to be next in the Eastern Sierras.]]></failure>
899+
</testcase>
900+
</testsuite>
901+
</testsuites>"""
902+
)
903+
)
904+
],
905+
[],
906+
failure_explanations_list=[
907+
{
908+
"name": "Bar/test_3/test_3",
909+
"explained": False,
910+
"reason": "Mt. Shasta is in the Cascades",
911+
}
912+
],
913+
),
914+
(
915+
dedent(
916+
"""\
917+
# Foo
918+
919+
* 1 test failed
920+
921+
## Failed Tests
922+
(click on a test name to see its output)
923+
924+
### Bar
925+
<details>
926+
<summary>Bar/test_3/test_3</summary>
927+
928+
```
929+
Error! Expected Mt. Shasta to be next in the Eastern Sierras.
930+
```
931+
</details>
932+
933+
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."""
934+
)
935+
),
936+
)
937+
784938
def test_generate_report_end_to_end(self):
785939
with tempfile.TemporaryDirectory() as temp_dir:
786940
junit_xml_file = os.path.join(temp_dir, "junit.xml")

.ci/monolithic-windows.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ export LD=link
3232
# see https://github.com/llvm/llvm-project/pull/82393 and
3333
# https://discourse.llvm.org/t/rfc-future-of-windows-pre-commit-ci/76840/40
3434
# for further information.
35-
# We limit the number of parallel compile jobs to 24 control memory
36-
# consumption and improve build reliability.
3735
cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
3836
-D LLVM_ENABLE_PROJECTS="${projects}" \
3937
-G Ninja \

.github/renovate.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,12 @@
88
"minimumReleaseAge": "3 days",
99
"assignees": ["boomanaiden154"],
1010
"ignorePaths": [".github/workflows/containers/**"],
11-
"groupName": "[Github] Update GHA Dependencies"
11+
"groupName": "[Github] Update GHA Dependencies",
12+
"packageRules": [
13+
{
14+
"matchPackageNames": ["windows", "macos"],
15+
"matchManagers": ["github-actions"],
16+
"enabled": false
17+
}
18+
]
1219
}

.github/workflows/build-ci-container-tooling.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
podman save ${{ steps.vars.outputs.container-name-lint-tag }} > ${{ steps.vars.outputs.container-lint-filename }}
6464
6565
- name: Upload container image
66-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
66+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
6767
with:
6868
name: container-amd64
6969
path: "*.tar"
@@ -86,7 +86,7 @@ jobs:
8686
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8787
steps:
8888
- name: Download container
89-
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
89+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
9090

9191
- name: Push Container
9292
run: |

.github/workflows/build-ci-container-windows.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
run: |
4545
docker save ${{ steps.vars.outputs.container-name-tag }} > ${{ steps.vars.outputs.container-filename }}
4646
- name: Upload container image
47-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
47+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
4848
with:
4949
name: container
5050
path: ${{ steps.vars.outputs.container-filename }}
@@ -61,7 +61,7 @@ jobs:
6161
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6262
steps:
6363
- name: Download container
64-
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
64+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
6565
with:
6666
name: container
6767
- name: Push Container

0 commit comments

Comments
 (0)