Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 31 additions & 12 deletions .evergreen/config_generator/components/c_std_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from config_generator.etc.distros import find_large_distro
from config_generator.etc.distros import make_distro_str
from config_generator.etc.distros import to_cc
from config_generator.etc.distros import compiler_to_vars
from config_generator.etc.function import Function
from config_generator.etc.utils import bash_exec

Expand All @@ -17,14 +17,31 @@
# pylint: disable=line-too-long
# fmt: off
MATRIX = [
('debian92', 'clang', None, [11, ]),
('debian10', 'clang', None, [11, ]),
('debian10', 'gcc', None, [11, 17]),
('debian11', 'clang', None, [11, ]),
('debian11', 'gcc', None, [11, 17]),
('ubuntu2004', 'clang', None, [11, ]),
('ubuntu2004', 'gcc', None, [11, ]),
('windows-vsCurrent', 'vs2017x64', None, [11, 17]),
('rhel80', 'clang', None, [99, 11, 17, ]), # Clang 7.0
('ubuntu2004', 'clang-10', None, [99, 11, 17, 23]), # Clang 10.0 (max: C2x)
('rhel84', 'clang', None, [99, 11, 17, 23]), # Clang 11.0 (max: C2x)
('ubuntu2204', 'clang-12', None, [99, 11, 17, 23]), # Clang 12.0 (max: C2x)
('rhel90', 'clang', None, [99, 11, 17, 23]), # Clang 13.0 (max: C2x)
('rhel91', 'clang', None, [99, 11, 17, 23]), # Clang 14.0 (max: C2x)
('rhel92', 'clang', None, [99, 11, 17, 23]), # Clang 15.0 (max: C2x)
('rhel93', 'clang', None, [99, 11, 17, 23]), # Clang 16.0 (max: C2x)
('rhel94', 'clang', None, [99, 11, 17, 23]), # Clang 17.0 (max: C2x)
('rhel95', 'clang', None, [99, 11, 17, 23]), # Clang 18.0 (max: C23)

('rhel76', 'gcc', None, [99, 11, ]), # GCC 4.8 (max: C11)
('rhel80', 'gcc', None, [99, 11, 17, ]), # GCC 8.2 (max: C17)
('debian10', 'gcc-8', None, [99, 11, 17, ]), # GCC 8.3 (max: C17)
('rhel84', 'gcc', None, [99, 11, 17, ]), # GCC 8.4 (max: C17)
('ubuntu2004', 'gcc-9', None, [99, 11, 17, 23]), # GCC 9.4 (max: C2x)
('debian11', 'gcc-10', None, [99, 11, 17, 23]), # GCC 10.2 (max: C2x)
('rhel90', 'gcc', None, [99, 11, 17, 23]), # GCC 11.2 (max: C2x)
('rhel92', 'gcc', None, [99, 11, 17, 23]), # GCC 11.3 (max: C2x)
('rhel94', 'gcc', None, [99, 11, 17, 23]), # GCC 11.4 (max: C2x)
('rhel95', 'gcc', None, [99, 11, 17, 23]), # GCC 11.5 (max: C2x)

('windows-vsCurrent', 'vs2017x64', None, [99, 11, 17, 'latest']), # Max: C17, clatest (C2x)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change "latest" to "clatest"? The message in compile-std.sh refers to "clatest" (but checks for "latest"):

if [[ "${C_STD_VERSION}" == "latest" ]]; then
  [[ "${CMAKE_GENERATOR:-}" =~ "Visual Studio" ]] || {
    echo "C_STD_VERSION=clatest is only supported with Visual Studio generators" 1>&2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed up the /std:clatest flag with the C_STD_VERSION=latest variable. Fixed.

('windows-vsCurrent', 'vs2019x64', None, [99, 11, 17, 'latest']), # Max: C17, clatest (C2x)
('windows-vsCurrent', 'vs2022x64', None, [99, 11, 17, 'latest']), # Max: C17, clatest (C2x)
]
# fmt: on
# pylint: enable=line-too-long
Expand Down Expand Up @@ -54,18 +71,20 @@ def tasks():
res = []

for distro_name, compiler, arch, stds in MATRIX:
tags = [TAG, distro_name, compiler, 'compile']
compiler_type = compiler.split('-')[0]

tags = [TAG, distro_name, compiler_type, 'compile']

distro = find_large_distro(distro_name)

compile_vars = None
compile_vars = {'CC': to_cc(compiler)}
compile_vars = compiler_to_vars(compiler)

if arch:
tags.append(arch)
compile_vars.update({'MARCH': arch})

distro_str = make_distro_str(distro_name, compiler, arch)
distro_str = make_distro_str(distro_name, compiler_type, arch)

for std in stds:
with_std = {'C_STD_VERSION': std}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from config_generator.etc.distros import find_large_distro
from config_generator.etc.distros import make_distro_str
from config_generator.etc.distros import to_cc
from config_generator.etc.distros import compiler_to_vars
from config_generator.etc.function import Function
from config_generator.etc.utils import bash_exec

Expand Down Expand Up @@ -55,7 +55,7 @@ def tasks():
distro = find_large_distro(distro_name)

compile_vars = None
compile_vars = {'CC': to_cc(compiler)}
compile_vars = compiler_to_vars(compiler)

if arch:
tags.append(arch)
Expand All @@ -72,7 +72,7 @@ def tasks():
tags=tags,
commands=[
FindCMakeLatest.call(),
StaticOpenSSLCompile.call(vars=compile_vars),
StaticOpenSSLCompile.call(vars=compile_vars if compile_vars else None),
],
)
)
Expand Down
6 changes: 3 additions & 3 deletions .evergreen/config_generator/components/scan_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from config_generator.etc.distros import find_large_distro
from config_generator.etc.distros import make_distro_str
from config_generator.etc.distros import to_cc
from config_generator.etc.distros import compiler_to_vars
from config_generator.etc.function import Function
from config_generator.etc.utils import bash_exec

Expand Down Expand Up @@ -56,7 +56,7 @@ def tasks():
distro = find_large_distro(distro_name)

compile_vars = None
compile_vars = {'CC': to_cc(compiler)}
compile_vars = compiler_to_vars(compiler)

if arch:
tags.append(arch)
Expand All @@ -73,7 +73,7 @@ def tasks():
tags=tags,
commands=[
FindCMakeLatest.call(),
ScanBuild.call(vars=compile_vars),
ScanBuild.call(vars=compile_vars if compile_vars else None),
FunctionCall(func='upload scan artifacts'),
],
)
Expand Down
6 changes: 3 additions & 3 deletions .evergreen/config_generator/etc/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from config_generator.etc.distros import find_large_distro
from config_generator.etc.distros import make_distro_str
from config_generator.etc.distros import to_cc
from config_generator.etc.distros import compiler_to_vars

from config_generator.components.funcs.find_cmake_latest import FindCMakeLatest
from config_generator.components.funcs.upload_build import UploadBuild
Expand All @@ -20,7 +20,7 @@ def generate_compile_tasks(SSL, TAG, SASL_TO_FUNC, MATRIX, MORE_TAGS=None, MORE_
distro = find_large_distro(distro_name)

compile_vars = None
compile_vars = {'CC': to_cc(compiler)}
compile_vars = compiler_to_vars(compiler)

if arch:
tags.append(arch)
Expand All @@ -38,7 +38,7 @@ def generate_compile_tasks(SSL, TAG, SASL_TO_FUNC, MATRIX, MORE_TAGS=None, MORE_

commands = []
commands.append(FindCMakeLatest.call())
commands.append(SASL_TO_FUNC[sasl].call(vars=compile_vars))
commands.append(SASL_TO_FUNC[sasl].call(vars=compile_vars if compile_vars else None))
commands.append(UploadBuild.call())

res.append(
Expand Down
4 changes: 2 additions & 2 deletions .evergreen/config_generator/etc/cse/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from config_generator.etc.distros import find_small_distro
from config_generator.etc.distros import make_distro_str
from config_generator.etc.distros import to_cc
from config_generator.etc.distros import compiler_to_vars

from config_generator.components.funcs.bootstrap_mongo_orchestration import BootstrapMongoOrchestration
from config_generator.components.funcs.fetch_build import FetchBuild
Expand All @@ -29,7 +29,7 @@ def generate_test_tasks(SSL, TAG, MATRIX):
test_distro = find_small_distro(distro_name)

compile_vars = []
compile_vars.append(KeyValueParam(key='CC', value=to_cc(compiler)))
compile_vars = [KeyValueParam(key=key, value=value) for key, value in compiler_to_vars(compiler).items()]

if arch:
tags.append(arch)
Expand Down
174 changes: 96 additions & 78 deletions .evergreen/config_generator/etc/distros.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ class Distro(BaseModel):
def validate_os_ver(cls, value):
return Version(value)

# See: https://evergreen.mongodb.com/distros
# pylint: disable=line-too-long
#fmt: off

def ls_distro(name, **kwargs):
return [
Distro(name=f'{name}-large', size='large', **kwargs),
Distro(name=f'{name}-small', size='small', **kwargs),
]


DEBIAN_DISTROS = [
Distro(name='debian92-large', os='debian', os_type='linux', os_ver='9.2', size='large'), # CDRIVER-5873
Distro(name='debian92-small', os='debian', os_type='linux', os_ver='9.2', size='small'), # CDRIVER-5873
Distro(name='debian10-large', os='debian', os_type='linux', os_ver='10', size='large'), # CDRIVER-5874
Distro(name='debian10-small', os='debian', os_type='linux', os_ver='10', size='small'), # CDRIVER-5874
Distro(name='debian11-large', os='debian', os_type='linux', os_ver='11', size='large'),
Distro(name='debian11-small', os='debian', os_type='linux', os_ver='11', size='small'),
Distro(name='debian92-large', os='debian', os_type='linux', os_ver='9.2', size='large'),
Distro(name='debian92-small', os='debian', os_type='linux', os_ver='9.2', size='small'),
*ls_distro(name='debian92', os='debian', os_type='linux', os_ver='9.2'), # CDRIVER-5873
*ls_distro(name='debian10', os='debian', os_type='linux', os_ver='10'), # CDRIVER-5874
*ls_distro(name='debian11', os='debian', os_type='linux', os_ver='11'),
]

MACOS_DISTROS = [
Expand All @@ -63,89 +63,57 @@ def validate_os_ver(cls, value):
]

RHEL_DISTROS = [
Distro(name='rhel80-large', os='rhel', os_type='linux', os_ver='8.0', size='large'),
Distro(name='rhel80-small', os='rhel', os_type='linux', os_ver='8.0', size='small'),
Distro(name='rhel84-large', os='rhel', os_type='linux', os_ver='8.4', size='large'),
Distro(name='rhel84-small', os='rhel', os_type='linux', os_ver='8.4', size='small'),
Distro(name='rhel8.9-large', os='rhel', os_type='linux', os_ver='8.7', size='large'),
Distro(name='rhel8.9-small', os='rhel', os_type='linux', os_ver='8.7', size='small'),
Distro(name='rhel92-large', os='rhel', os_type='linux', os_ver='9.0', size='large'),
Distro(name='rhel92-small', os='rhel', os_type='linux', os_ver='9.0', size='small'),
]

RHEL_ARM64_DISTROS = [
Distro(name='rhel82-arm64-large', os='rhel', os_type='linux', os_ver='8.2', size='large', arch='arm64'),
Distro(name='rhel82-arm64-small', os='rhel', os_type='linux', os_ver='8.2', size='small', arch='arm64'),
Distro(name='rhel92-arm64-large', os='rhel', os_type='linux', os_ver='9.0', size='large', arch='arm64'),
Distro(name='rhel92-arm64-small', os='rhel', os_type='linux', os_ver='9.0', size='small', arch='arm64'),
*ls_distro(name='rhel76', os='rhel', os_type='linux', os_ver='7.6'),
*ls_distro(name='rhel80', os='rhel', os_type='linux', os_ver='8.0'),
*ls_distro(name='rhel84', os='rhel', os_type='linux', os_ver='8.4'),
*ls_distro(name='rhel90', os='rhel', os_type='linux', os_ver='9.0'),
*ls_distro(name='rhel91', os='rhel', os_type='linux', os_ver='9.1'),
*ls_distro(name='rhel92', os='rhel', os_type='linux', os_ver='9.2'),
*ls_distro(name='rhel93', os='rhel', os_type='linux', os_ver='9.3'),
*ls_distro(name='rhel94', os='rhel', os_type='linux', os_ver='9.4'),
*ls_distro(name='rhel95', os='rhel', os_type='linux', os_ver='9.5'),
*ls_distro(name='rhel8.9', os='rhel', os_type='linux', os_ver='8.7'),
*ls_distro(name='rhel92', os='rhel', os_type='linux', os_ver='9.0'),
]

RHEL_POWER_DISTROS = [
Distro(name='rhel8-power-large', os='rhel', os_type='linux', os_ver='8', size='large', arch='power'),
Distro(name='rhel8-power-small', os='rhel', os_type='linux', os_ver='8', size='small', arch='power'),
Distro(name='rhel9-power-large', os='rhel', os_type='linux', os_ver='9', size='large', arch='power'),
Distro(name='rhel9-power-small', os='rhel', os_type='linux', os_ver='9', size='small', arch='power'),
*ls_distro(name='rhel8-power', os='rhel', os_type='linux', os_ver='8', arch='power'),
]

RHEL_ZSERIES_DISTROS = [
Distro(name='rhel8-zseries-large', os='rhel', os_type='linux', os_ver='8', size='large', arch='zseries'),
Distro(name='rhel8-zseries-small', os='rhel', os_type='linux', os_ver='8', size='small', arch='zseries'),
Distro(name='rhel9-zseries-large', os='rhel', os_type='linux', os_ver='9', size='large', arch='zseries'),
Distro(name='rhel9-zseries-small', os='rhel', os_type='linux', os_ver='9', size='small', arch='zseries'),
*ls_distro(name='rhel8-zseries', os='rhel', os_type='linux', os_ver='8', arch='zseries'),
]

UBUNTU_DISTROS = [
Distro(name='ubuntu2004-large', os='ubuntu', os_type='linux', os_ver='20.04', size='large'),
Distro(name='ubuntu2004-small', os='ubuntu', os_type='linux', os_ver='20.04', size='small'),
Distro(name='ubuntu2204-large', os='ubuntu', os_type='linux', os_ver='22.04', size='large'),
Distro(name='ubuntu2204-small', os='ubuntu', os_type='linux', os_ver='22.04', size='small'),
*ls_distro(name='ubuntu2004', os='ubuntu', os_type='linux', os_ver='20.04'),
*ls_distro(name='ubuntu2204', os='ubuntu', os_type='linux', os_ver='22.04'),
]

UBUNTU_ARM64_DISTROS = [
Distro(name='ubuntu2004-arm64-large', os='ubuntu', os_type='linux', os_ver='20.04', size='large', arch='arm64'),
Distro(name='ubuntu2004-arm64-small', os='ubuntu', os_type='linux', os_ver='20.04', size='small', arch='arm64'),
Distro(name='ubuntu2204-arm64-large', os='ubuntu', os_type='linux', os_ver='22.04', size='large', arch='arm64'),
Distro(name='ubuntu2204-arm64-small', os='ubuntu', os_type='linux', os_ver='22.04', size='small', arch='arm64'),
*ls_distro(name='ubuntu2004-arm64', os='ubuntu', os_type='linux', os_ver='20.04', arch='arm64'),
]

WINDOWS_DISTROS = [
Distro(name='windows-64-vs2013-large', os='windows', os_type='windows', vs_ver='2013', size='large'),
Distro(name='windows-64-vs2013-small', os='windows', os_type='windows', vs_ver='2013', size='small'),
Distro(name='windows-64-vs2015-large', os='windows', os_type='windows', vs_ver='2015', size='large'),
Distro(name='windows-64-vs2015-small', os='windows', os_type='windows', vs_ver='2015', size='small'),
Distro(name='windows-64-vs2017-large', os='windows', os_type='windows', vs_ver='2017', size='large'),
Distro(name='windows-64-vs2017-small', os='windows', os_type='windows', vs_ver='2017', size='small'),
Distro(name='windows-64-vs2019-large', os='windows', os_type='windows', vs_ver='2019', size='large'),
Distro(name='windows-64-vs2019-small', os='windows', os_type='windows', vs_ver='2019', size='small'),

Distro(name='windows-2022-large', os='windows', os_type='windows', os_ver='2022'),
Distro(name='windows-2022-small', os='windows', os_type='windows', os_ver='2022'),

Distro(name='windows-64-2019', os='windows', os_type='windows', os_ver='2019'),

Distro(name='windows-64-vsMulti-small', os='windows', os_type='windows', vs_ver='vsMulti', size='small'),
*ls_distro(name='windows-64-vs2015', os='windows', os_type='windows', vs_ver='2015'),
*ls_distro(name='windows-64-vs2017', os='windows', os_type='windows', vs_ver='2017'),
*ls_distro(name='windows-64-vs2019', os='windows', os_type='windows', vs_ver='2019'),

Distro(name='windows-vsCurrent-2022-large', os='windows', os_type='windows', os_ver='2022', vs_ver='vsCurrent', size='large'),
Distro(name='windows-vsCurrent-2022-small', os='windows', os_type='windows', os_ver='2022', vs_ver='vsCurrent', size='small'),

Distro(name='windows-vsCurrent-large', os='windows', os_type='windows', vs_ver='vsCurrent', size='large'), # Windows Server 2019
Distro(name='windows-vsCurrent-small', os='windows', os_type='windows', vs_ver='vsCurrent', size='small'), # Windows Server 2019
*ls_distro(name='windows-vsCurrent', os='windows', os_type='windows', vs_ver='vsCurrent'), # Windows Server 2019
]
#fmt: on
# pylint: enable=line-too-long

# See: https://evergreen.mongodb.com/distros
# Ensure no-arch distros are ordered before arch-specific distros.
ALL_DISTROS = [] + \
DEBIAN_DISTROS + \
MACOS_DISTROS + \
MACOS_ARM64_DISTROS + \
RHEL_DISTROS + \
RHEL_ARM64_DISTROS + \
RHEL_POWER_DISTROS + \
RHEL_ZSERIES_DISTROS + \
UBUNTU_DISTROS + \
UBUNTU_ARM64_DISTROS + \
WINDOWS_DISTROS
ALL_DISTROS = [
*DEBIAN_DISTROS,
*MACOS_DISTROS,
*MACOS_ARM64_DISTROS,
*RHEL_DISTROS,
*RHEL_POWER_DISTROS,
*RHEL_ZSERIES_DISTROS,
*UBUNTU_DISTROS,
*UBUNTU_ARM64_DISTROS,
*WINDOWS_DISTROS,
]


def find_distro(name) -> Distro:
Expand Down Expand Up @@ -205,6 +173,10 @@ def make_distro_str(distro_name, compiler, arch) -> str:
'vs2015x86': '-x86',
'vs2017x64': '-x64',
'vs2017x86': '-x86',
'vs2019x64': '-x64',
'vs2019x86': '-x86',
'vs2022x64': '-x64',
'vs2022x86': '-x86',
}.get(compiler, f'-{compiler}')
else:
distro_str = distro_name
Expand All @@ -219,10 +191,56 @@ def make_distro_str(distro_name, compiler, arch) -> str:

def to_cc(compiler):
return {
'vs2013x64': 'Visual Studio 12 2013 Win64',
'vs2013x64': 'Visual Studio 12 2013',
'vs2013x86': 'Visual Studio 12 2013',
'vs2015x64': 'Visual Studio 14 2015 Win64',
'vs2015x64': 'Visual Studio 14 2015',
'vs2015x86': 'Visual Studio 14 2015',
'vs2017x64': 'Visual Studio 15 2017 Win64',
'vs2017x64': 'Visual Studio 15 2017',
'vs2017x86': 'Visual Studio 15 2017',
'vs2019x64': 'Visual Studio 16 2019',
'vs2019x86': 'Visual Studio 16 2019',
'vs2022x64': 'Visual Studio 17 2022',
'vs2022x86': 'Visual Studio 17 2022',
}.get(compiler, compiler)


def to_platform(compiler):
return {
'vs2013x64': 'x64',
'vs2013x86': 'Win32',
'vs2015x64': 'x64',
'vs2015x86': 'Win32',
'vs2017x64': 'x64',
'vs2017x86': 'Win32',
'vs2019x64': 'x64',
'vs2019x86': 'Win32',
'vs2022x64': 'x64',
'vs2022x86': 'Win32',
}.get(compiler, compiler)


def compiler_to_vars(compiler):
match compiler, compiler.split('-'):
case _, ['gcc', *rest]:
return {
'CC': '-'.join(['gcc'] + rest),
'CXX': '-'.join(['g++'] + rest),
}

case _, ['clang', *rest]:
return {
'CC': '-'.join(['clang'] + rest),
'CXX': '-'.join(['clang++'] + rest),
}

case str(vs), _ if 'vs' in vs:
return {
'CMAKE_GENERATOR': to_cc(vs),
'CMAKE_GENERATOR_PLATFORM': to_platform(vs),
}

case compiler, _:
return {
'CC': compiler,
'CXX': compiler,
}
Loading