Skip to content

Commit e6a4b0b

Browse files
Merge branch 'main' into ctu_clangsa_fixes
2 parents 3f343d7 + 573ca36 commit e6a4b0b

File tree

3,534 files changed

+271120
-85680
lines changed

Some content is hidden

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

3,534 files changed

+271120
-85680
lines changed

.ci/generate_test_report_lib.py

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,23 @@ def _format_ninja_failures(ninja_failures: list[tuple[str, str]]) -> list[str]:
9898
)
9999
return output
100100

101+
def get_failures(junit_objects) -> dict[str, list[tuple[str, str]]]:
102+
failures = {}
103+
for results in junit_objects:
104+
for testsuite in results:
105+
for test in testsuite:
106+
if (
107+
not test.is_passed
108+
and test.result
109+
and isinstance(test.result[0], Failure)
110+
):
111+
if failures.get(testsuite.name) is None:
112+
failures[testsuite.name] = []
113+
failures[testsuite.name].append(
114+
(test.classname + "/" + test.name, test.result[0].text)
115+
)
116+
return failures
117+
101118

102119
# Set size_limit to limit the byte size of the report. The default is 1MB as this
103120
# is the most that can be put into an annotation. If the generated report exceeds
@@ -113,7 +130,7 @@ def generate_report(
113130
size_limit=1024 * 1024,
114131
list_failures=True,
115132
):
116-
failures = {}
133+
failures = get_failures(junit_objects)
117134
tests_run = 0
118135
tests_skipped = 0
119136
tests_failed = 0
@@ -124,18 +141,6 @@ def generate_report(
124141
tests_skipped += testsuite.skipped
125142
tests_failed += testsuite.failures
126143

127-
for test in testsuite:
128-
if (
129-
not test.is_passed
130-
and test.result
131-
and isinstance(test.result[0], Failure)
132-
):
133-
if failures.get(testsuite.name) is None:
134-
failures[testsuite.name] = []
135-
failures[testsuite.name].append(
136-
(test.classname + "/" + test.name, test.result[0].text)
137-
)
138-
139144
report = [f"# {title}", ""]
140145

141146
if tests_run == 0:
@@ -258,7 +263,7 @@ def plural(num_tests):
258263
return report
259264

260265

261-
def generate_report_from_files(title, return_code, build_log_files):
266+
def load_info_from_files(build_log_files):
262267
junit_files = [
263268
junit_file for junit_file in build_log_files if junit_file.endswith(".xml")
264269
]
@@ -271,6 +276,9 @@ def generate_report_from_files(title, return_code, build_log_files):
271276
ninja_logs.append(
272277
[log_line.strip() for log_line in ninja_log_file_handle.readlines()]
273278
)
274-
return generate_report(
275-
title, return_code, [JUnitXml.fromfile(p) for p in junit_files], ninja_logs
276-
)
279+
return [JUnitXml.fromfile(p) for p in junit_files], ninja_logs
280+
281+
282+
def generate_report_from_files(title, return_code, build_log_files):
283+
junit_objects, ninja_logs = load_info_from_files(build_log_files)
284+
return generate_report(title, return_code, junit_objects, ninja_logs)

.ci/metrics/metrics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
GITHUB_JOB_TO_TRACK = {
4141
"github_llvm_premerge_checks": {
4242
"Build and Test Linux": "premerge_linux",
43+
"Build and Test Linux AArch64": "premerge_linux_aarch64",
4344
"Build and Test Windows": "premerge_windows",
4445
},
4546
"github_libcxx_premerge_checks": {

.ci/monolithic-linux.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,13 @@ start-group "ninja"
6666

6767
# Targets are not escaped as they are passed as separate arguments.
6868
ninja -C "${BUILD_DIR}" -k 0 ${targets} |& tee ninja.log
69+
cp ${BUILD_DIR}/.ninja_log ninja.ninja_log
6970

7071
if [[ "${runtime_targets}" != "" ]]; then
7172
start-group "ninja Runtimes"
7273

7374
ninja -C "${BUILD_DIR}" ${runtime_targets} |& tee ninja_runtimes.log
75+
cp ${BUILD_DIR}/.ninja_log ninja_runtimes.ninja_log
7476
fi
7577

7678
# Compiling runtimes with just-built Clang and running their tests
@@ -87,6 +89,7 @@ if [[ "${runtime_targets_needs_reconfig}" != "" ]]; then
8789

8890
ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig} \
8991
|& tee ninja_runtimes_needs_reconfig1.log
92+
cp ${BUILD_DIR}/.ninja_log ninja_runtimes_needs_reconig.ninja_log
9093

9194
start-group "CMake Runtimes Clang Modules"
9295

@@ -99,4 +102,5 @@ if [[ "${runtime_targets_needs_reconfig}" != "" ]]; then
99102

100103
ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig} \
101104
|& tee ninja_runtimes_needs_reconfig2.log
105+
cp ${BUILD_DIR}/.ninja_log ninja_runtimes_needs_reconfig2.ninja_log
102106
fi

.ci/monolithic-windows.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ start-group "ninja"
5555

5656
# Targets are not escaped as they are passed as separate arguments.
5757
ninja -C "${BUILD_DIR}" -k 0 ${targets} |& tee ninja.log
58+
cp ${BUILD_DIR}/.ninja_log ninja.ninja_log
5859

5960
if [[ "${runtime_targets}" != "" ]]; then
6061
start-group "ninja runtimes"
6162

6263
ninja -C "${BUILD_DIR}" -k 0 ${runtimes_targets} |& tee ninja_runtimes.log
64+
cp ${BUILD_DIR}/.ninja_log ninja_runtimes.ninja_log
6365
fi

.ci/premerge_advisor_upload.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2+
# See https://llvm.org/LICENSE.txt for license information.
3+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
"""Script for uploading results to the premerge advisor."""
5+
6+
import argparse
7+
import os
8+
import platform
9+
import sys
10+
11+
import requests
12+
13+
import generate_test_report_lib
14+
15+
PREMERGE_ADVISOR_URL = (
16+
"http://premerge-advisor.premerge-advisor.svc.cluster.local:5000/upload"
17+
)
18+
19+
20+
def main(commit_sha, workflow_run_number, build_log_files):
21+
junit_objects, ninja_logs = generate_test_report_lib.load_info_from_files(
22+
build_log_files
23+
)
24+
test_failures = generate_test_report_lib.get_failures(junit_objects)
25+
source = "pull_request" if "GITHUB_ACTIONS" in os.environ else "postcommit"
26+
current_platform = f"{platform.system()}-{platform.machine()}".lower()
27+
failure_info = {
28+
"source_type": source,
29+
"base_commit_sha": commit_sha,
30+
"source_id": workflow_run_number,
31+
"failures": [],
32+
"platform": current_platform,
33+
}
34+
if test_failures:
35+
for _, failures in test_failures.items():
36+
for name, failure_message in failures:
37+
failure_info["failures"].append(
38+
{"name": name, "message": failure_message}
39+
)
40+
else:
41+
ninja_failures = generate_test_report_lib.find_failure_in_ninja_logs(ninja_logs)
42+
for name, failure_message in ninja_failures:
43+
failure_info["failures"].append({"name": name, "message": failure_message})
44+
requests.post(PREMERGE_ADVISOR_URL, json=failure_info)
45+
46+
47+
if __name__ == "__main__":
48+
parser = argparse.ArgumentParser()
49+
parser.add_argument("commit_sha", help="The base commit SHA for the test.")
50+
parser.add_argument("workflow_run_number", help="The run number from GHA.")
51+
parser.add_argument(
52+
"build_log_files", help="Paths to JUnit report files and ninja logs.", nargs="*"
53+
)
54+
args = parser.parse_args()
55+
56+
# Skip uploading results on AArch64 for now because the premerge advisor
57+
# service is not available on AWS currently.
58+
if platform.machine() == "arm64":
59+
sys.exit(0)
60+
61+
main(args.commit_sha, args.workflow_run_number, args.build_log_files)

.ci/utils.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function at-exit {
2626
mkdir -p artifacts
2727
sccache --show-stats
2828
sccache --show-stats >> artifacts/sccache_stats.txt
29-
cp "${BUILD_DIR}"/.ninja_log artifacts/.ninja_log
29+
cp "${MONOREPO_ROOT}"/*.ninja_log artifacts/ || :
3030
cp "${MONOREPO_ROOT}"/*.log artifacts/ || :
3131
cp "${BUILD_DIR}"/test-results.*.xml artifacts/ || :
3232

@@ -38,6 +38,12 @@ function at-exit {
3838
$retcode "${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log \
3939
>> $GITHUB_STEP_SUMMARY
4040
fi
41+
42+
if [[ "$retcode" != "0" ]]; then
43+
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_upload.py \
44+
$(git rev-parse HEAD~1) $GITHUB_RUN_NUMBER \
45+
"${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log
46+
fi
4147
}
4248
trap at-exit EXIT
4349

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
/mlir/test/python/ @ftynse @makslevental @stellaraccident @rolfmorel
132132
/mlir/python/ @ftynse @makslevental @stellaraccident @rolfmorel
133133
/mlir/lib/Bindings/Python @makslevental @rolfmorel
134+
/mlir/include/Bindings/Python @makslevental @rolfmorel
134135

135136
# MLIR Mem2Reg/SROA
136137
/mlir/**/Transforms/Mem2Reg.* @moxinilian

.github/new-prs-labeler.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,8 +1096,8 @@ clang:openmp:
10961096
- llvm/test/Transforms/OpenMP/**
10971097

10981098
clang:temporal-safety:
1099-
- clang/include/clang/Analysis/Analyses/LifetimeSafety*
1100-
- clang/lib/Analysis/LifetimeSafety*
1099+
- clang/include/clang/Analysis/Analyses/LifetimeSafety/**
1100+
- clang/lib/Analysis/LifetimeSafety/**
11011101
- clang/unittests/Analysis/LifetimeSafety*
11021102
- clang/test/Sema/*lifetime-safety*
11031103
- clang/test/Sema/*lifetime-analysis*

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
- name: Test Container
7373
run: |
7474
# Use --pull=never to ensure we are testing the just built image.
75-
podman run --pull=never --rm -it ${{ steps.vars.outputs.container-name-format-tag }} /usr/bin/bash -x -c 'cd $HOME && clang-format --version | grep version && black --version | grep black'
75+
podman run --pull=never --rm -it ${{ steps.vars.outputs.container-name-format-tag }} /usr/bin/bash -x -c 'cd $HOME && clang-format --version | grep version && git-clang-format -h | grep usage && black --version | grep black'
7676
podman run --pull=never --rm -it ${{ steps.vars.outputs.container-name-lint-tag }} /usr/bin/bash -x -c 'cd $HOME && clang-tidy --version | grep version && clang-tidy-diff.py -h | grep usage'
7777
7878
push-ci-container:

.github/workflows/containers/github-action-ci-tooling/Dockerfile

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
ARG LLVM_VERSION=21.1.0
2+
# FIXME: Use "${LLVM_VERSION%%.*}" instead of "LLVM_VERSION_MAJOR" once we update runners to Ubuntu-26.04 with Buildah >= 1.37
3+
ARG LLVM_VERSION_MAJOR=21
24

35
FROM docker.io/library/ubuntu:24.04 AS llvm-downloader
46
ARG LLVM_VERSION
7+
ARG LLVM_VERSION_MAJOR
58

69
RUN apt-get update && \
710
apt-get install -y wget xz-utils && \
811
wget -O llvm.tar.xz https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/LLVM-${LLVM_VERSION}-Linux-X64.tar.xz && \
912
mkdir -p /llvm-extract && \
1013
tar -xvJf llvm.tar.xz -C /llvm-extract \
1114
# Only unpack these tools to save space on Github runner.
15+
LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-${LLVM_VERSION_MAJOR} \
16+
LLVM-${LLVM_VERSION}-Linux-X64/lib/clang/${LLVM_VERSION_MAJOR}/include \
1217
LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-tidy \
13-
LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-format && \
18+
LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-format \
19+
LLVM-${LLVM_VERSION}-Linux-X64/bin/git-clang-format && \
1420
rm llvm.tar.xz
1521

1622

@@ -35,7 +41,9 @@ RUN apt-get update && \
3541
FROM base AS ci-container-code-format
3642
ARG LLVM_VERSION
3743

38-
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-format ${LLVM_SYSROOT}/bin/clang-format
44+
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-format \
45+
/llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/git-clang-format \
46+
${LLVM_SYSROOT}/bin/
3947

4048
ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
4149

@@ -47,12 +55,27 @@ RUN pip install -r requirements_formatting.txt --break-system-packages && \
4755

4856
FROM base AS ci-container-code-lint
4957
ARG LLVM_VERSION
58+
ARG LLVM_VERSION_MAJOR
5059

51-
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-tidy ${LLVM_SYSROOT}/bin/
60+
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-tidy \
61+
/llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-${LLVM_VERSION_MAJOR} \
62+
${LLVM_SYSROOT}/bin/
63+
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/lib/clang/${LLVM_VERSION_MAJOR}/include \
64+
${LLVM_SYSROOT}/lib/clang/${LLVM_VERSION_MAJOR}/include
5265
COPY clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py ${LLVM_SYSROOT}/bin/clang-tidy-diff.py
5366

67+
RUN ln -s ${LLVM_SYSROOT}/bin/clang-${LLVM_VERSION_MAJOR} ${LLVM_SYSROOT}/bin/clang && \
68+
ln -s ${LLVM_SYSROOT}/bin/clang ${LLVM_SYSROOT}/bin/clang++
69+
5470
ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
5571

72+
RUN apt-get update && \
73+
DEBIAN_FRONTEND=noninteractive apt-get install -y \
74+
cmake \
75+
ninja-build && \
76+
apt-get clean && \
77+
rm -rf /var/lib/apt/lists/*
78+
5679
# Install dependencies for 'pr-code-lint.yml' job
5780
COPY llvm/utils/git/requirements_linting.txt requirements_linting.txt
5881
RUN pip install -r requirements_linting.txt --break-system-packages && \

0 commit comments

Comments
 (0)