Skip to content

Commit a35ce49

Browse files
memshardedfranramirez688czoido
authored
Test/clang 19 (#19383)
* wip * working * removed vxworks test * fixes * fix sysroot for qnx under autotools (#18897) * fix sysroot for qnx under autotools * fix comma * Feature/config install pkg lock (#17793) * conan config install-pkg from lockfile * checking locked config-requires * wip * wip * wip * minor refactor * wip * wip * fixes * reverted to not break existing cache config_version.json * fix test * wip * wip * wip * wip * final proposal * imports * ready for review * review, better API, better UX default to cwd, new command * fix test * fix ignore of conaninfo.txt and conanmanifest.txt * msg for conan config clean * [MesonToolchain] `needs_exe_wrapper` depends on `can_run` function (#19382) * Conditioned to can_run property * comments * without quotes * Fixed test * precedence * wip * wip * fixes * fixes * fixes * fixes * fixes * Update test/functional/toolchains/gnu/autotools/test_win_bash.py Co-authored-by: Carlos Zoido <[email protected]> --------- Co-authored-by: Francisco Ramírez <[email protected]> Co-authored-by: Carlos Zoido <[email protected]>
1 parent 7a7f577 commit a35ce49

File tree

6 files changed

+57
-170
lines changed

6 files changed

+57
-170
lines changed

test/conftest.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,13 @@
4848
msys2_path = os.getenv("MSYS2_PATH", "C:/msys64")
4949

5050
tools_locations = {
51-
"clang": {"disabled": True},
51+
"clang": {
52+
"exe": "clang",
53+
"default": "20",
54+
"20": {
55+
"path": {'Windows': 'C:/Program Files/LLVM/bin'} # by choco
56+
}
57+
},
5258
'visual_studio': {"default": "15",
5359
"15": {},
5460
"16": {"disabled": True},

test/functional/subsystems_build_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,8 @@ def test_cygwin(self):
491491
check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="cygwin")
492492
check_vs_runtime("app.exe", client, "15", "Debug", subsystem="cygwin")
493493

494-
@pytest.mark.tool("clang", "13")
494+
@pytest.mark.tool("ninja")
495+
@pytest.mark.tool("clang", "20")
495496
def test_clang(self):
496497
"""
497498
native, LLVM/Clang compiler

test/functional/toolchains/cmake/test_cmake_toolchain_vxworks_clang.py

Lines changed: 0 additions & 127 deletions
This file was deleted.

test/functional/toolchains/cmake/test_cmake_toolchain_win_clang.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from conan.test.assets.cmake import gen_cmakelists
99
from conan.test.assets.sources import gen_function_cpp, gen_function_c
10+
from test.conftest import tools_locations
1011
from test.functional.utils import check_vs_runtime, check_exe_run
1112
from 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")
7077
class 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")
293299
def 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
""")

test/functional/toolchains/gnu/autotools/test_win_bash.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,25 +65,25 @@ def build(self):
6565

6666

6767
@pytest.mark.skipif(platform.system() != "Windows", reason="Requires Windows")
68-
@pytest.mark.tool("clang", "18")
6968
@pytest.mark.tool("msys2")
69+
@pytest.mark.tool("clang", "20")
7070
@pytest.mark.parametrize("frontend", ("clang", "clang-cl"))
7171
@pytest.mark.parametrize("runtime", ("static", "dynamic"))
7272
@pytest.mark.parametrize("build_type", ("Debug", "Release"))
7373
def test_autotools_bash_complete_clang(frontend, runtime, build_type):
7474
client = TestClient(path_with_spaces=False)
7575
# Problem is that msys2 also has clang in the path, so we need to make it explicit
76-
clangpath = tools_locations["clang"]["18"]["path"]["Windows"]
76+
clangpath = tools_locations["clang"]["20"]["path"]["Windows"]
7777
# compilers
7878
c, cpp = ("clang", "clang++") if frontend == "clang" else ("clang-cl", "clang-cl")
79-
comps = f'{{"cpp":"{clangpath}/{cpp}", "c":"{clangpath}/{c}", "rc":"{clangpath}/{c}"}}'
79+
comps = f'{{"cpp":"{cpp}", "c":"{c}", "rc":"{c}"}}'
8080
profile_win = textwrap.dedent(f"""
8181
[settings]
8282
os=Windows
8383
arch=x86_64
8484
build_type={build_type}
8585
compiler=clang
86-
compiler.version=18
86+
compiler.version=20
8787
compiler.cppstd=14
8888
compiler.runtime_version=v144
8989
compiler.runtime={runtime}
@@ -93,6 +93,9 @@ def test_autotools_bash_complete_clang(frontend, runtime, build_type):
9393
tools.microsoft.bash:subsystem=msys2
9494
tools.microsoft.bash:path=bash
9595
tools.compilation:verbosity=verbose
96+
97+
[buildenv]
98+
PATH=+(path){clangpath}
9699
""")
97100

98101
main = gen_function_cpp(name="main")
@@ -131,7 +134,7 @@ def build(self):
131134
client.run("build . -pr=profile_win")
132135
client.run_command("main.exe")
133136
assert "__GNUC__" not in client.out
134-
assert "main __clang_major__18" in client.out
137+
assert "main __clang_major__20" in client.out
135138
check_exe_run(client.out, "main", "clang", None, build_type, "x86_64", None)
136139

137140
bat_contents = client.load("conanbuild.bat")

0 commit comments

Comments
 (0)