1
1
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2
2
# See https://llvm.org/LICENSE.txt for license information.
3
3
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
- """Does some stuff. """
4
+ """Tests for compute_projects.py """
5
5
6
6
import unittest
7
7
@@ -104,6 +104,10 @@ def test_clang(self):
104
104
env_variables ["runtimes_check_targets_needs_reconfig" ],
105
105
"check-cxx check-cxxabi check-unwind" ,
106
106
)
107
+ self .assertEqual (
108
+ env_variables ["enable_cir" ],
109
+ "OFF" ,
110
+ )
107
111
108
112
def test_clang_windows (self ):
109
113
env_variables = compute_projects .get_env_variables (
@@ -126,6 +130,32 @@ def test_clang_windows(self):
126
130
env_variables ["runtimes_check_targets_needs_reconfig" ],
127
131
"check-cxx check-cxxabi check-unwind" ,
128
132
)
133
+ self .assertEqual (env_variables ["enable_cir" ], "OFF" )
134
+
135
+ def test_cir (self ):
136
+ env_variables = compute_projects .get_env_variables (
137
+ ["clang/lib/CIR/CMakeLists.txt" ], "Linux"
138
+ )
139
+ self .assertEqual (
140
+ env_variables ["projects_to_build" ],
141
+ "clang;clang-tools-extra;lld;llvm;mlir" ,
142
+ )
143
+ self .assertEqual (
144
+ env_variables ["project_check_targets" ],
145
+ "check-clang check-clang-cir check-clang-tools" ,
146
+ )
147
+ self .assertEqual (
148
+ env_variables ["runtimes_to_build" ], "compiler-rt;libcxx;libcxxabi;libunwind"
149
+ )
150
+ self .assertEqual (
151
+ env_variables ["runtimes_check_targets" ],
152
+ "check-compiler-rt" ,
153
+ )
154
+ self .assertEqual (
155
+ env_variables ["runtimes_check_targets_needs_reconfig" ],
156
+ "check-cxx check-cxxabi check-unwind" ,
157
+ )
158
+ self .assertEqual (env_variables ["enable_cir" ], "ON" )
129
159
130
160
def test_bolt (self ):
131
161
env_variables = compute_projects .get_env_variables (
@@ -158,6 +188,7 @@ def test_mlir(self):
158
188
self .assertEqual (env_variables ["runtimes_to_build" ], "" )
159
189
self .assertEqual (env_variables ["runtimes_check_targets" ], "" )
160
190
self .assertEqual (env_variables ["runtimes_check_targets_needs_reconfig" ], "" )
191
+ self .assertEqual (env_variables ["enable_cir" ], "OFF" )
161
192
162
193
def test_flang (self ):
163
194
env_variables = compute_projects .get_env_variables (
@@ -168,10 +199,11 @@ def test_flang(self):
168
199
self .assertEqual (env_variables ["runtimes_to_build" ], "" )
169
200
self .assertEqual (env_variables ["runtimes_check_targets" ], "" )
170
201
self .assertEqual (env_variables ["runtimes_check_targets_needs_reconfig" ], "" )
202
+ self .assertEqual (env_variables ["enable_cir" ], "OFF" )
171
203
172
204
def test_invalid_subproject (self ):
173
205
env_variables = compute_projects .get_env_variables (
174
- ["third-party/benchmark /CMakeLists.txt" ], "Linux"
206
+ ["llvm-libgcc /CMakeLists.txt" ], "Linux"
175
207
)
176
208
self .assertEqual (env_variables ["projects_to_build" ], "" )
177
209
self .assertEqual (env_variables ["project_check_targets" ], "" )
@@ -237,7 +269,7 @@ def test_ci(self):
237
269
)
238
270
self .assertEqual (
239
271
env_variables ["project_check_targets" ],
240
- "check-bolt check-clang check-clang-tools check-flang check-lld check-lldb check-llvm check-mlir check-polly" ,
272
+ "check-bolt check-clang check-clang-cir check-clang- tools check-flang check-lld check-lldb check-llvm check-mlir check-polly" ,
241
273
)
242
274
self .assertEqual (
243
275
env_variables ["runtimes_to_build" ],
@@ -276,6 +308,66 @@ def test_clang_tools_extra(self):
276
308
self .assertEqual (env_variables ["runtimes_check_targets" ], "check-libc" )
277
309
self .assertEqual (env_variables ["runtimes_check_targets_needs_reconfig" ], "" )
278
310
311
+ def test_premerge_workflow (self ):
312
+ env_variables = compute_projects .get_env_variables (
313
+ [".github/workflows/premerge.yaml" ], "Linux"
314
+ )
315
+ self .assertEqual (
316
+ env_variables ["projects_to_build" ],
317
+ "bolt;clang;clang-tools-extra;flang;libclc;lld;lldb;llvm;mlir;polly" ,
318
+ )
319
+ self .assertEqual (
320
+ env_variables ["project_check_targets" ],
321
+ "check-bolt check-clang check-clang-cir check-clang-tools check-flang check-lld check-lldb check-llvm check-mlir check-polly" ,
322
+ )
323
+ self .assertEqual (
324
+ env_variables ["runtimes_to_build" ],
325
+ "compiler-rt;libc;libcxx;libcxxabi;libunwind" ,
326
+ )
327
+ self .assertEqual (
328
+ env_variables ["runtimes_check_targets" ],
329
+ "check-compiler-rt check-libc" ,
330
+ )
331
+ self .assertEqual (
332
+ env_variables ["runtimes_check_targets_needs_reconfig" ],
333
+ "check-cxx check-cxxabi check-unwind" ,
334
+ )
335
+
336
+ def test_other_github_workflow (self ):
337
+ env_variables = compute_projects .get_env_variables (
338
+ [".github/workflows/docs.yml" ], "Linux"
339
+ )
340
+ self .assertEqual (env_variables ["projects_to_build" ], "" )
341
+ self .assertEqual (env_variables ["project_check_targets" ], "" )
342
+ self .assertEqual (env_variables ["runtimes_to_build" ], "" )
343
+ self .assertEqual (env_variables ["runtimes_check_targets" ], "" )
344
+ self .assertEqual (env_variables ["runtimes_check_targets_needs_reconfig" ], "" )
345
+
346
+ def test_third_party_benchmark (self ):
347
+ env_variables = compute_projects .get_env_variables (
348
+ ["third-party/benchmark/CMakeLists.txt" ], "Linux"
349
+ )
350
+ self .assertEqual (
351
+ env_variables ["projects_to_build" ],
352
+ "bolt;clang;clang-tools-extra;flang;libclc;lld;lldb;llvm;mlir;polly" ,
353
+ )
354
+ self .assertEqual (
355
+ env_variables ["project_check_targets" ],
356
+ "check-bolt check-clang check-clang-cir check-clang-tools check-flang check-lld check-lldb check-llvm check-mlir check-polly" ,
357
+ )
358
+ self .assertEqual (
359
+ env_variables ["runtimes_to_build" ],
360
+ "compiler-rt;libc;libcxx;libcxxabi;libunwind" ,
361
+ )
362
+ self .assertEqual (
363
+ env_variables ["runtimes_check_targets" ],
364
+ "check-compiler-rt check-libc" ,
365
+ )
366
+ self .assertEqual (
367
+ env_variables ["runtimes_check_targets_needs_reconfig" ],
368
+ "check-cxx check-cxxabi check-unwind" ,
369
+ )
370
+
279
371
280
372
if __name__ == "__main__" :
281
373
unittest .main ()
0 commit comments