Skip to content

Commit 7cb284e

Browse files
committed
Rebase
Created using spr 1.3.6-beta.1
2 parents b33113c + d0b8663 commit 7cb284e

File tree

10,698 files changed

+657840
-231806
lines changed

Some content is hidden

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

10,698 files changed

+657840
-231806
lines changed

.ci/all_requirements.txt

Lines changed: 213 additions & 11 deletions
Large diffs are not rendered by default.

.ci/cache_lit_timing_files.py

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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+
"""Caches .lit_test_times.txt files between premerge invocations.
5+
6+
.lit_test_times.txt files are used by lit to order tests to best take advantage
7+
of parallelism. Having them around and up to date can result in a ~15%
8+
improvement in test times. This script downloading cached test time files and
9+
uploading new versions to the GCS buckets used for caching.
10+
"""
11+
12+
import sys
13+
import os
14+
import logging
15+
import multiprocessing.pool
16+
import pathlib
17+
import glob
18+
19+
from google.cloud import storage
20+
21+
GCS_PARALLELISM = 100
22+
23+
24+
def _maybe_upload_timing_file(bucket, timing_file_path):
25+
if os.path.exists(timing_file_path):
26+
timing_file_blob = bucket.blob("lit_timing/" + timing_file_path)
27+
timing_file_blob.upload_from_filename(timing_file_path)
28+
29+
30+
def upload_timing_files(storage_client, bucket_name: str):
31+
bucket = storage_client.bucket(bucket_name)
32+
with multiprocessing.pool.ThreadPool(GCS_PARALLELISM) as thread_pool:
33+
futures = []
34+
for timing_file_path in glob.glob("**/.lit_test_times.txt", recursive=True):
35+
futures.append(
36+
thread_pool.apply_async(
37+
_maybe_upload_timing_file, (bucket, timing_file_path)
38+
)
39+
)
40+
for future in futures:
41+
future.get()
42+
print("Done uploading")
43+
44+
45+
def _maybe_download_timing_file(blob):
46+
file_name = blob.name.removeprefix("lit_timing/")
47+
pathlib.Path(os.path.dirname(file_name)).mkdir(parents=True, exist_ok=True)
48+
blob.download_to_filename(file_name)
49+
50+
51+
def download_timing_files(storage_client, bucket_name: str):
52+
bucket = storage_client.bucket(bucket_name)
53+
blobs = bucket.list_blobs(prefix="lit_timing")
54+
with multiprocessing.pool.ThreadPool(GCS_PARALLELISM) as thread_pool:
55+
futures = []
56+
for timing_file_blob in blobs:
57+
futures.append(
58+
thread_pool.apply_async(
59+
_maybe_download_timing_file, (timing_file_blob,)
60+
)
61+
)
62+
for future in futures:
63+
future.get()
64+
print("Done downloading")
65+
66+
67+
if __name__ == "__main__":
68+
if len(sys.argv) != 2:
69+
logging.fatal("Expected usage is cache_lit_timing_files.py <upload/download>")
70+
sys.exit(1)
71+
action = sys.argv[1]
72+
storage_client = storage.Client()
73+
bucket_name = os.environ["CACHE_GCS_BUCKET"]
74+
if action == "download":
75+
download_timing_files(storage_client, bucket_name)
76+
elif action == "upload":
77+
upload_timing_files(storage_client, bucket_name)
78+
else:
79+
logging.fatal("Expected usage is cache_lit_timing_files.py <upload/download>")
80+
sys.exit(1)

.ci/compute_projects.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@
4949
"flang",
5050
},
5151
"lld": {"bolt", "cross-project-tests"},
52-
# TODO(issues/132795): LLDB should be enabled on clang changes.
53-
"clang": {"clang-tools-extra", "cross-project-tests"},
52+
"clang": {"clang-tools-extra", "cross-project-tests", "lldb"},
5453
"mlir": {"flang"},
5554
# Test everything if ci scripts are changed.
5655
".ci": {
@@ -80,6 +79,7 @@
8079
"clang": {"compiler-rt"},
8180
"clang-tools-extra": {"libc"},
8281
"libc": {"libc"},
82+
"compiler-rt": {"compiler-rt"},
8383
".ci": {"compiler-rt", "libc"},
8484
}
8585
DEPENDENT_RUNTIMES_TO_TEST_NEEDS_RECONFIG = {
@@ -100,6 +100,9 @@
100100
"libc", # No Windows Support.
101101
"lldb", # TODO(issues/132800): Needs environment setup.
102102
"bolt", # No Windows Support.
103+
"libcxx",
104+
"libcxxabi",
105+
"libunwind",
103106
}
104107

105108
# These are projects that we should test if the project itself is changed but
@@ -118,6 +121,9 @@
118121
"lldb",
119122
"openmp",
120123
"polly",
124+
"libcxx",
125+
"libcxxabi",
126+
"libunwind",
121127
}
122128

123129
PROJECT_CHECK_TARGETS = {
@@ -327,6 +333,7 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
327333
current_platform = platform.system()
328334
if len(sys.argv) == 2:
329335
current_platform = sys.argv[1]
330-
env_variables = get_env_variables(sys.stdin.readlines(), current_platform)
336+
changed_files = [line.strip() for line in sys.stdin.readlines()]
337+
env_variables = get_env_variables(changed_files, current_platform)
331338
for env_variable in env_variables:
332339
print(f"{env_variable}='{env_variables[env_variable]}'")

.ci/compute_projects_test.py

Lines changed: 61 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,14 @@ def test_llvm_windows(self):
4545
env_variables["project_check_targets"],
4646
"check-clang check-clang-tools check-lld check-llvm check-mlir check-polly",
4747
)
48-
self.assertEqual(
49-
env_variables["runtimes_to_build"], "libcxx;libcxxabi;libunwind"
50-
)
48+
self.assertEqual(env_variables["runtimes_to_build"], "")
5149
self.assertEqual(
5250
env_variables["runtimes_check_targets"],
5351
"",
5452
)
5553
self.assertEqual(
5654
env_variables["runtimes_check_targets_needs_reconfig"],
57-
"check-cxx check-cxxabi check-unwind",
55+
"",
5856
)
5957

6058
def test_llvm_mac(self):
@@ -69,16 +67,14 @@ def test_llvm_mac(self):
6967
env_variables["project_check_targets"],
7068
"check-clang check-clang-tools check-lld check-llvm check-mlir",
7169
)
72-
self.assertEqual(
73-
env_variables["runtimes_to_build"], "libcxx;libcxxabi;libunwind"
74-
)
70+
self.assertEqual(env_variables["runtimes_to_build"], "")
7571
self.assertEqual(
7672
env_variables["runtimes_check_targets"],
7773
"",
7874
)
7975
self.assertEqual(
8076
env_variables["runtimes_check_targets_needs_reconfig"],
81-
"check-cxx check-cxxabi check-unwind",
77+
"",
8278
)
8379

8480
def test_clang(self):
@@ -87,11 +83,11 @@ def test_clang(self):
8783
)
8884
self.assertEqual(
8985
env_variables["projects_to_build"],
90-
"clang;clang-tools-extra;lld;llvm",
86+
"clang;clang-tools-extra;lld;lldb;llvm",
9187
)
9288
self.assertEqual(
9389
env_variables["project_check_targets"],
94-
"check-clang check-clang-tools",
90+
"check-clang check-clang-tools check-lldb",
9591
)
9692
self.assertEqual(
9793
env_variables["runtimes_to_build"], "compiler-rt;libcxx;libcxxabi;libunwind"
@@ -119,30 +115,54 @@ def test_clang_windows(self):
119115
self.assertEqual(
120116
env_variables["project_check_targets"], "check-clang check-clang-tools"
121117
)
122-
self.assertEqual(
123-
env_variables["runtimes_to_build"], "libcxx;libcxxabi;libunwind"
124-
)
118+
self.assertEqual(env_variables["runtimes_to_build"], "")
125119
self.assertEqual(
126120
env_variables["runtimes_check_targets"],
127121
"",
128122
)
129123
self.assertEqual(
130124
env_variables["runtimes_check_targets_needs_reconfig"],
131-
"check-cxx check-cxxabi check-unwind",
125+
"",
132126
)
133127
self.assertEqual(env_variables["enable_cir"], "OFF")
134128

129+
def test_compiler_rt(self):
130+
env_variables = compute_projects.get_env_variables(
131+
["compiler-rt/lib/asan/asan_allocator.cpp"], "Linux"
132+
)
133+
self.assertEqual(
134+
env_variables["projects_to_build"],
135+
"clang;lld",
136+
)
137+
self.assertEqual(
138+
env_variables["project_check_targets"],
139+
"",
140+
)
141+
self.assertEqual(env_variables["runtimes_to_build"], "compiler-rt")
142+
self.assertEqual(
143+
env_variables["runtimes_check_targets"],
144+
"check-compiler-rt",
145+
)
146+
self.assertEqual(
147+
env_variables["runtimes_check_targets_needs_reconfig"],
148+
"",
149+
)
150+
self.assertEqual(
151+
env_variables["enable_cir"],
152+
"OFF",
153+
)
154+
135155
def test_cir(self):
136156
env_variables = compute_projects.get_env_variables(
137157
["clang/lib/CIR/CMakeLists.txt"], "Linux"
138158
)
139159
self.assertEqual(
140160
env_variables["projects_to_build"],
141-
"clang;clang-tools-extra;lld;llvm;mlir",
161+
"clang;clang-tools-extra;lld;lldb;llvm;mlir",
142162
)
143163
self.assertEqual(
144164
env_variables["project_check_targets"],
145-
"check-clang check-clang-cir check-clang-tools",
165+
"check-clang check-clang-cir check-clang-tools check-lldb",
146166
)
147167
self.assertEqual(
148168
env_variables["runtimes_to_build"], "compiler-rt;libcxx;libcxxabi;libunwind"
@@ -284,6 +304,31 @@ def test_ci(self):
284304
"check-cxx check-cxxabi check-unwind",
285305
)
286306

307+
def test_windows_ci(self):
308+
env_variables = compute_projects.get_env_variables(
309+
[".ci/compute_projects.py"], "Windows"
310+
)
311+
self.assertEqual(
312+
env_variables["projects_to_build"],
313+
"clang;clang-tools-extra;libclc;lld;llvm;mlir;polly",
314+
)
315+
self.assertEqual(
316+
env_variables["project_check_targets"],
317+
"check-clang check-clang-cir check-clang-tools check-lld check-llvm check-mlir check-polly",
318+
)
319+
self.assertEqual(
320+
env_variables["runtimes_to_build"],
321+
"",
322+
)
323+
self.assertEqual(
324+
env_variables["runtimes_check_targets"],
325+
"",
326+
)
327+
self.assertEqual(
328+
env_variables["runtimes_check_targets_needs_reconfig"],
329+
"",
330+
)
331+
287332
def test_lldb(self):
288333
env_variables = compute_projects.get_env_variables(
289334
["lldb/CMakeLists.txt"], "Linux"

.ci/generate_test_report_github.py

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

66
import argparse
7+
import platform
78

89
import generate_test_report_lib
910

11+
PLATFORM_TITLES = {
12+
"Windows": ":window: Windows x64 Test Results",
13+
"Linux": ":penguin: Linux x64 Test Results",
14+
}
15+
1016
if __name__ == "__main__":
1117
parser = argparse.ArgumentParser()
18+
parser.add_argument("return_code", help="The build's return code.", type=int)
1219
parser.add_argument(
13-
"title", help="Title of the test report, without Markdown formatting."
20+
"build_test_logs", help="Paths to JUnit report files and ninja logs.", nargs="*"
1421
)
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="*")
1722
args = parser.parse_args()
1823

1924
report = generate_test_report_lib.generate_report_from_files(
20-
args.title, args.return_code, args.junit_files
25+
PLATFORM_TITLES[platform.system()], args.return_code, args.build_test_logs
2126
)
2227

2328
print(report)

0 commit comments

Comments
 (0)