Skip to content

Commit

Permalink
Test forcing VS2017 for tests in develop branch (#13736)
Browse files Browse the repository at this point in the history
* force vs2017

* fix compiler version for some tests

* revert changes

* fix tests
  • Loading branch information
czoido authored Apr 21, 2023
1 parent 3090031 commit c1b3978
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
9 changes: 7 additions & 2 deletions conans/test/functional/editable/consume_header_only_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# coding=utf-8

import os
import platform
import textwrap
import unittest

Expand All @@ -9,6 +10,7 @@

from conans.model.editable_layout import DEFAULT_LAYOUT_FILE, LAYOUTS_FOLDER
from conans.test.utils.tools import TestClient
from conans.tools import replace_in_file
from conans.util.files import save
from conans.test.utils.test_files import temp_folder

Expand Down Expand Up @@ -145,7 +147,10 @@ def build(self):
"src/main.cpp": main_cpp})

# Build consumer project
client.run("create . pkg/0.0@user/testing")
# FIXME: this is a hack to force VS2017 for tests
settings = "-s compiler.version=15" if platform.system() == "Windows" else ""

client.run(f"create . pkg/0.0@user/testing {settings}")
self.assertIn(" MyLib/0.1@user/editable from user folder - Editable", client.out)
self.assertIn(" MyLib/0.1@user/editable:"
"5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Editable", client.out)
Expand All @@ -165,7 +170,7 @@ def build(self):

# Modify editable and build again
client_editable.update_hello_word(hello_word="EDITED")
client.run("create . pkg/0.0@user/testing")
client.run(f"create . pkg/0.0@user/testing {settings}")
self.assertIn("Hello EDITED!", client.out)
if use_repo_file: # Repo file will override folders from cache
self.assertIn("...using inrepo", client.out)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import itertools
import os
import platform
import unittest

import pytest
Expand Down Expand Up @@ -140,9 +141,12 @@ def build(self):
"src/CMakeLists.txt": cmakelists,
"src/main.cpp": main_cpp})

# FIXME: this is a hack to force VS2017 for tests
settings = "-s compiler.version=15" if platform.system() == "Windows" else ""

# Build consumer project
client.run("create . pkg/0.0@user/testing "
"-s build_type={} -o MyLib:shared={}".format(build_type, str(shared)))
"-s build_type={} -o MyLib:shared={} {}".format(build_type, str(shared), settings))
self.assertIn(" MyLib/0.1@user/editable from user folder - Editable", client.out)
self.assertIn("Hello {}!".format(build_type), client.out)
self.assertIn(" - options.shared: {}".format(shared), client.out)
6 changes: 6 additions & 0 deletions conans/test/utils/tools.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import os
import platform
import shlex
import shutil
import socket
Expand Down Expand Up @@ -333,6 +334,11 @@ def _copy_cache_folder(target_folder):
cache.initialize_config()
cache.registry.initialize_remotes()
cache.initialize_default_profile()
# FIXME: this is a hack to force VS2017 for tests
if platform.system() == "Windows":
replace_in_file(os.path.join(master_folder, "profiles", "default"),
"compiler.version=17", "compiler.version=15")

cache.initialize_settings()
shutil.copytree(master_folder, target_folder)

Expand Down

0 comments on commit c1b3978

Please sign in to comment.