Skip to content

Commit 74c039a

Browse files
authored
CDRIVER-3253 reintroduce VS 2015 task coverage (#1991)
1 parent fee885a commit 74c039a

File tree

4 files changed

+75
-59
lines changed

4 files changed

+75
-59
lines changed

.evergreen/config_generator/components/c_std_compile.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@
3939
('rhel94', 'gcc', None, [99, 11, 17, 23]), # GCC 11.4 (max: C2x)
4040
('rhel95', 'gcc', None, [99, 11, 17, 23]), # GCC 11.5 (max: C2x)
4141

42-
('windows-vsCurrent', 'vs2017x64', None, [99, 11, 17, 'latest']), # Max: C17, clatest (C2x)
43-
('windows-vsCurrent', 'vs2019x64', None, [99, 11, 17, 'latest']), # Max: C17, clatest (C2x)
44-
('windows-vsCurrent', 'vs2022x64', None, [99, 11, 17, 'latest']), # Max: C17, clatest (C2x)
42+
('windows-vsCurrent', 'vs2015x64', None, [99, 11, ]), # Max: C11
43+
('windows-vsCurrent', 'vs2017x64', None, [99, 11, ]), # Max: C11
44+
('windows-vsCurrent', 'vs2019x64', None, [99, 11, 17]), # Max: C17
45+
('windows-vsCurrent', 'vs2022x64', None, [99, 11, 17]), # Max: C17
4546
]
4647
# fmt: on
4748
# pylint: enable=line-too-long

.evergreen/config_generator/etc/distros.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ class Distro(BaseModel):
2828
'2019',
2929
'2022',
3030
'vsCurrent',
31-
'vsCurrent2',
32-
'vsMulti',
3331
] | None = None
3432
size: Literal['small', 'large'] | None = None
3533
arch: Literal['arm64', 'power', 'zseries'] | None = None
@@ -165,20 +163,7 @@ def make_distro_str(distro_name, compiler, arch) -> str:
165163
distro_str = 'windows-' + \
166164
distro_name[len('windows-vsCurrent-'):] + f'-{compiler_str}'
167165
else:
168-
distro_str = 'windows-2019' + f'-{compiler_str}'
169-
elif distro_name.startswith('windows-64-vs'):
170-
# Abbreviate 'windows-64-vs<type>' as 'vs<type>' and append '-<arch>' if
171-
# given in compiler string as 'vs<type><arch>', e.g.:
172-
# ('windows-64-vs2017', 'vs2017x64', None) -> vs2017-x64
173-
# ('windows-64-vs2017', 'mingw', None) -> vs2017-mingw
174-
distro_str = distro_name[len('windows-64-'):] + {
175-
'vs2017x64': '-x64',
176-
'vs2017x86': '-x86',
177-
'vs2019x64': '-x64',
178-
'vs2019x86': '-x86',
179-
'vs2022x64': '-x64',
180-
'vs2022x86': '-x86',
181-
}.get(compiler, f'-{compiler}')
166+
distro_str = 'windows-2019-' + compiler_str
182167
else:
183168
distro_str = distro_name
184169
if compiler:
@@ -192,6 +177,8 @@ def make_distro_str(distro_name, compiler, arch) -> str:
192177

193178
def to_cc(compiler):
194179
return {
180+
'vs2015x64': 'Visual Studio 14 2015',
181+
'vs2015x86': 'Visual Studio 14 2015',
195182
'vs2017x64': 'Visual Studio 15 2017',
196183
'vs2017x86': 'Visual Studio 15 2017',
197184
'vs2019x64': 'Visual Studio 16 2019',
@@ -203,6 +190,8 @@ def to_cc(compiler):
203190

204191
def to_platform(compiler):
205192
return {
193+
'vs2015x64': 'x64',
194+
'vs2015x86': 'Win32',
206195
'vs2017x64': 'x64',
207196
'vs2017x86': 'Win32',
208197
'vs2019x64': 'x64',

.evergreen/generated_configs/tasks.yml

Lines changed: 20 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5132,6 +5132,16 @@ tasks:
51325132
CC: clang-12
51335133
CXX: clang++-12
51345134
C_STD_VERSION: 11
5135+
- name: std-c11-windows-2019-vs2015-x64-compile
5136+
run_on: windows-vsCurrent-large
5137+
tags: [std-matrix, windows-vsCurrent, vs2015x64, compile, std-c11]
5138+
commands:
5139+
- func: find-cmake-latest
5140+
- func: std-compile
5141+
vars:
5142+
CMAKE_GENERATOR: Visual Studio 14 2015
5143+
CMAKE_GENERATOR_PLATFORM: x64
5144+
C_STD_VERSION: 11
51355145
- name: std-c11-windows-2019-vs2017-x64-compile
51365146
run_on: windows-vsCurrent-large
51375147
tags: [std-matrix, windows-vsCurrent, vs2017x64, compile, std-c11]
@@ -5352,16 +5362,6 @@ tasks:
53525362
CC: clang-12
53535363
CXX: clang++-12
53545364
C_STD_VERSION: 17
5355-
- name: std-c17-windows-2019-vs2017-x64-compile
5356-
run_on: windows-vsCurrent-large
5357-
tags: [std-matrix, windows-vsCurrent, vs2017x64, compile, std-c17]
5358-
commands:
5359-
- func: find-cmake-latest
5360-
- func: std-compile
5361-
vars:
5362-
CMAKE_GENERATOR: Visual Studio 15 2017
5363-
CMAKE_GENERATOR_PLATFORM: x64
5364-
C_STD_VERSION: 17
53655365
- name: std-c17-windows-2019-vs2019-x64-compile
53665366
run_on: windows-vsCurrent-large
53675367
tags: [std-matrix, windows-vsCurrent, vs2019x64, compile, std-c17]
@@ -5732,6 +5732,16 @@ tasks:
57325732
CC: clang-12
57335733
CXX: clang++-12
57345734
C_STD_VERSION: 99
5735+
- name: std-c99-windows-2019-vs2015-x64-compile
5736+
run_on: windows-vsCurrent-large
5737+
tags: [std-matrix, windows-vsCurrent, vs2015x64, compile, std-c99]
5738+
commands:
5739+
- func: find-cmake-latest
5740+
- func: std-compile
5741+
vars:
5742+
CMAKE_GENERATOR: Visual Studio 14 2015
5743+
CMAKE_GENERATOR_PLATFORM: x64
5744+
C_STD_VERSION: 99
57355745
- name: std-c99-windows-2019-vs2017-x64-compile
57365746
run_on: windows-vsCurrent-large
57375747
tags: [std-matrix, windows-vsCurrent, vs2017x64, compile, std-c99]
@@ -5762,36 +5772,6 @@ tasks:
57625772
CMAKE_GENERATOR: Visual Studio 17 2022
57635773
CMAKE_GENERATOR_PLATFORM: x64
57645774
C_STD_VERSION: 99
5765-
- name: std-clatest-windows-2019-vs2017-x64-compile
5766-
run_on: windows-vsCurrent-large
5767-
tags: [std-matrix, windows-vsCurrent, vs2017x64, compile, std-clatest]
5768-
commands:
5769-
- func: find-cmake-latest
5770-
- func: std-compile
5771-
vars:
5772-
CMAKE_GENERATOR: Visual Studio 15 2017
5773-
CMAKE_GENERATOR_PLATFORM: x64
5774-
C_STD_VERSION: latest
5775-
- name: std-clatest-windows-2019-vs2019-x64-compile
5776-
run_on: windows-vsCurrent-large
5777-
tags: [std-matrix, windows-vsCurrent, vs2019x64, compile, std-clatest]
5778-
commands:
5779-
- func: find-cmake-latest
5780-
- func: std-compile
5781-
vars:
5782-
CMAKE_GENERATOR: Visual Studio 16 2019
5783-
CMAKE_GENERATOR_PLATFORM: x64
5784-
C_STD_VERSION: latest
5785-
- name: std-clatest-windows-2019-vs2022-x64-compile
5786-
run_on: windows-vsCurrent-large
5787-
tags: [std-matrix, windows-vsCurrent, vs2022x64, compile, std-clatest]
5788-
commands:
5789-
- func: find-cmake-latest
5790-
- func: std-compile
5791-
vars:
5792-
CMAKE_GENERATOR: Visual Studio 17 2022
5793-
CMAKE_GENERATOR_PLATFORM: x64
5794-
C_STD_VERSION: latest
57955775
- name: tsan-sasl-cyrus-openssl-debian10-clang-compile
57965776
run_on: debian10-large
57975777
tags: [sanitizers-matrix-tsan, compile, debian10, clang, tsan, sasl-cyrus]

.evergreen/scripts/compile-std.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,52 @@ if [[ "${CMAKE_GENERATOR:-}" =~ "Visual Studio" ]]; then
116116
export EnforceProcessCountAcrossBuilds=1
117117
fi
118118

119+
echo "Checking requested C standard is supported..."
120+
pushd "$(mktemp -d)"
121+
cat >CMakeLists.txt <<DOC
122+
cmake_minimum_required(VERSION 3.30)
123+
project(c_standard_latest LANGUAGES C)
124+
set(c_std_version "${C_STD_VERSION:?}")
125+
if(c_std_version STREQUAL "latest") # Special-case MSVC's /std:clatest flag.
126+
include(CheckCCompilerFlag)
127+
check_c_compiler_flag("/std:clatest" cflag_std_clatest)
128+
if(cflag_std_clatest)
129+
message(STATUS "/std:clatest is supported")
130+
else()
131+
message(FATAL_ERROR "/std:clatest is not supported")
132+
endif()
133+
else()
134+
# Ensure "old" standard versions are not compared as "newer" than C11/C17/etc.
135+
set(old_std_versions 90 99)
136+
137+
macro(success)
138+
message(STATUS "Latest C standard \${CMAKE_C_STANDARD_LATEST} is newer than \${c_std_version}")
139+
endmacro()
140+
macro(failure)
141+
message(FATAL_ERROR "Latest C standard \${CMAKE_C_STANDARD_LATEST} is older than \${c_std_version}")
142+
endmacro()
143+
144+
if (CMAKE_C_STANDARD_LATEST IN_LIST old_std_versions AND c_std_standard IN_LIST old_std_versions)
145+
if (CMAKE_C_STANDARD_LATEST GREATER_EQUAL c_std_version)
146+
success() # Both are old: latest >= version
147+
else()
148+
failure() # Both are old: latest < version
149+
endif()
150+
elseif(CMAKE_C_STANDARD_LATEST IN_LIST old_std_versions)
151+
failure() # latest (old) < version (new)
152+
elseif(c_std_version IN_LIST old_std_versions)
153+
success() # latest (new) >= version (old)
154+
elseif(CMAKE_C_STANDARD_LATEST GREATER_EQUAL c_std_version)
155+
success() # Both are new: latest >= version.
156+
else()
157+
failure() # Both are new: latest < version.
158+
endif()
159+
endif()
160+
DOC
161+
"${cmake_binary:?}" -S . -B build
162+
popd # "$(tmpfile -d)"
163+
echo "Checking requested C standard is supported... done."
164+
119165
echo "Installing libmongocrypt..."
120166
# shellcheck source=.evergreen/scripts/compile-libmongocrypt.sh
121167
"${script_dir}/compile-libmongocrypt.sh" "${cmake_binary}" "${mongoc_dir}" "${install_dir}" &>output.txt || {

0 commit comments

Comments
 (0)