Skip to content

Commit a10f660

Browse files
docstrings
Created using spr 1.3.4
1 parent e0d0e8d commit a10f660

File tree

2 files changed

+43
-7
lines changed

2 files changed

+43
-7
lines changed

.ci/compute_projects.py

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@
5151
"bolt", # No Windows Support.
5252
}
5353

54+
EXCLUDE_MAC = {
55+
"bolt",
56+
"compiler-rt",
57+
"cross-project-tests",
58+
"flang",
59+
"libc",
60+
"libcxx",
61+
"libcxxabi",
62+
"libunwind",
63+
"lldb",
64+
"openmp",
65+
"polly",
66+
}
67+
5468
PROJECT_CHECK_TARGETS = {
5569
"clang-tools-extra": "check-clang-tools",
5670
"compiler-rt": "check-compiler-rt",
@@ -86,7 +100,6 @@ def _add_dependencies(projects: Set[str]) -> Set[str]:
86100

87101

88102
def _compute_projects_to_test(modified_projects: Set[str], platform: str) -> Set[str]:
89-
"""Computes the list of projects that should be passed to LLVM_ENABLE_PROJECTS"""
90103
projects_to_test = set()
91104
for modified_project in modified_projects:
92105
# Skip all projects where we cannot run tests.
@@ -104,6 +117,10 @@ def _compute_projects_to_test(modified_projects: Set[str], platform: str) -> Set
104117
for to_exclude in EXCLUDE_WINDOWS:
105118
if to_exclude in projects_to_test:
106119
projects_to_test.remove(to_exclude)
120+
elif platform == "Darwin":
121+
for to_exclude in EXCLUDE_MAC:
122+
if to_exclude in projects_to_test:
123+
projects_to_test.remove(to_exclude)
107124
else:
108125
raise ValueError("Unexpected platform.")
109126
return projects_to_test
@@ -114,7 +131,6 @@ def _compute_projects_to_build(projects_to_test: Set[str]) -> Set[str]:
114131

115132

116133
def _compute_project_check_targets(projects_to_test: Set[str]) -> Set[str]:
117-
"""blah blah blah"""
118134
check_targets = set()
119135
for project_to_test in projects_to_test:
120136
if project_to_test not in PROJECT_CHECK_TARGETS:
@@ -124,7 +140,6 @@ def _compute_project_check_targets(projects_to_test: Set[str]) -> Set[str]:
124140

125141

126142
def _compute_runtimes_to_test(projects_to_test: Set[str]) -> Set[str]:
127-
"""blah blah blah"""
128143
runtimes_to_test = set()
129144
for project_to_test in projects_to_test:
130145
if project_to_test not in DEPENDENT_RUNTIMES_TO_TEST:
@@ -134,15 +149,13 @@ def _compute_runtimes_to_test(projects_to_test: Set[str]) -> Set[str]:
134149

135150

136151
def _compute_runtime_check_targets(runtimes_to_test: Set[str]) -> Set[str]:
137-
"""blah blah blah"""
138152
check_targets = set()
139153
for runtime_to_test in runtimes_to_test:
140154
check_targets.add(PROJECT_CHECK_TARGETS[runtime_to_test])
141155
return check_targets
142156

143157

144158
def _get_modified_projects(modified_files: list[str]) -> Set[str]:
145-
"""blah blah blah"""
146159
modified_projects = set()
147160
for modified_file in modified_files:
148161
modified_projects.add(pathlib.Path(modified_file).parts[0])
@@ -165,6 +178,9 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
165178

166179

167180
if __name__ == "__main__":
168-
env_variables = get_env_variables(sys.stdin.readlines(), platform.system())
181+
current_platform = platform.system()
182+
if len(sys.argv) == 2:
183+
current_platform = sys.argv[1]
184+
env_variables = get_env_variables(sys.stdin.readlines(), current_platform)
169185
for env_variable in env_variables:
170-
print(f"{env_variable}={env_variables[env_variable]}")
186+
print(f"{env_variable}=\"{env_variables[env_variable]}\"")

.ci/compute_projects_test.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,26 @@ def test_llvm_windows(self):
4848
env_variables["runtimes_check_targets"],
4949
"check-cxx check-cxxabi check-unwind",
5050
)
51+
52+
def test_llvm_mac(self):
53+
env_variables = compute_projects.get_env_variables(
54+
["llvm/CMakeLists.txt"], "Darwin"
55+
)
56+
self.assertEqual(
57+
env_variables["projects_to_build"],
58+
"clang;clang-tools-extra;lld;llvm;mlir",
59+
)
60+
self.assertEqual(
61+
env_variables["project_check_targets"],
62+
"check-clang check-clang-tools check-lld check-llvm check-mlir",
63+
)
64+
self.assertEqual(
65+
env_variables["runtimes_to_build"], "libcxx;libcxxabi;libunwind"
66+
)
67+
self.assertEqual(
68+
env_variables["runtimes_check_targets"],
69+
"check-cxx check-cxxabi check-unwind",
70+
)
5171

5272
def test_clang(self):
5373
env_variables = compute_projects.get_env_variables(

0 commit comments

Comments
 (0)