Skip to content

Commit 46cb70b

Browse files
committed
Merge remote-tracking branch 'origin/main' into
cbieneman/incomplete-arrays
2 parents 0fb3605 + 913dcf1 commit 46cb70b

File tree

7,848 files changed

+621231
-337102
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,848 files changed

+621231
-337102
lines changed

.ci/compute-projects.sh

Lines changed: 0 additions & 194 deletions
This file was deleted.

.ci/compute_projects.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252
"clang": {"clang-tools-extra", "compiler-rt", "cross-project-tests"},
5353
"clang-tools-extra": {"libc"},
5454
"mlir": {"flang"},
55+
# Test everything if ci scripts are changed.
56+
# FIXME: Figure out what is missing and add here.
57+
".ci": {"llvm", "clang", "lld", "lldb"},
5558
}
5659

5760
DEPENDENT_RUNTIMES_TO_TEST = {"clang": {"libcxx", "libcxxabi", "libunwind"}}
@@ -130,12 +133,11 @@ def _add_dependencies(projects: Set[str]) -> Set[str]:
130133
def _compute_projects_to_test(modified_projects: Set[str], platform: str) -> Set[str]:
131134
projects_to_test = set()
132135
for modified_project in modified_projects:
133-
# Skip all projects where we cannot run tests.
134-
if modified_project not in PROJECT_CHECK_TARGETS:
135-
continue
136136
if modified_project in RUNTIMES:
137137
continue
138-
projects_to_test.add(modified_project)
138+
# Skip all projects where we cannot run tests.
139+
if modified_project in PROJECT_CHECK_TARGETS:
140+
projects_to_test.add(modified_project)
139141
if modified_project not in DEPENDENTS_TO_TEST:
140142
continue
141143
for dependent_project in DEPENDENTS_TO_TEST[modified_project]:
@@ -194,6 +196,17 @@ def _compute_runtime_check_targets(runtimes_to_test: Set[str]) -> Set[str]:
194196
def _get_modified_projects(modified_files: list[str]) -> Set[str]:
195197
modified_projects = set()
196198
for modified_file in modified_files:
199+
path_parts = pathlib.Path(modified_file).parts
200+
# Exclude files in the docs directory. They do not impact an test
201+
# targets and there is a separate workflow used for ensuring the
202+
# documentation builds.
203+
if len(path_parts) > 2 and path_parts[1] == "docs":
204+
continue
205+
# Exclude files for the gn build. We do not test it within premerge
206+
# and changes occur often enough that they otherwise take up
207+
# capacity.
208+
if len(path_parts) > 3 and path_parts[:3] == ("llvm", "utils", "gn"):
209+
continue
197210
modified_projects.add(pathlib.Path(modified_file).parts[0])
198211
return modified_projects
199212

.ci/compute_projects_test.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,37 @@ def test_exclude_runtiems_in_projects(self):
170170
self.assertEqual(env_variables["runtimes_to_build"], "")
171171
self.assertEqual(env_variables["runtimes_check_targets"], "")
172172

173+
def test_exclude_docs(self):
174+
env_variables = compute_projects.get_env_variables(
175+
["llvm/docs/CIBestPractices.rst"], "Linux"
176+
)
177+
self.assertEqual(env_variables["projects_to_build"], "")
178+
self.assertEqual(env_variables["project_check_targets"], "")
179+
self.assertEqual(env_variables["runtimes_to_build"], "")
180+
self.assertEqual(env_variables["runtimes_check_targets"], "")
181+
182+
def test_exclude_gn(self):
183+
env_variables = compute_projects.get_env_variables(
184+
["llvm/utils/gn/build/BUILD.gn"], "Linux"
185+
)
186+
self.assertEqual(env_variables["projects_to_build"], "")
187+
self.assertEqual(env_variables["project_check_targets"], "")
188+
self.assertEqual(env_variables["runtimes_to_build"], "")
189+
self.assertEqual(env_variables["runtimes_check_targets"], "")
190+
191+
def test_ci(self):
192+
env_variables = compute_projects.get_env_variables(
193+
[".ci/compute_projects.py"], "Linux"
194+
)
195+
self.assertEqual(env_variables["projects_to_build"],
196+
"clang;lld;llvm;lldb")
197+
self.assertEqual(env_variables["project_check_targets"], "check-clang
198+
check-lld check-llvm check-lldb")
199+
self.assertEqual(env_variables["runtimes_to_build"],
200+
"libcxx;libcxxabi;libunwind")
201+
self.assertEqual(env_variables["runtimes_check_targets"], "check-cxx
202+
check-cxxabi check-unwind")
203+
173204

174205
if __name__ == "__main__":
175206
unittest.main()

.ci/generate-buildkite-pipeline-premerge

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ modified_dirs=$(echo "$MODIFIED_FILES" | cut -d'/' -f1 | sort -u)
5252
echo "Directories modified:" >&2
5353
echo "$modified_dirs" >&2
5454

55-
. ./.ci/compute-projects.sh
56-
5755
# Project specific pipelines.
5856

5957
# If libc++ or one of the runtimes directories changed.
@@ -73,20 +71,16 @@ fi
7371
# needs while letting them run on the infrastructure provided by LLVM.
7472

7573
# Figure out which projects need to be built on each platform
76-
all_projects="bolt clang clang-tools-extra compiler-rt cross-project-tests flang libc libclc lld lldb llvm mlir openmp polly pstl"
77-
modified_projects="$(keep-modified-projects ${all_projects})"
78-
79-
linux_projects_to_test=$(exclude-linux $(compute-projects-to-test 0 ${modified_projects}))
80-
linux_check_targets=$(check-targets ${linux_projects_to_test} | sort | uniq)
81-
linux_projects=$(add-dependencies ${linux_projects_to_test} | sort | uniq)
74+
source <(git diff --name-only origin/${BUILDKITE_PULL_REQUEST_BASE_BRANCH}...HEAD | python3 .ci/compute_projects.py Linux)
75+
linux_projects=${projects_to_build}
76+
linux_check_targets=${project_check_targets}
77+
linux_runtimes=${runtimes_to_build}
78+
linux_runtime_check_targets=${runtimes_check_targets}
8279

83-
linux_runtimes_to_test=$(compute-runtimes-to-test ${linux_projects_to_test})
84-
linux_runtime_check_targets=$(check-targets ${linux_runtimes_to_test} | sort | uniq)
85-
linux_runtimes=$(echo ${linux_runtimes_to_test} | sort | uniq)
80+
source <(git diff --name-only origin/${BUILDKITE_PULL_REQUEST_BASE_BRANCH}...HEAD | python3 .ci/compute_projects.py Windows)
81+
windows_projects=${projects_to_build}
82+
windows_check_targets=${project_check_targets}
8683

87-
windows_projects_to_test=$(exclude-windows $(compute-projects-to-test 1 ${modified_projects}))
88-
windows_check_targets=$(check-targets ${windows_projects_to_test} | sort | uniq)
89-
windows_projects=$(add-dependencies ${windows_projects_to_test} | sort | uniq)
9084

9185
# Generate the appropriate pipeline
9286
if [[ "${linux_projects}" != "" ]]; then

.ci/generate_test_report_github.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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 to generate a build report for Github."""
5+
6+
import argparse
7+
8+
import generate_test_report_lib
9+
10+
if __name__ == "__main__":
11+
parser = argparse.ArgumentParser()
12+
parser.add_argument(
13+
"title", help="Title of the test report, without Markdown formatting."
14+
)
15+
parser.add_argument("return_code", help="The build's return code.", type=int)
16+
parser.add_argument("junit_files", help="Paths to JUnit report files.", nargs="*")
17+
args = parser.parse_args()
18+
19+
report, _ = generate_test_report_lib.generate_report_from_files(
20+
args.title, args.return_code, args.junit_files, None
21+
)
22+
23+
print(report)

.ci/generate_test_report_lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def plural(num_tests):
9292
]
9393
)
9494
elif failures:
95-
report.extend(["", "## Failed Tests", "(click to see output)"])
95+
report.extend(["", "## Failed Tests", "(click on a test name to see its output)"])
9696

9797
for testsuite_name, failures in failures.items():
9898
report.extend(["", f"### {testsuite_name}"])

.ci/generate_test_report_lib_test.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# See https://llvm.org/LICENSE.txt for license information.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5+
# To run these tests:
6+
# python -m unittest generate_test_report_lib_test.py
7+
58
import unittest
69
from io import StringIO
710
from textwrap import dedent
@@ -150,7 +153,7 @@ def test_report_single_file_single_testsuite(self):
150153
* 2 tests failed
151154
152155
## Failed Tests
153-
(click to see output)
156+
(click on a test name to see its output)
154157
155158
### Bar
156159
<details>
@@ -182,7 +185,7 @@ def test_report_single_file_single_testsuite(self):
182185
* 2 tests failed
183186
184187
## Failed Tests
185-
(click to see output)
188+
(click on a test name to see its output)
186189
187190
### ABC
188191
<details>

.ci/metrics/metrics.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,13 @@ def github_get_metrics(
282282
queued_count = collections.Counter()
283283
running_count = collections.Counter()
284284

285+
# Initialize all the counters to 0 so we report 0 when no job is queued
286+
# or running.
287+
for wf_name, wf_metric_name in GITHUB_WORKFLOW_TO_TRACK.items():
288+
for job_name, job_metric_name in GITHUB_JOB_TO_TRACK[wf_metric_name].items():
289+
queued_count[wf_metric_name + "_" + job_metric_name] = 0
290+
running_count[wf_metric_name + "_" + job_metric_name] = 0
291+
285292
# The list of workflows this iteration will process.
286293
# MaxSize = GITHUB_WORKFLOWS_MAX_PROCESS_COUNT
287294
workflow_seen_as_completed = set()

0 commit comments

Comments
 (0)