77
88from conan .test .assets .cmake import gen_cmakelists
99from conan .test .assets .sources import gen_function_cpp , gen_function_c
10+ from test .conftest import tools_locations
1011from test .functional .utils import check_vs_runtime , check_exe_run
1112from conan .test .utils .tools import TestClient
1213
@@ -56,16 +57,22 @@ def package_info(self):
5657 cmd = os.path.join(self.package_folder, "bin", "my_app")
5758 self.output.info("MYCMD={}!".format(os.path.abspath(cmd)))
5859 """ )
60+ clangpath = tools_locations ["clang" ]["20" ]["path" ]["Windows" ]
61+ llvm_clang_path = textwrap .dedent (f"""
62+ [buildenv]
63+ PATH=+(path){ clangpath }
64+ """ )
5965 c .save ({"conanfile.py" : conanfile ,
6066 "clang" : clang_profile ,
67+ "clang_path" : llvm_clang_path ,
6168 "CMakeLists.txt" : gen_cmakelists (appname = "my_app" , appsources = ["src/main.cpp" ],
6269 install = True ),
6370 "src/main.cpp" : gen_function_cpp (name = "main" )})
6471 return c
6572
6673
6774@pytest .mark .tool ("cmake" )
68- @pytest .mark .tool ("clang" , "18 " )
75+ @pytest .mark .tool ("clang" , "20 " )
6976@pytest .mark .skipif (platform .system () != "Windows" , reason = "requires Win" )
7077class TestLLVMClang :
7178 """ External LLVM/clang, with different CMake generators
@@ -74,19 +81,18 @@ class TestLLVMClang:
7481
7582 @pytest .mark .tool ("mingw64" )
7683 @pytest .mark .tool ("visual_studio" , "17" )
77- @pytest .mark .tool ("clang" , "18" ) # repeated, for priority over the mingw64 clang
7884 @pytest .mark .parametrize ("runtime" , ["static" , "dynamic" ])
7985 def test_clang_mingw (self , client , runtime ):
8086 """ compiling with an LLVM-clang installed, which uses by default the
8187 VS runtime
8288 """
83- client .run ("create . --name=pkg --version=0.1 -pr=clang "
89+ client .run ("create . --name=pkg --version=0.1 -pr=clang -pr=clang_path "
8490 "-s compiler.runtime_version=v144 "
8591 "-s compiler.runtime={}" .format (runtime ))
8692 # clang compilations in Windows will use MinGW Makefiles by default
8793 assert 'cmake -G "MinGW Makefiles"' in client .out
8894 assert "GNU-like command-line" in client .out
89- assert "main __clang_major__18 " in client .out
95+ assert "main __clang_major__20 " in client .out
9096 assert "main _MSC_VER194" in client .out
9197 assert "main _MSVC_LANG2014" in client .out
9298 assert "main _M_X64 defined" in client .out
@@ -102,13 +108,13 @@ def test_clang_mingw(self, client, runtime):
102108 @pytest .mark .tool ("visual_studio" , "17" )
103109 @pytest .mark .parametrize ("generator" , ["Ninja" , "NMake Makefiles" ])
104110 def test_clang_cmake_ninja_nmake (self , client , generator ):
105- client .run ("create . --name=pkg --version=0.1 -pr=clang -s compiler.runtime=dynamic "
106- "-s compiler.runtime_version=v144 "
111+ client .run ("create . --name=pkg --version=0.1 -pr=clang -pr=clang_path "
112+ "-s compiler.runtime=dynamic -s compiler. runtime_version=v144 "
107113 '-c tools.cmake.cmaketoolchain:generator="{}"' .format (generator ))
108114
109115 assert 'cmake -G "{}"' .format (generator ) in client .out
110116 assert "GNU-like command-line" in client .out
111- assert "main __clang_major__18 " in client .out
117+ assert "main __clang_major__20 " in client .out
112118 assert "main _MSC_VER194" in client .out
113119 assert "main _MSVC_LANG2014" in client .out
114120 assert "main _M_X64 defined" in client .out
@@ -126,13 +132,13 @@ def test_clang_cmake_ninja_clang_cl(self, client):
126132 """ )
127133 client .save ({"comp_exes" : pr })
128134
129- client .run ("create . --name=pkg --version=0.1 -pr=clang -pr=comp_exes "
135+ client .run ("create . --name=pkg --version=0.1 -pr=clang -pr=clang_path -pr= comp_exes "
130136 "-s compiler.runtime=dynamic -s compiler.runtime_version=v144 "
131137 '-c tools.cmake.cmaketoolchain:generator="Ninja"' )
132138
133139 assert 'cmake -G "Ninja"' in client .out
134140 assert "MSVC-like command-line" in client .out
135- assert "main __clang_major__18 " in client .out
141+ assert "main __clang_major__20 " in client .out
136142 assert "main _MSC_VER194" in client .out
137143 assert "main _MSVC_LANG2014" in client .out
138144 assert "main _M_X64 defined" in client .out
@@ -143,19 +149,19 @@ def test_clang_cmake_ninja_clang_cl(self, client):
143149
144150 @pytest .mark .tool ("ninja" )
145151 @pytest .mark .tool ("visual_studio" , "17" )
146- @pytest .mark .tool ("clang" , "18" ) # repeated, for priority over the mingw64 clang
147152 def test_clang_cmake_runtime_version (self , client ):
148153 generator = "Ninja"
149154 # Make sure that normal CMakeLists with verify=False works
150155 client .save ({"CMakeLists.txt" : gen_cmakelists (verify = False , appname = "my_app" ,
151156 appsources = ["src/main.cpp" ], install = True )})
152- client .run ("create . --name=pkg --version=0.1 -pr=clang -s compiler.runtime=dynamic "
157+ client .run ("create . --name=pkg --version=0.1 -pr=clang -pr=clang_path "
158+ "-s compiler.runtime=dynamic "
153159 "-s compiler.cppstd=17 -s compiler.runtime_version=v144 "
154160 '-c tools.cmake.cmaketoolchain:generator="{}"' .format (generator ))
155161
156162 assert 'cmake -G "{}"' .format (generator ) in client .out
157163 assert "GNU-like command-line" in client .out
158- assert "main __clang_major__18 " in client .out
164+ assert "main __clang_major__20 " in client .out
159165 # Check this! Clang compiler in Windows is reporting MSC_VER and MSVC_LANG!
160166 assert "main _MSC_VER194" in client .out
161167 assert "main _MSVC_LANG2017" in client .out
@@ -181,7 +187,7 @@ def test_clang_visual_studio_generator(self, client):
181187 '-c tools.cmake.cmaketoolchain:generator="{}"' .format (generator ))
182188 assert 'cmake -G "{}"' .format (generator ) in client .out
183189 assert "MSVC-like command-line" in client .out
184- assert "main __clang_major__19" in client .out
190+ assert "main __clang_major__19" in client .out # The one inside VS is clang 19
185191 # Check this! Clang compiler in Windows is reporting MSC_VER and MSVC_LANG!
186192 # CI forced the installation of 19.38, seems to prevail there
187193 assert "main _MSC_VER19" in client .out
@@ -288,7 +294,7 @@ def test_clang_pure_c(self, client):
288294
289295@pytest .mark .tool ("cmake" )
290296@pytest .mark .tool ("ninja" )
291- @pytest .mark .tool ("clang" , "18 " )
297+ @pytest .mark .tool ("clang" , "20 " )
292298@pytest .mark .skipif (platform .system () != "Windows" , reason = "requires Win" )
293299def test_error_clang_cmake_ninja_custom_cxx (client ):
294300 clang_profile = textwrap .dedent ("""
@@ -297,7 +303,7 @@ def test_error_clang_cmake_ninja_custom_cxx(client):
297303 arch=x86_64
298304 build_type=Release
299305 compiler=clang
300- compiler.version=18
306+ compiler.version=20
301307 [buildenv]
302308 CXX=/no/exist/clang++
303309 """ )
0 commit comments