Skip to content

Commit ac49920

Browse files
committed
Merge remote-tracking branch 'origin/master' into coverity_fixes
2 parents ad9b336 + 1040823 commit ac49920

File tree

612 files changed

+22207
-22859
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

612 files changed

+22207
-22859
lines changed

.clang-format

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ AlwaysBreakBeforeMultilineStrings: false
5353
AlwaysBreakTemplateDeclarations: MultiLine
5454
AttributeMacros:
5555
- __capability
56+
- BSON_GNUC_WARN_UNUSED_RESULT
57+
- BSON_DEPRECATED
58+
- BSON_DEPRECATED_FOR
5659
BinPackArguments: false
5760
BinPackParameters: false
5861
BitFieldColonSpacing: Both
@@ -102,7 +105,12 @@ ForEachMacros:
102105
- foreach
103106
- Q_FOREACH
104107
- BOOST_FOREACH
108+
- mlib_foreach_irange
109+
- mlib_foreach_urange
110+
- mlib_foreach
111+
- mlib_foreach_arr
105112
IfMacros:
113+
- mlib_assert_aborts
106114
- KJ_IF_MAYBE
107115
IncludeBlocks: Preserve
108116
IncludeCategories:

.evergreen/benchmark.yml

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ variables:
3535
set -o errexit
3636
set -o verbose
3737
38-
cmake -DENABLE_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=mongoc -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF . && make -j8 && make install
38+
cmake -DENABLE_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=mongoc . && make -j8 && make install
3939
git clone https://github.com/mongodb/mongo-c-driver-performance.git
4040
cd mongo-c-driver-performance
4141
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=../mongoc . && make -j8
@@ -170,10 +170,44 @@ functions:
170170
file_location: mongo-c-driver/report.json
171171

172172
"send dashboard data" :
173-
command: perf.send
174-
params:
175-
name: perf
176-
file: mongo-c-driver/results.json
173+
# Here we begin to generate the request to send the data to Signal Processing Service (SPS)
174+
- command: shell.exec
175+
params:
176+
script: |
177+
# We use the requester expansion to determine whether the data is from a mainline evergreen run or not
178+
if [ "${requester}" == "commit" ]; then
179+
echo "is_mainline: true" >> expansion.yml
180+
else
181+
echo "is_mainline: false" >> expansion.yml
182+
fi
183+
184+
# We parse the username out of the order_id as patches append that in and SPS does not need that information
185+
echo "parsed_order_id: $(echo "${revision_order_id}" | awk -F'_' '{print $NF}')" >> expansion.yml
186+
- command: expansions.update
187+
params:
188+
file: expansion.yml
189+
- command: shell.exec
190+
params:
191+
script: |
192+
# Submit the performance data to the SPS endpoint
193+
response=$(curl -s -w "\nHTTP_STATUS:%{http_code}" -X 'POST' \
194+
"https://performance-monitoring-api.corp.mongodb.com/raw_perf_results/cedar_report?project=${project_id}&version=${version_id}&variant=${build_variant}&order=${parsed_order_id}&task_name=${task_name}&task_id=${task_id}&execution=${execution}&mainline=${is_mainline}" \
195+
-H 'accept: application/json' \
196+
-H 'Content-Type: application/json' \
197+
-d @mongo-c-driver/results.json)
198+
199+
http_status=$(echo "$response" | grep "HTTP_STATUS" | awk -F':' '{print $2}')
200+
response_body=$(echo "$response" | sed '/HTTP_STATUS/d')
201+
202+
# We want to throw an error if the data was not successfully submitted
203+
if [ "$http_status" -ne 200 ]; then
204+
echo "Error: Received HTTP status $http_status"
205+
echo "Response Body: $response_body"
206+
exit 1
207+
fi
208+
209+
echo "Response Body: $response_body"
210+
echo "HTTP Status: $http_status"
177211
178212
"backtrace":
179213
- command: shell.exec

.evergreen/config_generator/components/abi_compliance_check.py

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,49 @@
22
from shrub.v3.evg_command import s3_put
33
from shrub.v3.evg_task import EvgTask
44

5+
from config_generator.components.funcs.set_cache_dir import SetCacheDir
6+
57
from config_generator.etc.function import Function
68
from config_generator.etc.utils import bash_exec
79

810

911
class CheckABICompliance(Function):
1012
name = 'abi-compliance-check'
11-
commands = [
13+
commands = SetCacheDir.commands + [
1214
bash_exec(
1315
command_type=EvgCommandType.SETUP,
1416
working_dir='mongoc',
17+
include_expansions_in_env=['MONGO_C_DRIVER_CACHE_DIR'],
1518
script='.evergreen/scripts/abi-compliance-check-setup.sh'
1619
),
1720
bash_exec(
18-
command_type=EvgCommandType.SETUP,
21+
command_type=EvgCommandType.TEST,
1922
add_expansions_to_env=True,
2023
working_dir='mongoc',
24+
include_expansions_in_env=['MONGO_C_DRIVER_CACHE_DIR'],
2125
script='.evergreen/scripts/abi-compliance-check.sh'
2226
),
23-
bash_exec(
24-
command_type=EvgCommandType.TEST,
25-
working_dir='mongoc',
26-
env={
27-
'AWS_ACCESS_KEY_ID': '${aws_key}',
28-
'AWS_SECRET_ACCESS_KEY': '${aws_secret}',
29-
},
30-
script='''\
31-
aws s3 cp abi-compliance/compat_reports s3://mciuploads/${project}/${build_variant}/${revision}/${version_id}/${build_id}/abi-compliance/compat_reports --recursive --acl public-read --region us-east-1
32-
[[ ! -f ./abi-compliance/abi-error.txt ]]
33-
'''
34-
),
3527
s3_put(
28+
command_type=EvgCommandType.SYSTEM,
3629
aws_key='${aws_key}',
3730
aws_secret='${aws_secret}',
3831
bucket='mciuploads',
3932
content_type='text/html',
40-
display_name='ABI Report:',
41-
local_files_include_filter='mongoc/abi-compliance/compat_reports/**/*.html',
33+
display_name='ABI Compliance Check: ',
34+
local_files_include_filter='abi-compliance/compat_reports/**/compat_report.html',
35+
permissions='public-read',
36+
remote_file='${project}/${branch_name}/${revision}/${version_id}/${build_id}/${task_id}/${execution}/abi-compliance-check/',
37+
),
38+
s3_put(
39+
command_type=EvgCommandType.SYSTEM,
40+
aws_key='${aws_key}',
41+
aws_secret='${aws_secret}',
42+
bucket='mciuploads',
43+
content_type='text/plain',
44+
display_name='ABI Compliance Check: ',
45+
local_files_include_filter='abi-compliance/logs/**/log.txt',
4246
permissions='public-read',
43-
remote_file='${project}/${build_variant}/${revision}/${version_id}/${build_id}/abi-compliance/compat_report.html',
47+
remote_file='${project}/${branch_name}/${revision}/${version_id}/${build_id}/${task_id}/${execution}/abi-compliance-check/',
4448
),
4549
]
4650

.evergreen/config_generator/components/c_std_compile.py

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from config_generator.etc.distros import find_large_distro
88
from config_generator.etc.distros import make_distro_str
9-
from config_generator.etc.distros import to_cc
9+
from config_generator.etc.distros import compiler_to_vars
1010
from config_generator.etc.function import Function
1111
from config_generator.etc.utils import bash_exec
1212

@@ -17,14 +17,32 @@
1717
# pylint: disable=line-too-long
1818
# fmt: off
1919
MATRIX = [
20-
('debian92', 'clang', None, [11, ]),
21-
('debian10', 'clang', None, [11, ]),
22-
('debian10', 'gcc', None, [11, 17]),
23-
('debian11', 'clang', None, [11, ]),
24-
('debian11', 'gcc', None, [11, 17]),
25-
('ubuntu2004', 'clang', None, [11, ]),
26-
('ubuntu2004', 'gcc', None, [11, ]),
27-
('windows-vsCurrent', 'vs2017x64', None, [11, 17]),
20+
('rhel80', 'clang', None, [99, 11, 17, ]), # Clang 7.0
21+
('ubuntu2004', 'clang-10', None, [99, 11, 17, 23]), # Clang 10.0 (max: C2x)
22+
('rhel84', 'clang', None, [99, 11, 17, 23]), # Clang 11.0 (max: C2x)
23+
('ubuntu2204', 'clang-12', None, [99, 11, 17, 23]), # Clang 12.0 (max: C2x)
24+
('rhel90', 'clang', None, [99, 11, 17, 23]), # Clang 13.0 (max: C2x)
25+
('rhel91', 'clang', None, [99, 11, 17, 23]), # Clang 14.0 (max: C2x)
26+
('rhel92', 'clang', None, [99, 11, 17, 23]), # Clang 15.0 (max: C2x)
27+
('rhel93', 'clang', None, [99, 11, 17, 23]), # Clang 16.0 (max: C2x)
28+
('rhel94', 'clang', None, [99, 11, 17, 23]), # Clang 17.0 (max: C2x)
29+
('rhel95', 'clang', None, [99, 11, 17, 23]), # Clang 18.0 (max: C23)
30+
31+
('rhel76', 'gcc', None, [99, 11, ]), # GCC 4.8 (max: C11)
32+
('rhel80', 'gcc', None, [99, 11, 17, ]), # GCC 8.2 (max: C17)
33+
('debian10', 'gcc-8', None, [99, 11, 17, ]), # GCC 8.3 (max: C17)
34+
('rhel84', 'gcc', None, [99, 11, 17, ]), # GCC 8.4 (max: C17)
35+
('ubuntu2004', 'gcc-9', None, [99, 11, 17, 23]), # GCC 9.4 (max: C2x)
36+
('debian11', 'gcc-10', None, [99, 11, 17, 23]), # GCC 10.2 (max: C2x)
37+
('rhel90', 'gcc', None, [99, 11, 17, 23]), # GCC 11.2 (max: C2x)
38+
('rhel92', 'gcc', None, [99, 11, 17, 23]), # GCC 11.3 (max: C2x)
39+
('rhel94', 'gcc', None, [99, 11, 17, 23]), # GCC 11.4 (max: C2x)
40+
('rhel95', 'gcc', None, [99, 11, 17, 23]), # GCC 11.5 (max: C2x)
41+
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
2846
]
2947
# fmt: on
3048
# pylint: enable=line-too-long
@@ -54,18 +72,20 @@ def tasks():
5472
res = []
5573

5674
for distro_name, compiler, arch, stds in MATRIX:
57-
tags = [TAG, distro_name, compiler, 'compile']
75+
compiler_type = compiler.split('-')[0]
76+
77+
tags = [TAG, distro_name, compiler_type, 'compile']
5878

5979
distro = find_large_distro(distro_name)
6080

6181
compile_vars = None
62-
compile_vars = {'CC': to_cc(compiler)}
82+
compile_vars = compiler_to_vars(compiler)
6383

6484
if arch:
6585
tags.append(arch)
6686
compile_vars.update({'MARCH': arch})
6787

68-
distro_str = make_distro_str(distro_name, compiler, arch)
88+
distro_str = make_distro_str(distro_name, compiler_type, arch)
6989

7090
for std in stds:
7191
with_std = {'C_STD_VERSION': std}

.evergreen/config_generator/components/cse/winssl.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# pylint: disable=line-too-long
1515
# fmt: off
1616
COMPILE_MATRIX = [
17-
('windows-64-vs2015', 'vs2015x64', None, ['cyrus']),
1817
('windows-vsCurrent', 'vs2017x64', None, ['cyrus']),
1918
]
2019

.evergreen/config_generator/components/earthly.py

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"alpine3.18",
2828
"alpine3.19",
2929
"archlinux",
30-
"centos7"
30+
"centos7",
3131
]
3232
"Identifiers for environments. These correspond to special 'env.*' targets in the Earthfile."
3333
CompilerName = Literal["gcc", "clang"]
@@ -36,13 +36,13 @@
3636
# Other options: SSPI (Windows only), AUTO (not reliably test-able without more environments)
3737
SASLOption = Literal["Cyrus", "off"]
3838
"Valid options for the SASL configuration parameter"
39-
TLSOption = Literal["LibreSSL", "OpenSSL", "off"]
39+
TLSOption = Literal["OpenSSL", "off"]
4040
"Options for the TLS backend configuration parameter (AKA 'ENABLE_SSL')"
41-
CxxVersion = Literal["r3.8.0", "r3.9.0", "none"]
41+
CxxVersion = Literal["none"] # TODO: Once CXX-3103 is released, add latest C++ release tag.
4242
"C++ driver refs that are under CI test"
4343

4444
# A separator character, since we cannot use whitespace
45-
_SEPARATOR = "\N{no-break space}\N{bullet}\N{no-break space}"
45+
_SEPARATOR = "\N{NO-BREAK SPACE}\N{BULLET}\N{NO-BREAK SPACE}"
4646

4747

4848
def os_split(env: EnvKey) -> tuple[str, None | str]:
@@ -59,9 +59,7 @@ def os_split(env: EnvKey) -> tuple[str, None | str]:
5959
case "centos7":
6060
return "CentOS", "7.0"
6161
case _:
62-
raise ValueError(
63-
f"Failed to split OS env key {env=} into a name+version pair (unrecognized)"
64-
)
62+
raise ValueError(f"Failed to split OS env key {env=} into a name+version pair (unrecognized)")
6563

6664

6765
class EarthlyVariant(NamedTuple):
@@ -135,7 +133,7 @@ class Configuration(NamedTuple):
135133

136134
@property
137135
def suffix(self) -> str:
138-
return f"{_SEPARATOR}".join(f"{k}={v}" for k, v in self._asdict().items())
136+
return _SEPARATOR.join(f"{k}={v}" for k, v in self._asdict().items())
139137

140138

141139
def task_filter(env: EarthlyVariant, conf: Configuration) -> bool:
@@ -144,27 +142,10 @@ def task_filter(env: EarthlyVariant, conf: Configuration) -> bool:
144142
configuration values.
145143
"""
146144
match env, conf:
147-
# We only need one task with "sasl=off"
148-
case ["u22", "gcc"], ("off", "OpenSSL", "r3.8.0"):
149-
return True
150-
# The Ubuntu 18.04 GCC has a bug that fails to build the 3.8.0 C++ driver
151-
case ["u18", "gcc"], [_, _, "r3.8.0"]:
152-
return False
153-
# Other sasl=off tasks we'll just ignore:
154-
case _, ("off", _tls, _cxx):
155-
return False
156-
# Ubuntu and CentOS do not ship with a LibreSSL package:
157-
case e, (_sasl, "LibreSSL", _cxx) if e.display_name.startswith("Ubuntu") or e.display_name.startswith("CentOS"):
158-
return False
159-
# u16 is not capable of building mongocxx
160-
case e, (_, _, "none") if e.display_name.startswith("Ubuntu 16") or e.display_name.startswith("CentOS 7"):
161-
return True
162-
# Exclude u16 for all other configurations
163-
case e, _ if e.display_name.startswith("Ubuntu 16") or e.display_name.startswith("CentOS 7"):
164-
return False
165-
# Exclude all other envs
166-
case _, (_, _, "none"):
167-
return False
145+
# u16/centos7 are not capable of building mongocxx
146+
case e, (_sasl, _tls, cxx) if re.match(r"^Ubuntu 16|^CentOS 7", e.display_name):
147+
# Only build if C++ driver is test is disabled
148+
return cxx == "none"
168149
# Anything else: Allow it to run:
169150
case _:
170151
return True
@@ -230,11 +211,11 @@ def earthly_task(
230211
commands=[
231212
# Ensure subsequent Docker commands are authenticated.
232213
subprocess_exec(
233-
binary='bash',
234-
command_type="setup",
214+
binary="bash",
215+
command_type=EvgCommandType.SETUP,
235216
args=[
236217
"-c",
237-
'docker login -u "${artifactory_username}" --password-stdin artifactory.corp.mongodb.com <<<"${artifactory_password}"'
218+
r'docker login -u "${artifactory_username}" --password-stdin artifactory.corp.mongodb.com <<<"${artifactory_password}"',
238219
],
239220
),
240221
# First, just build the "env-warmup" which will prepare the build environment.
@@ -253,8 +234,8 @@ def earthly_task(
253234
# The "targets" arg is for +run to specify which targets to run
254235
args={"targets": " ".join(targets)} | earthly_args,
255236
),
256-
],
257-
tags=[f"earthly", "pr-merge-gate", *env_tags],
237+
], # type: ignore (The type annots on `commands` is wrong)
238+
tags=["earthly", "pr-merge-gate", *env_tags],
258239
run_on=CONTAINER_RUN_DISTROS,
259240
)
260241

.evergreen/config_generator/components/funcs/fetch_source.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,7 @@ class FetchSource(Function):
1818
set -o errexit
1919
set -o pipefail
2020
if [ -n "${github_pr_number}" -o "${is_patch}" = "true" ]; then
21-
# This is a GitHub PR or patch build, probably branched from master
22-
if command -v python3 &>/dev/null; then
23-
# Prefer python3 if it is available
24-
echo $(python3 ./build/calc_release_version.py --next-minor) > VERSION_CURRENT
25-
else
26-
echo $(python ./build/calc_release_version.py --next-minor) > VERSION_CURRENT
27-
fi
28-
VERSION=$VERSION_CURRENT-${version_id}
21+
VERSION=patch-${version_id}
2922
else
3023
VERSION=latest
3124
fi

.evergreen/config_generator/components/funcs/prepare_kerberos.py

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

0 commit comments

Comments
 (0)