From b9a73e9b0c1579e7bb28c72ad91c0fba2bead2b1 Mon Sep 17 00:00:00 2001 From: memsharded Date: Mon, 27 Jun 2022 01:35:28 +0200 Subject: [PATCH 01/11] further testing subsystems --- conans/test/conftest.py | 23 +++ .../test/functional/subsystems_build_test.py | 148 +++++++++++++----- conans/test/functional/utils.py | 51 +++++- 3 files changed, 176 insertions(+), 46 deletions(-) diff --git a/conans/test/conftest.py b/conans/test/conftest.py index 07905171fa5..5a871683672 100644 --- a/conans/test/conftest.py +++ b/conans/test/conftest.py @@ -92,6 +92,13 @@ "exe": "mingw32-make", "system": {"path": {'Windows': "C:/msys64/mingw32/bin"}}, }, + 'ucrt64': { + "disabled": True, + "platform": "Windows", + "default": "system", + "exe": "mingw32-make", + "system": {"path": {'Windows': "C:/msys64/ucrt64/bin"}}, + }, 'mingw64': { "platform": "Windows", "default": "system", @@ -104,6 +111,20 @@ "exe": "make", "system": {"path": {'Windows': "C:/msys64/usr/bin"}}, }, + 'msys2_clang64': { + "disabled": True, + "platform": "Windows", + "default": "system", + "exe": "mingw32-make", + "system": {"path": {'Windows': "C:/msys64/clang64/bin"}}, + }, + 'msys2_mingw64_clang64': { + "disabled": True, + "platform": "Windows", + "default": "system", + "exe": "mingw32-make", + "system": {"path": {'Windows': "C:/msys64/mingw64/bin"}}, + }, 'cygwin': { "platform": "Windows", "default": "system", @@ -156,6 +177,8 @@ def update(d, u): tools_environments = { 'mingw32': {'Windows': {'MSYSTEM': 'MINGW32'}}, 'mingw64': {'Windows': {'MSYSTEM': 'MINGW64'}}, + 'ucrt64': {'Windows': {'MSYSTEM': 'UCRT64'}}, + 'msys2_clang64': {"Windows": {"MSYSTEM": "CLANG64"}}, 'android_ndk': {'Darwin': {'TEST_CONAN_ANDROID_NDK': '/usr/local/share/android-ndk'}} } diff --git a/conans/test/functional/subsystems_build_test.py b/conans/test/functional/subsystems_build_test.py index d8c6ac4ee03..b3c1bc6cf2f 100644 --- a/conans/test/functional/subsystems_build_test.py +++ b/conans/test/functional/subsystems_build_test.py @@ -3,9 +3,10 @@ import pytest import textwrap +from conans.client.tools import environment_append from conans.test.assets.autotools import gen_makefile from conans.test.assets.sources import gen_function_cpp -from conans.test.functional.utils import check_exe_run +from conans.test.functional.utils import check_exe_run, check_vs_runtime from conans.test.utils.tools import TestClient @@ -14,12 +15,24 @@ class TestSubsystems: @pytest.mark.tool_msys2 def test_msys2_available(self): + """ + Msys2 needs to be installed: + - Go to https://www.msys2.org/, download the exe installer and run it + - Follow instructions in https://www.msys2.org/ to update the package DB + - Install msys2 autotools "pacman -S autotools" + - Make sure the entry in conftest_user.py of msys2 points to the right location + """ client = TestClient() client.run_command('uname') assert "MSYS" in client.out @pytest.mark.tool_cygwin def test_cygwin_available(self): + """ Cygwin is necessary + - Install from https://www.cygwin.com/install.html, use the default packages + - Install automake 1.16, gcc-g++, make and binutils packages (will add autoconf and more) + - Make sure that the path in conftest_user.py is pointing to cygwin "bin" folder + """ client = TestClient() client.run_command('uname') assert "CYGWIN" in client.out @@ -27,13 +40,36 @@ def test_cygwin_available(self): @pytest.mark.tool_msys2 @pytest.mark.tool_mingw32 def test_mingw32_available(self): + """ Mingw32 needs to be installed. We use msys2, don't know if others work + - Inside msys2, install pacman -S mingw-w64-i686-toolchain (all pkgs) + """ client = TestClient() client.run_command('uname') assert "MINGW32_NT" in client.out + @pytest.mark.tool_msys2 + @pytest.mark.tool_ucrt64 + def test_ucrt64_available(self): + """ ucrt64 needs to be installed. We use msys2, don't know if others work + - Inside msys2, install pacman -S mingw-w64-ucrt-x86_64-toolchain (all pkgs) + """ + client = TestClient() + client.run_command('uname') + assert "MINGW64_NT" in client.out + + @pytest.mark.tool_msys2 + @pytest.mark.tool_msys2_clang64 + def test_clang64_available(self): + client = TestClient() + client.run_command('uname') + assert "MINGW64_NT" in client.out + @pytest.mark.tool_msys2 @pytest.mark.tool_mingw64 def test_mingw64_available(self): + """ Mingw64 needs to be installed. We use msys2, don't know if others work + - Inside msys2, install pacman -S mingw-w64-x86_64-toolchain (all pkgs) + """ client = TestClient() client.run_command('uname') assert "MINGW64_NT" in client.out @@ -57,52 +93,102 @@ def _build(client): client.run_command("app") @pytest.mark.tool_msys2 - def test_msys(self): + def test_msys2(self): """ native MSYS environment, binaries depend on MSYS runtime (msys-2.0.dll) + Install: + - pacman -S gcc posix-compatible, intended to be run only in MSYS environment (not in pure Windows) """ client = TestClient() - # pacman -S gcc self._build(client) - check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None) - - assert "__MINGW32__" not in client.out - assert "__MINGW64__" not in client.out - assert "__MSYS__" in client.out + check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="msys2") + assert "_M_X64" not in client.out + # TODO: Do not hardcode the visual version + check_vs_runtime("app.exe", client, "15", "Release", subsystem="msys2") @pytest.mark.tool_msys2 @pytest.mark.tool_mingw64 def test_mingw64(self): """ - 64-bit GCC, binaries for generic Windows (no dependency on MSYS runtime) + This will work if you installed the Mingw toolchain inside msys2 as TestSubystems above + 64-bit GCC, binaries """ client = TestClient() # pacman -S mingw-w64-x86_64-gcc self._build(client) - check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None) + check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="mingw64") + # it also defines the VS 64 bits macro + assert "main _M_X64 defined" in client.out + check_vs_runtime("app.exe", client, "15", "Release", subsystem="mingw64") - assert "__MINGW64__" in client.out - assert "__CYGWIN__" not in client.out - assert "__MSYS__" not in client.out + @pytest.mark.tool_msys2 + @pytest.mark.tool_msys2_clang64 + def test_msys2_clang64(self): + """ + in msys2 + $ pacman -S mingw-w64-x86_64-clang (NO, this is the mingw variant in ming64) + $ pacman -S mingw-w64-clang-x86_64-toolchain + """ + client = TestClient() + self._build(client) + + check_exe_run(client.out, "main", "clang", None, "Debug", "x86_64", None, + subsystem="mingw64") + # it also defines the VS 64 bits macro + assert "main _M_X64 defined" in client.out + check_vs_runtime("app.exe", client, "15", "Release", subsystem="clang64") + + @pytest.mark.tool_msys2 + @pytest.mark.tool_msys2_mingw64_clang64 + def test_msys2_mingw64_clang64(self): + """ + in msys2 + $ pacman -S mingw-w64-x86_64-clang + $ pacman -S mingw-w64-clang-x86_64-toolchain (NO, this is the clang) + """ + client = TestClient() + # Need to redefine CXX otherwise is gcc + with environment_append({"CXX": "clang++"}): + self._build(client) + + check_exe_run(client.out, "main", "clang", None, "Debug", "x86_64", None, + subsystem="mingw64") + # it also defines the VS 64 bits macro + assert "main _M_X64 defined" in client.out + check_vs_runtime("app.exe", client, "15", "Release", subsystem="mingw64") @pytest.mark.tool_msys2 @pytest.mark.tool_mingw32 def test_mingw32(self): """ + This will work if you installed the Mingw toolchain inside msys2 as TestSubystems above 32-bit GCC, binaries for generic Windows (no dependency on MSYS runtime) """ client = TestClient() # pacman -S mingw-w64-i686-gcc self._build(client) - check_exe_run(client.out, "main", "gcc", None, "Debug", "x86", None) + check_exe_run(client.out, "main", "gcc", None, "Debug", "x86", None, subsystem="mingw32") + # It also defines the VS flag + assert "main _M_IX86 defined" in client.out + check_vs_runtime("app.exe", client, "15", "Release", subsystem="mingw32") - assert "__MINGW32__" in client.out - assert "__CYGWIN__" not in client.out - assert "__MSYS__" not in client.out + @pytest.mark.tool_msys2 + @pytest.mark.tool_ucrt64 + def test_ucrt64(self): + """ + This will work if you installed the Mingw toolchain inside msys2 as TestSubystems above + """ + client = TestClient() + + self._build(client) + check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="mingw32") + # it also defines the VS macro + assert "main _M_X64 defined" in client.out + check_vs_runtime("app.exe", client, "15", "Release", subsystem="ucrt64") @pytest.mark.tool_cygwin def test_cygwin(self): @@ -111,14 +197,9 @@ def test_cygwin(self): posix-compatible, intended to be run only in Cygwin environment (not in pure Windows) """ client = TestClient() - # install "gcc-c++" and "make" packages self._build(client) - check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None) - - assert "__CYGWIN__" in client.out - assert "__MINGW32__" not in client.out - assert "__MINGW64__" not in client.out - assert "__MSYS__" not in client.out + check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="cygwin") + check_vs_runtime("app.exe", client, "15", "Release", subsystem="cygwin") @pytest.mark.skipif(platform.system() != "Windows", reason="Tests Windows Subsystems") @@ -201,9 +282,9 @@ def test_cygwin(self): """ Cygwin environment, binaries depend on Cygwin runtime (cygwin1.dll) posix-compatible, intended to be run only in Cygwin environment (not in pure Windows) + # install autotools, autoconf, libtool, "gcc-c++" and "make" packages """ client = TestClient() - # install "gcc-c++" and "make" packages self._build(client) check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None) @@ -235,12 +316,7 @@ def _build(self, client, generator="Unix Makefiles"): @pytest.mark.tool_msys2 def test_msys(self): - """ - native MSYS environment, binaries depend on MSYS runtime (msys-2.0.dll) - posix-compatible, intended to be run only in MSYS environment (not in pure Windows) - """ client = TestClient() - # pacman -S gcc self._build(client) check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None) @@ -252,11 +328,7 @@ def test_msys(self): @pytest.mark.tool_msys2 @pytest.mark.tool_mingw64 def test_mingw64(self): - """ - 64-bit GCC, binaries for generic Windows (no dependency on MSYS runtime) - """ client = TestClient() - # pacman -S mingw-w64-x86_64-gcc self._build(client, generator="MinGW Makefiles") check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None) @@ -268,11 +340,7 @@ def test_mingw64(self): @pytest.mark.tool_msys2 @pytest.mark.tool_mingw32 def test_mingw32(self): - """ - 32-bit GCC, binaries for generic Windows (no dependency on MSYS runtime) - """ client = TestClient() - # pacman -S mingw-w64-i686-gcc self._build(client, generator="MinGW Makefiles") check_exe_run(client.out, "main", "gcc", None, "Debug", "x86", None) @@ -283,10 +351,6 @@ def test_mingw32(self): @pytest.mark.tool_cygwin def test_cygwin(self): - """ - Cygwin environment, binaries depend on Cygwin runtime (cygwin1.dll) - posix-compatible, intended to be run only in Cygwin environment (not in pure Windows) - """ client = TestClient() # install "gcc-c++" and "make" packages self._build(client) diff --git a/conans/test/functional/utils.py b/conans/test/functional/utils.py index 9fe753eabe5..118137b8630 100644 --- a/conans/test/functional/utils.py +++ b/conans/test/functional/utils.py @@ -2,14 +2,36 @@ def check_vs_runtime(artifact, client, vs_version, build_type, architecture="amd64", - static_runtime=False): + static_runtime=False, subsystem=None): vcvars = vcvars_command(version=vs_version, architecture=architecture) normalized_path = artifact.replace("/", "\\") static = artifact.endswith(".a") or artifact.endswith(".lib") if not static: cmd = ('%s && dumpbin /nologo /dependents "%s"' % (vcvars, normalized_path)) client.run_command(cmd) - if static_runtime: + if subsystem: + assert "KERNEL32.dll" in client.out + if subsystem in ("mingw32", "mingw64"): + assert "msvcrt.dll" in client.out + assert "libstdc++-6.dll" in client.out + if subsystem == "mingw32": + assert "libgcc_s_dw2-1.dll" in client.out + elif subsystem == "msys2": + assert "msys-2.0.dll" in client.out + assert "msys-stdc++-6.dll" in client.out + elif subsystem == "cygwin": + assert "cygwin1.dll" in client.out + assert "cygstdc++-6.dll" in client.out + elif subsystem == "ucrt64": + assert "api-ms-win-crt-" in client.out + assert "libstdc++-6.dll" in client.out + elif subsystem == "clang64": + assert "api-ms-win-crt-" in client.out + assert "libc++.dll" in client.out + assert "libunwind.dll" in client.out + else: + raise Exception("unknown {}".format(subsystem)) + elif static_runtime: assert "KERNEL32.dll" in client.out assert "MSVC" not in client.out assert "VCRUNTIME" not in client.out @@ -29,7 +51,7 @@ def check_vs_runtime(artifact, client, vs_version, build_type, architecture="amd def check_exe_run(output, names, compiler, version, build_type, arch, cppstd, definitions=None, - cxx11_abi=None): + cxx11_abi=None, subsystem=None): output = str(output) names = names if isinstance(names, list) else [names] @@ -56,7 +78,7 @@ def check_exe_run(output, names, compiler, version, build_type, arch, cppstd, de assert "{} __GNUC__{}".format(name, major) in output assert "{} __GNUC_MINOR__{}".format(name, minor) in output elif compiler == "clang": - assert "{} __clang__".format(name) in output + assert "{} __clang_".format(name) in output if version: major, minor = version.split(".")[0:2] assert "{} __clang_major__{}".format(name, major) in output @@ -88,3 +110,24 @@ def check_exe_run(output, names, compiler, version, build_type, arch, cppstd, de if definitions: for k, v in definitions.items(): assert "{}: {}".format(k, v) in output + + if subsystem: + if subsystem == "msys2": + assert "MINGW" not in output + assert "__MSYS__" in output + assert "__CYGWIN__" in output + elif subsystem in ("mingw32", "mingw64"): + assert "__MINGW32__" in output + assert "__CYGWIN__" not in output + assert "__MSYS__" not in output + if subsystem == "mingw64": + assert "__MINGW64__" in output + else: + assert "MING64" not in output + elif subsystem == "cygwin": + assert "__CYGWIN__" in output + assert "__MINGW32__" not in output + assert "__MINGW64__" not in output + assert "__MSYS__" not in output + else: + raise Exception("unknown subsystem {}".format(subsystem)) From e703e442b468dbe98cd4692b3c717e36abe2760d Mon Sep 17 00:00:00 2001 From: memsharded Date: Mon, 27 Jun 2022 14:20:43 +0200 Subject: [PATCH 02/11] wip --- .../test/functional/subsystems_build_test.py | 186 +++++++++++++----- conans/test/functional/utils.py | 3 +- 2 files changed, 142 insertions(+), 47 deletions(-) diff --git a/conans/test/functional/subsystems_build_test.py b/conans/test/functional/subsystems_build_test.py index b3c1bc6cf2f..aa10346588f 100644 --- a/conans/test/functional/subsystems_build_test.py +++ b/conans/test/functional/subsystems_build_test.py @@ -6,6 +6,7 @@ from conans.client.tools import environment_append from conans.test.assets.autotools import gen_makefile from conans.test.assets.sources import gen_function_cpp +from conans.test.conftest import tools_locations from conans.test.functional.utils import check_exe_run, check_vs_runtime from conans.test.utils.tools import TestClient @@ -238,12 +239,8 @@ def test_msys(self): client = TestClient() # pacman -S gcc self._build(client) - - check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None) - - assert "__MINGW32__" not in client.out - assert "__MINGW64__" not in client.out - assert "__MSYS__" in client.out + check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="msys2") + check_vs_runtime("app.exe", client, "15", "Release", subsystem="msys2") @pytest.mark.tool_msys2 @pytest.mark.tool_mingw64 @@ -254,12 +251,8 @@ def test_mingw64(self): client = TestClient() # pacman -S mingw-w64-x86_64-gcc self._build(client) - - check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None) - - assert "__MINGW64__" in client.out - assert "__CYGWIN__" not in client.out - assert "__MSYS__" not in client.out + check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="mingw64") + check_vs_runtime("app.exe", client, "15", "Release", subsystem="mingw64") @pytest.mark.tool_msys2 @pytest.mark.tool_mingw32 @@ -270,12 +263,8 @@ def test_mingw32(self): client = TestClient() # pacman -S mingw-w64-i686-gcc self._build(client) - - check_exe_run(client.out, "main", "gcc", None, "Debug", "x86", None) - - assert "__MINGW32__" in client.out - assert "__CYGWIN__" not in client.out - assert "__MSYS__" not in client.out + check_exe_run(client.out, "main", "gcc", None, "Debug", "x86", None, subsystem="mingw32") + check_vs_runtime("app.exe", client, "15", "Release", subsystem="mingw32") @pytest.mark.tool_cygwin def test_cygwin(self): @@ -286,18 +275,16 @@ def test_cygwin(self): """ client = TestClient() self._build(client) - check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None) - - assert "__CYGWIN__" in client.out - assert "__MINGW32__" not in client.out - assert "__MINGW64__" not in client.out - assert "__MSYS__" not in client.out + check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="cygwin") + check_vs_runtime("app.exe", client, "15", "Release", subsystem="cygwin") @pytest.mark.skipif(platform.system() != "Windows", reason="Tests Windows Subsystems") class TestSubsystemsCMakeBuild: + """ These tests are running the CMake INSIDE THE subsystem, not the Windows native one + """ cmakelists = textwrap.dedent(""" - cmake_minimum_required(VERSION 2.8) + cmake_minimum_required(VERSION 3.15) project(app) add_executable(app main.cpp) """) @@ -316,47 +303,154 @@ def _build(self, client, generator="Unix Makefiles"): @pytest.mark.tool_msys2 def test_msys(self): + """ + pacman -S cmake + """ client = TestClient() self._build(client) - - check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None) - - assert "__MINGW32__" not in client.out - assert "__MINGW64__" not in client.out - assert "__MSYS__" in client.out + check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="msys2") + check_vs_runtime("app.exe", client, "15", "Release", subsystem="msys2") @pytest.mark.tool_msys2 @pytest.mark.tool_mingw64 def test_mingw64(self): + """ + $ pacman -S mingw-w64-x86_64-cmake + """ client = TestClient() self._build(client, generator="MinGW Makefiles") + check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="mingw64") + check_vs_runtime("app.exe", client, "15", "Release", subsystem="mingw64") - check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None) + @pytest.mark.tool_msys2 + @pytest.mark.tool_msys2_clang64 + @pytest.mark.skip(reason="This doesn't work, seems CMake issue") + def test_msys2_clang64(self): + """ + FAILS WITH: + System is unknown to cmake, create: + Platform/MINGW64_NT-10.0-19044 to use this system, + """ + client = TestClient() + self._build(client, generator="Unix Makefiles") + check_exe_run(client.out, "main", "clang", None, "Debug", "x86_64", None, + subsystem="mingw64") + check_vs_runtime("app.exe", client, "15", "Release", subsystem="clang64") - assert "__MINGW64__" in client.out - assert "__CYGWIN__" not in client.out - assert "__MSYS__" not in client.out + @pytest.mark.tool_msys2 + @pytest.mark.tool_msys2_mingw64_clang64 + def test_msys2_mingw64_clang64(self): + """ + """ + client = TestClient() + # IMPORTANT: Need to redefine the CXX, otherwise CMake will use GCC by default + with environment_append({"CXX": "clang++"}): + self._build(client, generator="MinGW Makefiles") + check_exe_run(client.out, "main", "clang", None, "Debug", "x86_64", None, + subsystem="mingw64") + check_vs_runtime("app.exe", client, "15", "Release", subsystem="mingw64") @pytest.mark.tool_msys2 @pytest.mark.tool_mingw32 def test_mingw32(self): + """ + $ pacman -S mingw-w64-i686-cmake + """ client = TestClient() self._build(client, generator="MinGW Makefiles") - - check_exe_run(client.out, "main", "gcc", None, "Debug", "x86", None) - - assert "__MINGW32__" in client.out - assert "__CYGWIN__" not in client.out - assert "__MSYS__" not in client.out + check_exe_run(client.out, "main", "gcc", None, "Debug", "x86", None, subsystem="mingw32") + check_vs_runtime("app.exe", client, "15", "Release", subsystem="mingw32") @pytest.mark.tool_cygwin def test_cygwin(self): + """ + Needs to install cmake from the cygwin setup.exe + """ client = TestClient() # install "gcc-c++" and "make" packages self._build(client) - check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None) + check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="cygwin") + check_vs_runtime("app.exe", client, "15", "Release", subsystem="cygwin") + + +@pytest.mark.skipif(platform.system() != "Windows", reason="Tests Windows Subsystems") +class TestSubsystemsCMakeExternalBuild: + """ These tests runs from the Windows native CMake, pointing just to the compilers inside + the subsystems + """ + cmakelists = textwrap.dedent(""" + cmake_minimum_required(VERSION 3.15) + project(app CXX) + add_executable(app main.cpp) + """) + + def _build(self, client, location, compiler, generator="MinGW Makefiles"): + """ This seems it wont work with "Unix Makefiles", as now we are in Windows CMake? + """ + main_cpp = gen_function_cpp(name="main") + client.save({"CMakeLists.txt": self.cmakelists, + "main.cpp": main_cpp}) + client.run_command("cmake --version") + print(client.out) - assert "__CYGWIN__" in client.out - assert "__MINGW32__" not in client.out - assert "__MINGW64__" not in client.out - assert "__MSYS__" not in client.out + make = "mingw32-make" if "Unix" not in generator else "make" + compilerpp = "clang++" if compiler == "clang" else "g++" + client.run_command("cmake " + " -DCMAKE_MAKE_PROGRAM={location}/{make}" + " -DCMAKE_CXX_COMPILER={location}/{compilerpp}.exe" + " -DCMAKE_C_COMPILER={location}/{compiler}.exe" + " -DCMAKE_SH=\"CMAKE_SH-NOTFOUND\"" + " -G \"{generator}\"" + " .".format(make=make, location=location, compiler=compiler, + compilerpp=compilerpp, generator=generator)) + print(client.out) + client.run_command("cmake --build .") + print(client.out) + # IMPORTANT: This needs the RUNTIME PATH to locate the shared libc++.dll libraries + with environment_append({}): + client.run_command("app") + print(client.out) + + def test_msys2_gcc(self): + """ + """ + client = TestClient() + msys2 = tools_locations["msys2"] + if msys2.get("disabled"): + pytest.skip("msys2 disabled") + location = msys2["system"]["path"]["Windows"] + # Otherwise the msys2 gcc fails to load its own gcc shared libs to compile + with environment_append({}): + self._build(client, location, generator="Unix Makefiles", compiler="gcc") + check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, + subsystem="msys2") + check_vs_runtime("app.exe", client, "15", "Release", subsystem="msys2") + + def test_msys2_clang64(self): + """ + """ + client = TestClient() + msys2 = tools_locations["msys2_clang64"] + if msys2.get("disabled"): + pytest.skip("msys2 disabled") + location = msys2["system"]["path"]["Windows"] + self._build(client, location, compiler="clang") + check_exe_run(client.out, "main", "clang", None, "Debug", "x86_64", None, + subsystem="mingw64") + check_vs_runtime("app.exe", client, "15", "Release", subsystem="clang64") + + def test_msys2_mingw64(self): + """ + """ + client = TestClient() + msys2 = tools_locations["mingw64"] + if msys2.get("disabled"): + pytest.skip("msys2 disabled") + location = msys2["system"]["path"]["Windows"] + cmake = tools_locations["cmake"] + cmake = cmake["3.19"]["path"]["Windows"] + with environment_append({"PATH": "{};{}".format(cmake, location)}): + self._build(client, location=location, generator="MinGW Makefiles", compiler="gcc") + check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, + subsystem="mingw64") + check_vs_runtime("app.exe", client, "15", "Release", subsystem="mingw64") diff --git a/conans/test/functional/utils.py b/conans/test/functional/utils.py index 118137b8630..ce8e78586e3 100644 --- a/conans/test/functional/utils.py +++ b/conans/test/functional/utils.py @@ -73,6 +73,7 @@ def check_exe_run(output, names, compiler, version, build_type, arch, cppstd, de elif compiler in ["gcc", "clang", "apple-clang"]: if compiler == "gcc": assert "{} __GNUC__".format(name) in output + assert "clang" not in output if version: # FIXME: At the moment, the GCC version is not controlled, will change major, minor = version.split(".")[0:2] assert "{} __GNUC__{}".format(name, major) in output @@ -113,9 +114,9 @@ def check_exe_run(output, names, compiler, version, build_type, arch, cppstd, de if subsystem: if subsystem == "msys2": - assert "MINGW" not in output assert "__MSYS__" in output assert "__CYGWIN__" in output + assert "MINGW" not in output elif subsystem in ("mingw32", "mingw64"): assert "__MINGW32__" in output assert "__CYGWIN__" not in output From 5625a389d8c8dd5cb772383f649d7fb79b5240b1 Mon Sep 17 00:00:00 2001 From: memsharded Date: Mon, 27 Jun 2022 18:04:25 +0200 Subject: [PATCH 03/11] wip --- conans/test/assets/autotools.py | 4 +- .../test/functional/subsystems_build_test.py | 162 ++++++------------ conans/test/functional/utils.py | 33 +++- 3 files changed, 82 insertions(+), 117 deletions(-) diff --git a/conans/test/assets/autotools.py b/conans/test/assets/autotools.py index 473b291d252..96c0559a3c6 100644 --- a/conans/test/assets/autotools.py +++ b/conans/test/assets/autotools.py @@ -55,12 +55,12 @@ def gen_makefile(**context): {% for lib in libs %} {%- set link_libs.str = link_libs.str + ' -l' + lib|string %} lib{{lib}}.a: {{lib}}.o - $(AR) rcs lib{{lib}}.a {{lib}}.o + $(AR) rcs lib{{lib}}.a {{lib}}.o {%if static_runtime%}--static{%endif%} {% endfor %} {% for s in apps %} {{s}}: {{s}}.o libs - $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o {{s}} {{s}}.o $(LIBS) {{link_libs.str}} -L. + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o {{s}} {{s}}.o $(LIBS) {{link_libs.str}} -L. {%if static_runtime%}--static{%endif%} {% endfor %} """) diff --git a/conans/test/functional/subsystems_build_test.py b/conans/test/functional/subsystems_build_test.py index aa10346588f..c8fcb207e23 100644 --- a/conans/test/functional/subsystems_build_test.py +++ b/conans/test/functional/subsystems_build_test.py @@ -6,7 +6,6 @@ from conans.client.tools import environment_append from conans.test.assets.autotools import gen_makefile from conans.test.assets.sources import gen_function_cpp -from conans.test.conftest import tools_locations from conans.test.functional.utils import check_exe_run, check_vs_runtime from conans.test.utils.tools import TestClient @@ -85,16 +84,17 @@ def test_tool_not_available(self): class TestSubsystemsBuild: @staticmethod - def _build(client): - makefile = gen_makefile(apps=["app"]) + def _build(client, static_runtime=None): + makefile = gen_makefile(apps=["app"], static_runtime=static_runtime) main_cpp = gen_function_cpp(name="main") client.save({"Makefile": makefile, "app.cpp": main_cpp}) client.run_command("make") client.run_command("app") + @pytest.mark.parametrize("static", [True, False]) @pytest.mark.tool_msys2 - def test_msys2(self): + def test_msys2(self, static): """ native MSYS environment, binaries depend on MSYS runtime (msys-2.0.dll) Install: @@ -102,45 +102,50 @@ def test_msys2(self): posix-compatible, intended to be run only in MSYS environment (not in pure Windows) """ client = TestClient() - self._build(client) + self._build(client, static_runtime=static) check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="msys2") assert "_M_X64" not in client.out # TODO: Do not hardcode the visual version - check_vs_runtime("app.exe", client, "15", "Release", subsystem="msys2") + check_vs_runtime("app.exe", client, "15", "Release", static_runtime=static, + subsystem="msys2") + @pytest.mark.parametrize("static", [True, False]) @pytest.mark.tool_msys2 @pytest.mark.tool_mingw64 - def test_mingw64(self): + def test_mingw64(self, static): """ This will work if you installed the Mingw toolchain inside msys2 as TestSubystems above 64-bit GCC, binaries """ client = TestClient() # pacman -S mingw-w64-x86_64-gcc - self._build(client) + self._build(client, static_runtime=static) check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="mingw64") # it also defines the VS 64 bits macro assert "main _M_X64 defined" in client.out - check_vs_runtime("app.exe", client, "15", "Release", subsystem="mingw64") + check_vs_runtime("app.exe", client, "15", "Release", static_runtime=static, + subsystem="mingw64") + @pytest.mark.parametrize("static", [True, False]) @pytest.mark.tool_msys2 @pytest.mark.tool_msys2_clang64 - def test_msys2_clang64(self): + def test_msys2_clang64(self, static): """ in msys2 $ pacman -S mingw-w64-x86_64-clang (NO, this is the mingw variant in ming64) $ pacman -S mingw-w64-clang-x86_64-toolchain """ client = TestClient() - self._build(client) + self._build(client, static_runtime=static) check_exe_run(client.out, "main", "clang", None, "Debug", "x86_64", None, subsystem="mingw64") # it also defines the VS 64 bits macro assert "main _M_X64 defined" in client.out - check_vs_runtime("app.exe", client, "15", "Release", subsystem="clang64") + check_vs_runtime("app.exe", client, "15", "Release", static_runtime=static, + subsystem="clang64") @pytest.mark.tool_msys2 @pytest.mark.tool_msys2_mingw64_clang64 @@ -151,56 +156,64 @@ def test_msys2_mingw64_clang64(self): $ pacman -S mingw-w64-clang-x86_64-toolchain (NO, this is the clang) """ client = TestClient() + static = False # This variant needs --static-glibc -static-libstdc++ (weird) to link static # Need to redefine CXX otherwise is gcc with environment_append({"CXX": "clang++"}): - self._build(client) + self._build(client, static_runtime=static) check_exe_run(client.out, "main", "clang", None, "Debug", "x86_64", None, subsystem="mingw64") # it also defines the VS 64 bits macro assert "main _M_X64 defined" in client.out - check_vs_runtime("app.exe", client, "15", "Release", subsystem="mingw64") + check_vs_runtime("app.exe", client, "15", "Release", static_runtime=static, + subsystem="mingw64") + @pytest.mark.parametrize("static", [True, False]) @pytest.mark.tool_msys2 @pytest.mark.tool_mingw32 - def test_mingw32(self): + def test_mingw32(self, static): """ This will work if you installed the Mingw toolchain inside msys2 as TestSubystems above 32-bit GCC, binaries for generic Windows (no dependency on MSYS runtime) """ client = TestClient() # pacman -S mingw-w64-i686-gcc - self._build(client) + self._build(client, static_runtime=static) check_exe_run(client.out, "main", "gcc", None, "Debug", "x86", None, subsystem="mingw32") # It also defines the VS flag assert "main _M_IX86 defined" in client.out - check_vs_runtime("app.exe", client, "15", "Release", subsystem="mingw32") + check_vs_runtime("app.exe", client, "15", "Release", static_runtime=static, + subsystem="mingw32") + @pytest.mark.parametrize("static", [True, False]) @pytest.mark.tool_msys2 @pytest.mark.tool_ucrt64 - def test_ucrt64(self): + def test_ucrt64(self, static): """ This will work if you installed the Mingw toolchain inside msys2 as TestSubystems above """ client = TestClient() - self._build(client) + self._build(client, static_runtime=static) check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="mingw32") # it also defines the VS macro assert "main _M_X64 defined" in client.out - check_vs_runtime("app.exe", client, "15", "Release", subsystem="ucrt64") + check_vs_runtime("app.exe", client, "15", "Release", static_runtime=static, + subsystem="ucrt64") + @pytest.mark.parametrize("static", [True, False]) @pytest.mark.tool_cygwin - def test_cygwin(self): + def test_cygwin(self, static): """ Cygwin environment, binaries depend on Cygwin runtime (cygwin1.dll) posix-compatible, intended to be run only in Cygwin environment (not in pure Windows) """ client = TestClient() - self._build(client) + self._build(client, static_runtime=static) check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="cygwin") - check_vs_runtime("app.exe", client, "15", "Release", subsystem="cygwin") + check_vs_runtime("app.exe", client, "15", "Release", static_runtime=static, + subsystem="cygwin") @pytest.mark.skipif(platform.system() != "Windows", reason="Tests Windows Subsystems") @@ -282,10 +295,14 @@ def test_cygwin(self): @pytest.mark.skipif(platform.system() != "Windows", reason="Tests Windows Subsystems") class TestSubsystemsCMakeBuild: """ These tests are running the CMake INSIDE THE subsystem, not the Windows native one + The results are basically the same if CMake is outside the subsystem, but it is NOT + enough to define CMAKE_CXX_COMPILER full path to the compiler, but it must be in the path + """ cmakelists = textwrap.dedent(""" cmake_minimum_required(VERSION 3.15) project(app) + message(STATUS "MYCMAKE VERSION=${CMAKE_VERSION}") add_executable(app main.cpp) """) @@ -295,8 +312,6 @@ def _build(self, client, generator="Unix Makefiles"): "main.cpp": main_cpp}) client.run_command("cmake " - " -DCMAKE_C_FLAGS=\"-Wl,-verbose\"" - " -DCMAKE_CXX_FLAGS=\"-Wl,-verbose\"" " -DCMAKE_SH=\"CMAKE_SH-NOTFOUND\" -G \"%s\" ." % generator) client.run_command("cmake --build .") client.run_command("app") @@ -337,6 +352,20 @@ def test_msys2_clang64(self): subsystem="mingw64") check_vs_runtime("app.exe", client, "15", "Release", subsystem="clang64") + @pytest.mark.tool_msys2 + @pytest.mark.tool_msys2_clang64 + @pytest.mark.tool_cmake(version="3.19") + def test_msys2_clang64_external(self): + """ + Exactly the same as the previous tests, but with a native cmake 3.19 (higher priority) + """ + client = TestClient() + self._build(client) + assert "MYCMAKE VERSION=3.19" in client.out + check_exe_run(client.out, "main", "clang", None, "Debug", "x86_64", None, + subsystem="mingw64") + check_vs_runtime("app.exe", client, "15", "Release", subsystem="clang64") + @pytest.mark.tool_msys2 @pytest.mark.tool_msys2_mingw64_clang64 def test_msys2_mingw64_clang64(self): @@ -371,86 +400,3 @@ def test_cygwin(self): self._build(client) check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="cygwin") check_vs_runtime("app.exe", client, "15", "Release", subsystem="cygwin") - - -@pytest.mark.skipif(platform.system() != "Windows", reason="Tests Windows Subsystems") -class TestSubsystemsCMakeExternalBuild: - """ These tests runs from the Windows native CMake, pointing just to the compilers inside - the subsystems - """ - cmakelists = textwrap.dedent(""" - cmake_minimum_required(VERSION 3.15) - project(app CXX) - add_executable(app main.cpp) - """) - - def _build(self, client, location, compiler, generator="MinGW Makefiles"): - """ This seems it wont work with "Unix Makefiles", as now we are in Windows CMake? - """ - main_cpp = gen_function_cpp(name="main") - client.save({"CMakeLists.txt": self.cmakelists, - "main.cpp": main_cpp}) - client.run_command("cmake --version") - print(client.out) - - make = "mingw32-make" if "Unix" not in generator else "make" - compilerpp = "clang++" if compiler == "clang" else "g++" - client.run_command("cmake " - " -DCMAKE_MAKE_PROGRAM={location}/{make}" - " -DCMAKE_CXX_COMPILER={location}/{compilerpp}.exe" - " -DCMAKE_C_COMPILER={location}/{compiler}.exe" - " -DCMAKE_SH=\"CMAKE_SH-NOTFOUND\"" - " -G \"{generator}\"" - " .".format(make=make, location=location, compiler=compiler, - compilerpp=compilerpp, generator=generator)) - print(client.out) - client.run_command("cmake --build .") - print(client.out) - # IMPORTANT: This needs the RUNTIME PATH to locate the shared libc++.dll libraries - with environment_append({}): - client.run_command("app") - print(client.out) - - def test_msys2_gcc(self): - """ - """ - client = TestClient() - msys2 = tools_locations["msys2"] - if msys2.get("disabled"): - pytest.skip("msys2 disabled") - location = msys2["system"]["path"]["Windows"] - # Otherwise the msys2 gcc fails to load its own gcc shared libs to compile - with environment_append({}): - self._build(client, location, generator="Unix Makefiles", compiler="gcc") - check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, - subsystem="msys2") - check_vs_runtime("app.exe", client, "15", "Release", subsystem="msys2") - - def test_msys2_clang64(self): - """ - """ - client = TestClient() - msys2 = tools_locations["msys2_clang64"] - if msys2.get("disabled"): - pytest.skip("msys2 disabled") - location = msys2["system"]["path"]["Windows"] - self._build(client, location, compiler="clang") - check_exe_run(client.out, "main", "clang", None, "Debug", "x86_64", None, - subsystem="mingw64") - check_vs_runtime("app.exe", client, "15", "Release", subsystem="clang64") - - def test_msys2_mingw64(self): - """ - """ - client = TestClient() - msys2 = tools_locations["mingw64"] - if msys2.get("disabled"): - pytest.skip("msys2 disabled") - location = msys2["system"]["path"]["Windows"] - cmake = tools_locations["cmake"] - cmake = cmake["3.19"]["path"]["Windows"] - with environment_append({"PATH": "{};{}".format(cmake, location)}): - self._build(client, location=location, generator="MinGW Makefiles", compiler="gcc") - check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, - subsystem="mingw64") - check_vs_runtime("app.exe", client, "15", "Release", subsystem="mingw64") diff --git a/conans/test/functional/utils.py b/conans/test/functional/utils.py index ce8e78586e3..e7402d426da 100644 --- a/conans/test/functional/utils.py +++ b/conans/test/functional/utils.py @@ -13,22 +13,41 @@ def check_vs_runtime(artifact, client, vs_version, build_type, architecture="amd assert "KERNEL32.dll" in client.out if subsystem in ("mingw32", "mingw64"): assert "msvcrt.dll" in client.out - assert "libstdc++-6.dll" in client.out + if static_runtime: + assert "libstdc++-6.dll" not in client.out + else: + assert "libstdc++-6.dll" in client.out if subsystem == "mingw32": - assert "libgcc_s_dw2-1.dll" in client.out + if static_runtime: + assert "libgcc_s_dw2-1.dll" not in client.out + else: + assert "libgcc_s_dw2-1.dll" in client.out elif subsystem == "msys2": assert "msys-2.0.dll" in client.out - assert "msys-stdc++-6.dll" in client.out + if static_runtime: + assert "msys-stdc++-6.dll" not in client.out + else: + assert "msys-stdc++-6.dll" in client.out elif subsystem == "cygwin": assert "cygwin1.dll" in client.out - assert "cygstdc++-6.dll" in client.out + if static_runtime: + assert "cygstdc++-6.dll" not in client.out + else: + assert "cygstdc++-6.dll" in client.out elif subsystem == "ucrt64": assert "api-ms-win-crt-" in client.out - assert "libstdc++-6.dll" in client.out + if static_runtime: + assert "libstdc++-6.dll" not in client.out + else: + assert "libstdc++-6.dll" in client.out elif subsystem == "clang64": assert "api-ms-win-crt-" in client.out - assert "libc++.dll" in client.out - assert "libunwind.dll" in client.out + if static_runtime: + assert "libunwind.dll" not in client.out + assert "libc++.dll" not in client.out + else: + assert "libunwind.dll" in client.out + assert "libc++.dll" in client.out else: raise Exception("unknown {}".format(subsystem)) elif static_runtime: From a0d95d216f5fbc18ad528888109da02ed42ba2dc Mon Sep 17 00:00:00 2001 From: memsharded Date: Mon, 27 Jun 2022 18:37:25 +0200 Subject: [PATCH 04/11] fix test, add checks --- conans/test/functional/toolchains/gnu/autotools/test_basic.py | 3 ++- conans/test/functional/utils.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/conans/test/functional/toolchains/gnu/autotools/test_basic.py b/conans/test/functional/toolchains/gnu/autotools/test_basic.py index 3d4a41f96a1..b254b9edf12 100644 --- a/conans/test/functional/toolchains/gnu/autotools/test_basic.py +++ b/conans/test/functional/toolchains/gnu/autotools/test_basic.py @@ -53,7 +53,8 @@ def build(self): client.run("build .") client.run_command("./main") cxx11_abi = 0 if platform.system() == "Linux" else None - check_exe_run(client.out, "main", "gcc", None, "Release", "x86_64", None, cxx11_abi=cxx11_abi) + compiler = "gcc" if platform.system() == "Linux" else "clang" + check_exe_run(client.out, "main", compiler, None, "Release", "x86_64", None, cxx11_abi=cxx11_abi) assert "hello/0.1: Hello World Release!" in client.out diff --git a/conans/test/functional/utils.py b/conans/test/functional/utils.py index e7402d426da..5ebf6e37116 100644 --- a/conans/test/functional/utils.py +++ b/conans/test/functional/utils.py @@ -55,6 +55,8 @@ def check_vs_runtime(artifact, client, vs_version, build_type, architecture="amd assert "MSVC" not in client.out assert "VCRUNTIME" not in client.out else: + assert "KERNEL32.dll" in client.out + assert "api-ms-win-crt-" in client.out if vs_version in ["15", "16", "17"]: # UCRT debug = "D" if build_type == "Debug" else "" assert "MSVCP140{}.dll".format(debug) in client.out From b2e01303e34699e059e24c7ecc7639619138a5e4 Mon Sep 17 00:00:00 2001 From: memsharded Date: Mon, 27 Jun 2022 20:13:37 +0200 Subject: [PATCH 05/11] fix tests --- conans/test/functional/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/conans/test/functional/utils.py b/conans/test/functional/utils.py index 5ebf6e37116..d249098d7a3 100644 --- a/conans/test/functional/utils.py +++ b/conans/test/functional/utils.py @@ -56,7 +56,10 @@ def check_vs_runtime(artifact, client, vs_version, build_type, architecture="amd assert "VCRUNTIME" not in client.out else: assert "KERNEL32.dll" in client.out - assert "api-ms-win-crt-" in client.out + if build_type == "Debug": + assert "ucrtbased" in client.out + else: + assert "api-ms-win-crt-" in client.out if vs_version in ["15", "16", "17"]: # UCRT debug = "D" if build_type == "Debug" else "" assert "MSVCP140{}.dll".format(debug) in client.out From 7d4cd2a1e8e92c73c3f29ed72e9c72db3f4d6fdf Mon Sep 17 00:00:00 2001 From: memsharded Date: Wed, 29 Jun 2022 00:22:56 +0200 Subject: [PATCH 06/11] add clang tests --- conans/client/conf/__init__.py | 2 +- .../test/functional/subsystems_build_test.py | 82 +++++++++++++------ conans/test/functional/utils.py | 4 + 3 files changed, 64 insertions(+), 24 deletions(-) diff --git a/conans/client/conf/__init__.py b/conans/client/conf/__init__.py index 4e12123078e..38cf0667759 100644 --- a/conans/client/conf/__init__.py +++ b/conans/client/conf/__init__.py @@ -27,7 +27,7 @@ # - For building cross compilation tools: Where the cross compiler will run. os: Windows: - subsystem: [None, cygwin, msys, msys2, wsl] + subsystem: [None, cygwin, msys, msys2, msys2_ucrt64, msys2_ming32, msys2_ming64, msys2_clang64, wsl] WindowsStore: version: ["8.1", "10.0"] WindowsCE: diff --git a/conans/test/functional/subsystems_build_test.py b/conans/test/functional/subsystems_build_test.py index c8fcb207e23..60ab0f080aa 100644 --- a/conans/test/functional/subsystems_build_test.py +++ b/conans/test/functional/subsystems_build_test.py @@ -1,4 +1,5 @@ import platform +import tempfile import pytest import textwrap @@ -107,7 +108,7 @@ def test_msys2(self, static): check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="msys2") assert "_M_X64" not in client.out # TODO: Do not hardcode the visual version - check_vs_runtime("app.exe", client, "15", "Release", static_runtime=static, + check_vs_runtime("app.exe", client, "15", "Debug", static_runtime=static, subsystem="msys2") @pytest.mark.parametrize("static", [True, False]) @@ -125,7 +126,7 @@ def test_mingw64(self, static): check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="mingw64") # it also defines the VS 64 bits macro assert "main _M_X64 defined" in client.out - check_vs_runtime("app.exe", client, "15", "Release", static_runtime=static, + check_vs_runtime("app.exe", client, "15", "Debug", static_runtime=static, subsystem="mingw64") @pytest.mark.parametrize("static", [True, False]) @@ -144,7 +145,7 @@ def test_msys2_clang64(self, static): subsystem="mingw64") # it also defines the VS 64 bits macro assert "main _M_X64 defined" in client.out - check_vs_runtime("app.exe", client, "15", "Release", static_runtime=static, + check_vs_runtime("app.exe", client, "15", "Debug", static_runtime=static, subsystem="clang64") @pytest.mark.tool_msys2 @@ -165,7 +166,7 @@ def test_msys2_mingw64_clang64(self): subsystem="mingw64") # it also defines the VS 64 bits macro assert "main _M_X64 defined" in client.out - check_vs_runtime("app.exe", client, "15", "Release", static_runtime=static, + check_vs_runtime("app.exe", client, "15", "Debug", static_runtime=static, subsystem="mingw64") @pytest.mark.parametrize("static", [True, False]) @@ -183,7 +184,7 @@ def test_mingw32(self, static): check_exe_run(client.out, "main", "gcc", None, "Debug", "x86", None, subsystem="mingw32") # It also defines the VS flag assert "main _M_IX86 defined" in client.out - check_vs_runtime("app.exe", client, "15", "Release", static_runtime=static, + check_vs_runtime("app.exe", client, "15", "Debug", static_runtime=static, subsystem="mingw32") @pytest.mark.parametrize("static", [True, False]) @@ -199,7 +200,7 @@ def test_ucrt64(self, static): check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="mingw32") # it also defines the VS macro assert "main _M_X64 defined" in client.out - check_vs_runtime("app.exe", client, "15", "Release", static_runtime=static, + check_vs_runtime("app.exe", client, "15", "Debug", static_runtime=static, subsystem="ucrt64") @pytest.mark.parametrize("static", [True, False]) @@ -212,7 +213,7 @@ def test_cygwin(self, static): client = TestClient() self._build(client, static_runtime=static) check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="cygwin") - check_vs_runtime("app.exe", client, "15", "Release", static_runtime=static, + check_vs_runtime("app.exe", client, "15", "Debug", static_runtime=static, subsystem="cygwin") @@ -253,7 +254,7 @@ def test_msys(self): # pacman -S gcc self._build(client) check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="msys2") - check_vs_runtime("app.exe", client, "15", "Release", subsystem="msys2") + check_vs_runtime("app.exe", client, "15", "Debug", subsystem="msys2") @pytest.mark.tool_msys2 @pytest.mark.tool_mingw64 @@ -265,7 +266,7 @@ def test_mingw64(self): # pacman -S mingw-w64-x86_64-gcc self._build(client) check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="mingw64") - check_vs_runtime("app.exe", client, "15", "Release", subsystem="mingw64") + check_vs_runtime("app.exe", client, "15", "Debug", subsystem="mingw64") @pytest.mark.tool_msys2 @pytest.mark.tool_mingw32 @@ -277,7 +278,7 @@ def test_mingw32(self): # pacman -S mingw-w64-i686-gcc self._build(client) check_exe_run(client.out, "main", "gcc", None, "Debug", "x86", None, subsystem="mingw32") - check_vs_runtime("app.exe", client, "15", "Release", subsystem="mingw32") + check_vs_runtime("app.exe", client, "15", "Debug", subsystem="mingw32") @pytest.mark.tool_cygwin def test_cygwin(self): @@ -289,7 +290,7 @@ def test_cygwin(self): client = TestClient() self._build(client) check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="cygwin") - check_vs_runtime("app.exe", client, "15", "Release", subsystem="cygwin") + check_vs_runtime("app.exe", client, "15", "Debug", subsystem="cygwin") @pytest.mark.skipif(platform.system() != "Windows", reason="Tests Windows Subsystems") @@ -301,20 +302,30 @@ class TestSubsystemsCMakeBuild: """ cmakelists = textwrap.dedent(""" cmake_minimum_required(VERSION 3.15) - project(app) + project(app CXX) message(STATUS "MYCMAKE VERSION=${CMAKE_VERSION}") add_executable(app main.cpp) """) - def _build(self, client, generator="Unix Makefiles"): + def _build(self, client, generator="Unix Makefiles", compiler=None, toolset=None): main_cpp = gen_function_cpp(name="main") client.save({"CMakeLists.txt": self.cmakelists, "main.cpp": main_cpp}) - client.run_command("cmake " - " -DCMAKE_SH=\"CMAKE_SH-NOTFOUND\" -G \"%s\" ." % generator) + cmake_compiler = "" + if compiler: + cmake_compiler += " -DCMAKE_C_COMPILER={}".format(compiler) + compilerpp = "clang++" if compiler == "clang" else "g++" + cmake_compiler += " -DCMAKE_CXX_COMPILER={}".format(compilerpp) + cmake_compiler += " -DCMAKE_RC_COMPILER={}".format(compiler) + toolset = "-T {}".format(toolset) if toolset else "" + client.run_command("cmake {} {}" + " -DCMAKE_SH=\"CMAKE_SH-NOTFOUND\" -G \"{}\" .".format(cmake_compiler, + toolset, + generator)) client.run_command("cmake --build .") - client.run_command("app") + app = "app" if "Visual" not in generator else r"Debug\app" + client.run_command(app) @pytest.mark.tool_msys2 def test_msys(self): @@ -324,7 +335,7 @@ def test_msys(self): client = TestClient() self._build(client) check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="msys2") - check_vs_runtime("app.exe", client, "15", "Release", subsystem="msys2") + check_vs_runtime("app.exe", client, "15", "Debug", subsystem="msys2") @pytest.mark.tool_msys2 @pytest.mark.tool_mingw64 @@ -335,7 +346,7 @@ def test_mingw64(self): client = TestClient() self._build(client, generator="MinGW Makefiles") check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="mingw64") - check_vs_runtime("app.exe", client, "15", "Release", subsystem="mingw64") + check_vs_runtime("app.exe", client, "15", "Debug", subsystem="mingw64") @pytest.mark.tool_msys2 @pytest.mark.tool_msys2_clang64 @@ -350,7 +361,7 @@ def test_msys2_clang64(self): self._build(client, generator="Unix Makefiles") check_exe_run(client.out, "main", "clang", None, "Debug", "x86_64", None, subsystem="mingw64") - check_vs_runtime("app.exe", client, "15", "Release", subsystem="clang64") + check_vs_runtime("app.exe", client, "15", "Debug", subsystem="clang64") @pytest.mark.tool_msys2 @pytest.mark.tool_msys2_clang64 @@ -364,7 +375,7 @@ def test_msys2_clang64_external(self): assert "MYCMAKE VERSION=3.19" in client.out check_exe_run(client.out, "main", "clang", None, "Debug", "x86_64", None, subsystem="mingw64") - check_vs_runtime("app.exe", client, "15", "Release", subsystem="clang64") + check_vs_runtime("app.exe", client, "15", "Debug", subsystem="clang64") @pytest.mark.tool_msys2 @pytest.mark.tool_msys2_mingw64_clang64 @@ -377,7 +388,7 @@ def test_msys2_mingw64_clang64(self): self._build(client, generator="MinGW Makefiles") check_exe_run(client.out, "main", "clang", None, "Debug", "x86_64", None, subsystem="mingw64") - check_vs_runtime("app.exe", client, "15", "Release", subsystem="mingw64") + check_vs_runtime("app.exe", client, "15", "Debug", subsystem="mingw64") @pytest.mark.tool_msys2 @pytest.mark.tool_mingw32 @@ -388,7 +399,7 @@ def test_mingw32(self): client = TestClient() self._build(client, generator="MinGW Makefiles") check_exe_run(client.out, "main", "gcc", None, "Debug", "x86", None, subsystem="mingw32") - check_vs_runtime("app.exe", client, "15", "Release", subsystem="mingw32") + check_vs_runtime("app.exe", client, "15", "Debug", subsystem="mingw32") @pytest.mark.tool_cygwin def test_cygwin(self): @@ -399,4 +410,29 @@ def test_cygwin(self): # install "gcc-c++" and "make" packages self._build(client) check_exe_run(client.out, "main", "gcc", None, "Debug", "x86_64", None, subsystem="cygwin") - check_vs_runtime("app.exe", client, "15", "Release", subsystem="cygwin") + check_vs_runtime("app.exe", client, "15", "Debug", subsystem="cygwin") + + @pytest.mark.tool_clang + def test_clang(self): + """ + native, LLVM/Clang compiler + Installing the binary from LLVM site + https://github.com/llvm/llvm-project/releases/tag/llvmorg-14.0.6 + """ + client = TestClient() + self._build(client, generator="Ninja", compiler="clang") + check_exe_run(client.out, "main", "clang", None, "Debug", "x86_64", None, subsystem=None) + check_vs_runtime("app.exe", client, "15", "Debug", subsystem=None) + + @pytest.mark.tool_cmake(version="3.23") + @pytest.mark.tool_visual_studio(version="17") + def test_vs_clang(self): + """ + native, LLVM/Clang compiler installed with VS 2022 -T ClangCL + """ + # IMPORTANT: VS CLang not found if in another unit + folder = tempfile.mkdtemp(suffix='conans') + client = TestClient(current_folder=folder) + self._build(client, generator="Visual Studio 17 2022", toolset="ClangCL") + check_exe_run(client.out, "main", "clang", None, "Debug", "x86_64", None, subsystem=None) + check_vs_runtime("Debug/app.exe", client, "15", "Debug", subsystem=None) diff --git a/conans/test/functional/utils.py b/conans/test/functional/utils.py index d249098d7a3..b4d1217357b 100644 --- a/conans/test/functional/utils.py +++ b/conans/test/functional/utils.py @@ -156,3 +156,7 @@ def check_exe_run(output, names, compiler, version, build_type, arch, cppstd, de assert "__MSYS__" not in output else: raise Exception("unknown subsystem {}".format(subsystem)) + else: + assert "CYGWIN" not in output + assert "MINGW" not in output + assert "MSYS" not in output From 924b0815a2294a5536aeebaaa37c46589dee8c31 Mon Sep 17 00:00:00 2001 From: memsharded Date: Wed, 29 Jun 2022 00:58:10 +0200 Subject: [PATCH 07/11] fix tests --- conans/client/migrations_settings.py | 153 +++++++++++++++++- .../functional/toolchains/cmake/test_cmake.py | 2 +- .../functional/toolchains/cmake/test_ninja.py | 3 +- .../toolchains/gnu/autotools/test_basic.py | 22 +-- 4 files changed, 162 insertions(+), 18 deletions(-) diff --git a/conans/client/migrations_settings.py b/conans/client/migrations_settings.py index 25b2bd1bf09..7ac3a60de4d 100644 --- a/conans/client/migrations_settings.py +++ b/conans/client/migrations_settings.py @@ -3712,4 +3712,155 @@ cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23] # Deprecated, use compiler.cppstd """ -settings_1_50_0 = settings_1_49_0 +settings_1_50_0 = """ +# Only for cross building, 'os_build/arch_build' is the system that runs Conan +os_build: [Windows, WindowsStore, Linux, Macos, FreeBSD, SunOS, AIX, VxWorks] +arch_build: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, sh4le, e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7] + +# Only for building cross compilation tools, 'os_target/arch_target' is the system for +# which the tools generate code +os_target: [Windows, Linux, Macos, Android, iOS, watchOS, tvOS, FreeBSD, SunOS, AIX, Arduino, Neutrino] +arch_target: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, asm.js, wasm, sh4le, e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7, xtensalx6, xtensalx106, xtensalx7] + +# Rest of the settings are "host" settings: +# - For native building/cross building: Where the library/program will run. +# - For building cross compilation tools: Where the cross compiler will run. +os: + Windows: + subsystem: [None, cygwin, msys, msys2, msys2_ucrt64, msys2_ming32, msys2_ming64, msys2_clang64, wsl] + WindowsStore: + version: ["8.1", "10.0"] + WindowsCE: + platform: ANY + version: ["5.0", "6.0", "7.0", "8.0"] + Linux: + iOS: + version: &ios_version + ["7.0", "7.1", "8.0", "8.1", "8.2", "8.3", "9.0", "9.1", "9.2", "9.3", "10.0", "10.1", "10.2", "10.3", + "11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4", + "13.0", "13.1", "13.2", "13.3", "13.4", "13.5", "13.6", "13.7", + "14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7", "14.8", + "15.0", "15.1", "15.2", "15.3", "15.4"] + sdk: [None, "iphoneos", "iphonesimulator"] + sdk_version: [None, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4", + "13.0", "13.1", "13.2", "13.4", "13.5", "13.6", "13.7", + "14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "15.0", "15.2", "15.4"] + watchOS: + version: ["4.0", "4.1", "4.2", "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1", "6.2", + "7.0", "7.1", "7.2", "7.3", "7.4", "7.5", "7.6", "8.0", "8.1", "8.3", "8.4", "8.5"] + sdk: [None, "watchos", "watchsimulator"] + sdk_version: [None, "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1", "6.2", + "7.0", "7.1", "7.2", "7.4", "8.0", "8.0.1", "8.3", "8.5"] + tvOS: + version: ["11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4", + "13.0", "13.2", "13.3", "13.4", "14.0", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7", + "15.0", "15.1", "15.2", "15.3", "15.4"] + sdk: [None, "appletvos", "appletvsimulator"] + sdk_version: [None, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4", + "13.0", "13.1", "13.2", "13.4", "14.0", "14.2", "14.3", "14.5", "15.0", "15.2", "15.4"] + Macos: + version: [None, "10.6", "10.7", "10.8", "10.9", "10.10", "10.11", "10.12", "10.13", "10.14", "10.15", "11.0", "12.0", "13.0"] + sdk: [None, "macosx"] + sdk_version: [None, "10.13", "10.14", "10.15", "11.0", "11.1", "11.3", "12.0", "12.1", "12.3"] + subsystem: + None: + catalyst: + ios_version: *ios_version + Android: + api_level: ANY + FreeBSD: + SunOS: + AIX: + Arduino: + board: ANY + Emscripten: + Neutrino: + version: ["6.4", "6.5", "6.6", "7.0", "7.1"] + baremetal: + VxWorks: + version: ["7"] +arch: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv4, armv4i, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, asm.js, wasm, sh4le, e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7, xtensalx6, xtensalx106, xtensalx7] +compiler: + sun-cc: + version: ["5.10", "5.11", "5.12", "5.13", "5.14", "5.15"] + threads: [None, posix] + libcxx: [libCstd, libstdcxx, libstlport, libstdc++] + gcc: &gcc + version: ["4.1", "4.4", "4.5", "4.6", "4.7", "4.8", "4.9", + "5", "5.1", "5.2", "5.3", "5.4", "5.5", + "6", "6.1", "6.2", "6.3", "6.4", "6.5", + "7", "7.1", "7.2", "7.3", "7.4", "7.5", + "8", "8.1", "8.2", "8.3", "8.4", + "9", "9.1", "9.2", "9.3", "9.4", + "10", "10.1", "10.2", "10.3", + "11", "11.1", "11.2", + "12"] + libcxx: [libstdc++, libstdc++11] + threads: [None, posix, win32] # Windows MinGW + exception: [None, dwarf2, sjlj, seh] # Windows MinGW + cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23] + Visual Studio: &visual_studio + runtime: [MD, MT, MTd, MDd] + version: ["8", "9", "10", "11", "12", "14", "15", "16", "17"] + toolset: [None, v90, v100, v110, v110_xp, v120, v120_xp, + v140, v140_xp, v140_clang_c2, LLVM-vs2012, LLVM-vs2012_xp, + LLVM-vs2013, LLVM-vs2013_xp, LLVM-vs2014, LLVM-vs2014_xp, + LLVM-vs2017, LLVM-vs2017_xp, v141, v141_xp, v141_clang_c2, v142, + llvm, ClangCL, v143] + cppstd: [None, 14, 17, 20, 23] + msvc: + version: [170, 180, 190, 191, 192, 193] + update: [None, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + runtime: [static, dynamic] + runtime_type: [Debug, Release] + cppstd: [98, 14, 17, 20, 23] + toolset: [None, v110_xp, v120_xp, v140_xp, v141_xp] + clang: + version: ["3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "4.0", + "5.0", "6.0", "7.0", "7.1", + "8", "9", "10", "11", "12", "13", "14", "15"] + libcxx: [None, libstdc++, libstdc++11, libc++, c++_shared, c++_static] + cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23] + runtime: [None, MD, MT, MTd, MDd, static, dynamic] + runtime_type: [None, Debug, Release] + apple-clang: &apple_clang + version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3", "8.0", "8.1", "9.0", "9.1", "10.0", "11.0", "12.0", "13", "13.0", "13.1"] + libcxx: [libstdc++, libc++] + cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20] + intel: + version: ["11", "12", "13", "14", "15", "16", "17", "18", "19", "19.1"] + update: [None, ANY] + base: + gcc: + <<: *gcc + threads: [None] + exception: [None] + Visual Studio: + <<: *visual_studio + apple-clang: + <<: *apple_clang + intel-cc: + version: ["2021.1", "2021.2", "2021.3"] + update: [None, ANY] + mode: ["icx", "classic", "dpcpp"] + libcxx: [None, libstdc++, libstdc++11, libc++] + cppstd: [None, 98, gnu98, 03, gnu03, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23] + runtime: [None, static, dynamic] + runtime_type: [None, Debug, Release] + qcc: + version: ["4.4", "5.4", "8.3"] + libcxx: [cxx, gpp, cpp, cpp-ne, accp, acpp-ne, ecpp, ecpp-ne] + cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17] + mcst-lcc: + version: ["1.19", "1.20", "1.21", "1.22", "1.23", "1.24", "1.25"] + base: + gcc: + <<: *gcc + threads: [None] + exceptions: [None] + +build_type: [None, Debug, Release, RelWithDebInfo, MinSizeRel] + + +cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23] # Deprecated, use compiler.cppstd +""" diff --git a/conans/test/functional/toolchains/cmake/test_cmake.py b/conans/test/functional/toolchains/cmake/test_cmake.py index 0c38395fbc8..e84fc0981d1 100644 --- a/conans/test/functional/toolchains/cmake/test_cmake.py +++ b/conans/test/functional/toolchains/cmake/test_cmake.py @@ -350,7 +350,7 @@ def _verify_out(marker=">>"): "MYVAR_CONFIG": "MYVAR_{}".format(build_type.upper()), "MYDEFINE": "MYDEF_VALUE", "MYDEFINE_CONFIG": "MYDEF_{}".format(build_type.upper()) - }) + }, subsystem="mingw64") self._modify_code() time.sleep(2) diff --git a/conans/test/functional/toolchains/cmake/test_ninja.py b/conans/test/functional/toolchains/cmake/test_ninja.py index fbd7df03f59..0a15f7d9eab 100644 --- a/conans/test/functional/toolchains/cmake/test_ninja.py +++ b/conans/test/functional/toolchains/cmake/test_ninja.py @@ -171,7 +171,8 @@ def test_locally_build_gcc(build_type, shared, client): client.run_command("myapp.exe") # TODO: Need full gcc version check - check_exe_run(client.out, ["main", "hello"], "gcc", None, build_type, "x86_64", cppstd=None) + check_exe_run(client.out, ["main", "hello"], "gcc", None, build_type, "x86_64", cppstd=None, + subsystem="mingw64") @pytest.mark.skipif(platform.system() != "Darwin", reason="Requires apple-clang") diff --git a/conans/test/functional/toolchains/gnu/autotools/test_basic.py b/conans/test/functional/toolchains/gnu/autotools/test_basic.py index b254b9edf12..eb44c2dffda 100644 --- a/conans/test/functional/toolchains/gnu/autotools/test_basic.py +++ b/conans/test/functional/toolchains/gnu/autotools/test_basic.py @@ -58,7 +58,7 @@ def build(self): assert "hello/0.1: Hello World Release!" in client.out -def build_windows_subsystem(profile, make_program): +def build_windows_subsystem(profile, make_program, subsystem): """ The AutotoolsDeps can be used also in pure Makefiles, if the makefiles follow the Autotools conventions """ @@ -100,7 +100,7 @@ def build(self): client.run_command(cmd) client.run_command("app") # TODO: fill compiler version when ready - check_exe_run(client.out, "main", "gcc", None, "Release", "x86_64", None) + check_exe_run(client.out, "main", "gcc", None, "Release", "x86_64", None, subsystem=subsystem) assert "hello/0.1: Hello World Release!" in client.out client.save({"app.cpp": gen_function_cpp(name="main", msg="main2", @@ -112,7 +112,8 @@ def build(self): client.run("build .") client.run_command("app") # TODO: fill compiler version when ready - check_exe_run(client.out, "main2", "gcc", None, "Release", "x86_64", None, cxx11_abi=0) + check_exe_run(client.out, "main2", "gcc", None, "Release", "x86_64", None, cxx11_abi=0, + subsystem=subsystem) assert "hello/0.1: Hello World Release!" in client.out return client.out @@ -130,10 +131,7 @@ def test_autotoolsdeps_cygwin(): arch=x86_64 build_type=Release """) - out = build_windows_subsystem(gcc, make_program="make") - assert "__MSYS__" not in out - assert "MINGW" not in out - assert "main2 __CYGWIN__1" in out + build_windows_subsystem(gcc, make_program="make", subsystem="cygwin") @pytest.mark.tool_mingw64 @@ -148,9 +146,7 @@ def test_autotoolsdeps_mingw_msys(): arch=x86_64 build_type=Release """) - out = build_windows_subsystem(gcc, make_program="mingw32-make") - assert "__MSYS__" not in out - assert "main2 __MINGW64__1" in out + build_windows_subsystem(gcc, make_program="mingw32-make", subsystem="mingw64") @pytest.mark.tool_msys2 @@ -166,11 +162,7 @@ def test_autotoolsdeps_msys(): arch=x86_64 build_type=Release """) - out = build_windows_subsystem(gcc, make_program="make") - # Msys2 is a rewrite of Msys, using Cygwin - assert "MINGW" not in out - assert "main2 __MSYS__1" in out - assert "main2 __CYGWIN__1" in out + build_windows_subsystem(gcc, make_program="make", subsystem="msys2") @pytest.mark.skipif(platform.system() not in ["Linux", "Darwin"], reason="Requires Autotools") From 0bd80b30d6281db1af37ab776271c512c3080dce Mon Sep 17 00:00:00 2001 From: memsharded Date: Wed, 29 Jun 2022 01:20:55 +0200 Subject: [PATCH 08/11] fix tests --- conans/test/functional/toolchains/gnu/autotools/test_basic.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conans/test/functional/toolchains/gnu/autotools/test_basic.py b/conans/test/functional/toolchains/gnu/autotools/test_basic.py index eb44c2dffda..b7c507c21fe 100644 --- a/conans/test/functional/toolchains/gnu/autotools/test_basic.py +++ b/conans/test/functional/toolchains/gnu/autotools/test_basic.py @@ -151,6 +151,8 @@ def test_autotoolsdeps_mingw_msys(): @pytest.mark.tool_msys2 @pytest.mark.skipif(platform.system() != "Windows", reason="Needs windows") +# If we use the cmake inside msys2, it fails, so better force our own cmake +@pytest.mark.tool_cmake def test_autotoolsdeps_msys(): gcc = textwrap.dedent(""" [settings] From d91dce56508870d69b7211f95224f5c68dfafd25 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 29 Jun 2022 09:48:48 +0200 Subject: [PATCH 09/11] Update conans/client/conf/__init__.py Co-authored-by: Carlos Zoido --- conans/client/conf/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conans/client/conf/__init__.py b/conans/client/conf/__init__.py index 38cf0667759..ed95c0e2272 100644 --- a/conans/client/conf/__init__.py +++ b/conans/client/conf/__init__.py @@ -27,7 +27,7 @@ # - For building cross compilation tools: Where the cross compiler will run. os: Windows: - subsystem: [None, cygwin, msys, msys2, msys2_ucrt64, msys2_ming32, msys2_ming64, msys2_clang64, wsl] + subsystem: [None, cygwin, msys, msys2, msys2_ucrt64, msys2_mingw32, msys2_mingw64, msys2_clang64, wsl] WindowsStore: version: ["8.1", "10.0"] WindowsCE: From 817e589a2ab992205d5b77cffd1228d7d1b7e30e Mon Sep 17 00:00:00 2001 From: James Date: Wed, 29 Jun 2022 09:48:56 +0200 Subject: [PATCH 10/11] Update conans/client/migrations_settings.py Co-authored-by: Carlos Zoido --- conans/client/migrations_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conans/client/migrations_settings.py b/conans/client/migrations_settings.py index 7ac3a60de4d..da791cdc095 100644 --- a/conans/client/migrations_settings.py +++ b/conans/client/migrations_settings.py @@ -3727,7 +3727,7 @@ # - For building cross compilation tools: Where the cross compiler will run. os: Windows: - subsystem: [None, cygwin, msys, msys2, msys2_ucrt64, msys2_ming32, msys2_ming64, msys2_clang64, wsl] + subsystem: [None, cygwin, msys, msys2, msys2_ucrt64, msys2_mingw32, msys2_mingw64, msys2_clang64, wsl] WindowsStore: version: ["8.1", "10.0"] WindowsCE: From 24308bda8db7a1bb46137d3ac9d4d877f5b3f0cb Mon Sep 17 00:00:00 2001 From: memsharded Date: Wed, 29 Jun 2022 10:22:21 +0200 Subject: [PATCH 11/11] remove settings --- conans/client/conf/__init__.py | 2 +- conans/client/migrations_settings.py | 153 +-------------------------- 2 files changed, 2 insertions(+), 153 deletions(-) diff --git a/conans/client/conf/__init__.py b/conans/client/conf/__init__.py index ed95c0e2272..4e12123078e 100644 --- a/conans/client/conf/__init__.py +++ b/conans/client/conf/__init__.py @@ -27,7 +27,7 @@ # - For building cross compilation tools: Where the cross compiler will run. os: Windows: - subsystem: [None, cygwin, msys, msys2, msys2_ucrt64, msys2_mingw32, msys2_mingw64, msys2_clang64, wsl] + subsystem: [None, cygwin, msys, msys2, wsl] WindowsStore: version: ["8.1", "10.0"] WindowsCE: diff --git a/conans/client/migrations_settings.py b/conans/client/migrations_settings.py index da791cdc095..25b2bd1bf09 100644 --- a/conans/client/migrations_settings.py +++ b/conans/client/migrations_settings.py @@ -3712,155 +3712,4 @@ cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23] # Deprecated, use compiler.cppstd """ -settings_1_50_0 = """ -# Only for cross building, 'os_build/arch_build' is the system that runs Conan -os_build: [Windows, WindowsStore, Linux, Macos, FreeBSD, SunOS, AIX, VxWorks] -arch_build: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, sh4le, e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7] - -# Only for building cross compilation tools, 'os_target/arch_target' is the system for -# which the tools generate code -os_target: [Windows, Linux, Macos, Android, iOS, watchOS, tvOS, FreeBSD, SunOS, AIX, Arduino, Neutrino] -arch_target: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, asm.js, wasm, sh4le, e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7, xtensalx6, xtensalx106, xtensalx7] - -# Rest of the settings are "host" settings: -# - For native building/cross building: Where the library/program will run. -# - For building cross compilation tools: Where the cross compiler will run. -os: - Windows: - subsystem: [None, cygwin, msys, msys2, msys2_ucrt64, msys2_mingw32, msys2_mingw64, msys2_clang64, wsl] - WindowsStore: - version: ["8.1", "10.0"] - WindowsCE: - platform: ANY - version: ["5.0", "6.0", "7.0", "8.0"] - Linux: - iOS: - version: &ios_version - ["7.0", "7.1", "8.0", "8.1", "8.2", "8.3", "9.0", "9.1", "9.2", "9.3", "10.0", "10.1", "10.2", "10.3", - "11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4", - "13.0", "13.1", "13.2", "13.3", "13.4", "13.5", "13.6", "13.7", - "14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7", "14.8", - "15.0", "15.1", "15.2", "15.3", "15.4"] - sdk: [None, "iphoneos", "iphonesimulator"] - sdk_version: [None, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4", - "13.0", "13.1", "13.2", "13.4", "13.5", "13.6", "13.7", - "14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "15.0", "15.2", "15.4"] - watchOS: - version: ["4.0", "4.1", "4.2", "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1", "6.2", - "7.0", "7.1", "7.2", "7.3", "7.4", "7.5", "7.6", "8.0", "8.1", "8.3", "8.4", "8.5"] - sdk: [None, "watchos", "watchsimulator"] - sdk_version: [None, "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1", "6.2", - "7.0", "7.1", "7.2", "7.4", "8.0", "8.0.1", "8.3", "8.5"] - tvOS: - version: ["11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4", - "13.0", "13.2", "13.3", "13.4", "14.0", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7", - "15.0", "15.1", "15.2", "15.3", "15.4"] - sdk: [None, "appletvos", "appletvsimulator"] - sdk_version: [None, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4", - "13.0", "13.1", "13.2", "13.4", "14.0", "14.2", "14.3", "14.5", "15.0", "15.2", "15.4"] - Macos: - version: [None, "10.6", "10.7", "10.8", "10.9", "10.10", "10.11", "10.12", "10.13", "10.14", "10.15", "11.0", "12.0", "13.0"] - sdk: [None, "macosx"] - sdk_version: [None, "10.13", "10.14", "10.15", "11.0", "11.1", "11.3", "12.0", "12.1", "12.3"] - subsystem: - None: - catalyst: - ios_version: *ios_version - Android: - api_level: ANY - FreeBSD: - SunOS: - AIX: - Arduino: - board: ANY - Emscripten: - Neutrino: - version: ["6.4", "6.5", "6.6", "7.0", "7.1"] - baremetal: - VxWorks: - version: ["7"] -arch: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv4, armv4i, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, asm.js, wasm, sh4le, e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7, xtensalx6, xtensalx106, xtensalx7] -compiler: - sun-cc: - version: ["5.10", "5.11", "5.12", "5.13", "5.14", "5.15"] - threads: [None, posix] - libcxx: [libCstd, libstdcxx, libstlport, libstdc++] - gcc: &gcc - version: ["4.1", "4.4", "4.5", "4.6", "4.7", "4.8", "4.9", - "5", "5.1", "5.2", "5.3", "5.4", "5.5", - "6", "6.1", "6.2", "6.3", "6.4", "6.5", - "7", "7.1", "7.2", "7.3", "7.4", "7.5", - "8", "8.1", "8.2", "8.3", "8.4", - "9", "9.1", "9.2", "9.3", "9.4", - "10", "10.1", "10.2", "10.3", - "11", "11.1", "11.2", - "12"] - libcxx: [libstdc++, libstdc++11] - threads: [None, posix, win32] # Windows MinGW - exception: [None, dwarf2, sjlj, seh] # Windows MinGW - cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23] - Visual Studio: &visual_studio - runtime: [MD, MT, MTd, MDd] - version: ["8", "9", "10", "11", "12", "14", "15", "16", "17"] - toolset: [None, v90, v100, v110, v110_xp, v120, v120_xp, - v140, v140_xp, v140_clang_c2, LLVM-vs2012, LLVM-vs2012_xp, - LLVM-vs2013, LLVM-vs2013_xp, LLVM-vs2014, LLVM-vs2014_xp, - LLVM-vs2017, LLVM-vs2017_xp, v141, v141_xp, v141_clang_c2, v142, - llvm, ClangCL, v143] - cppstd: [None, 14, 17, 20, 23] - msvc: - version: [170, 180, 190, 191, 192, 193] - update: [None, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - runtime: [static, dynamic] - runtime_type: [Debug, Release] - cppstd: [98, 14, 17, 20, 23] - toolset: [None, v110_xp, v120_xp, v140_xp, v141_xp] - clang: - version: ["3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "4.0", - "5.0", "6.0", "7.0", "7.1", - "8", "9", "10", "11", "12", "13", "14", "15"] - libcxx: [None, libstdc++, libstdc++11, libc++, c++_shared, c++_static] - cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23] - runtime: [None, MD, MT, MTd, MDd, static, dynamic] - runtime_type: [None, Debug, Release] - apple-clang: &apple_clang - version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3", "8.0", "8.1", "9.0", "9.1", "10.0", "11.0", "12.0", "13", "13.0", "13.1"] - libcxx: [libstdc++, libc++] - cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20] - intel: - version: ["11", "12", "13", "14", "15", "16", "17", "18", "19", "19.1"] - update: [None, ANY] - base: - gcc: - <<: *gcc - threads: [None] - exception: [None] - Visual Studio: - <<: *visual_studio - apple-clang: - <<: *apple_clang - intel-cc: - version: ["2021.1", "2021.2", "2021.3"] - update: [None, ANY] - mode: ["icx", "classic", "dpcpp"] - libcxx: [None, libstdc++, libstdc++11, libc++] - cppstd: [None, 98, gnu98, 03, gnu03, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23] - runtime: [None, static, dynamic] - runtime_type: [None, Debug, Release] - qcc: - version: ["4.4", "5.4", "8.3"] - libcxx: [cxx, gpp, cpp, cpp-ne, accp, acpp-ne, ecpp, ecpp-ne] - cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17] - mcst-lcc: - version: ["1.19", "1.20", "1.21", "1.22", "1.23", "1.24", "1.25"] - base: - gcc: - <<: *gcc - threads: [None] - exceptions: [None] - -build_type: [None, Debug, Release, RelWithDebInfo, MinSizeRel] - - -cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23] # Deprecated, use compiler.cppstd -""" +settings_1_50_0 = settings_1_49_0