11# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
22# See https://llvm.org/LICENSE.txt for license information.
33# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4- """Does some stuff. """
4+ """Tests for compute_projects.py """
55
66import unittest
77
@@ -104,6 +104,10 @@ def test_clang(self):
104104 env_variables ["runtimes_check_targets_needs_reconfig" ],
105105 "check-cxx check-cxxabi check-unwind" ,
106106 )
107+ self .assertEqual (
108+ env_variables ["enable_cir" ],
109+ "OFF" ,
110+ )
107111
108112 def test_clang_windows (self ):
109113 env_variables = compute_projects .get_env_variables (
@@ -126,6 +130,32 @@ def test_clang_windows(self):
126130 env_variables ["runtimes_check_targets_needs_reconfig" ],
127131 "check-cxx check-cxxabi check-unwind" ,
128132 )
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" )
129159
130160 def test_bolt (self ):
131161 env_variables = compute_projects .get_env_variables (
@@ -158,6 +188,7 @@ def test_mlir(self):
158188 self .assertEqual (env_variables ["runtimes_to_build" ], "" )
159189 self .assertEqual (env_variables ["runtimes_check_targets" ], "" )
160190 self .assertEqual (env_variables ["runtimes_check_targets_needs_reconfig" ], "" )
191+ self .assertEqual (env_variables ["enable_cir" ], "OFF" )
161192
162193 def test_flang (self ):
163194 env_variables = compute_projects .get_env_variables (
@@ -168,10 +199,11 @@ def test_flang(self):
168199 self .assertEqual (env_variables ["runtimes_to_build" ], "" )
169200 self .assertEqual (env_variables ["runtimes_check_targets" ], "" )
170201 self .assertEqual (env_variables ["runtimes_check_targets_needs_reconfig" ], "" )
202+ self .assertEqual (env_variables ["enable_cir" ], "OFF" )
171203
172204 def test_invalid_subproject (self ):
173205 env_variables = compute_projects .get_env_variables (
174- ["third-party/benchmark /CMakeLists.txt" ], "Linux"
206+ ["llvm-libgcc /CMakeLists.txt" ], "Linux"
175207 )
176208 self .assertEqual (env_variables ["projects_to_build" ], "" )
177209 self .assertEqual (env_variables ["project_check_targets" ], "" )
@@ -237,7 +269,7 @@ def test_ci(self):
237269 )
238270 self .assertEqual (
239271 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" ,
241273 )
242274 self .assertEqual (
243275 env_variables ["runtimes_to_build" ],
@@ -276,6 +308,66 @@ def test_clang_tools_extra(self):
276308 self .assertEqual (env_variables ["runtimes_check_targets" ], "check-libc" )
277309 self .assertEqual (env_variables ["runtimes_check_targets_needs_reconfig" ], "" )
278310
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+
279371
280372if __name__ == "__main__" :
281373 unittest .main ()
0 commit comments