Skip to content

CDRIVER-4462 Use CMake 3.25.2 and improve compile scripts #1205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9792c60
CDRIVER-4462 Add find-cmake-version.h and find-cmake-latest.sh
eramongodb Feb 13, 2023
37b2e78
Use find-cmake-latest.sh in compile.sh scripts
eramongodb Feb 13, 2023
8b973c7
Print CMake version after search for verification
eramongodb Feb 13, 2023
a20007c
Ensure build-and-test-with-toolchain uses the correct CMake version
eramongodb Feb 13, 2023
bf83e5e
Ensure consistent CMake binary usage when compiling libmongocrypt
eramongodb Feb 13, 2023
a8a8abc
Fix CMake linker selection issue on macos-1014
eramongodb Feb 13, 2023
1b010bf
Add required Evergreen expansions to tasks
eramongodb Feb 13, 2023
f6d7702
Extract scan-build compile script into compile-scan-build.sh
eramongodb Feb 14, 2023
9c85c04
Extract libmongocrypt compilation scripts into compile-libmongocrypt.sh
eramongodb Feb 14, 2023
c97ee0d
Address several compile and scan-build warnings
eramongodb Feb 14, 2023
89bda37
Reduce output verbosity of build-and-test-with-toolchain
eramongodb Feb 14, 2023
371eae6
Relocate scan-build matrix to config_generator
eramongodb Feb 14, 2023
4b0ce37
Revert ineffective mongoc-cxx-check changes
eramongodb Feb 14, 2023
a30184f
Revert ineffective ranlib silence attempt
eramongodb Feb 14, 2023
2d86597
Fix updates to compiler flags in compile-scan-build.sh
eramongodb Feb 15, 2023
21f1616
Remove inaccurate comment
eramongodb Feb 15, 2023
cde1065
Add reference to BUILD ticket regarding cert issues
eramongodb Feb 15, 2023
2ee6565
Extend fix of flags variable usage in compile-scan-build.sh
eramongodb Feb 15, 2023
51b74b8
Improve cache directory selection across operating systems
eramongodb Feb 15, 2023
fa0b1ad
Add support for bypassing CMake cache lookup
eramongodb Feb 16, 2023
8f0978a
Use compile-libmongocrypt.sh in compile-std.sh
eramongodb Feb 16, 2023
4f8b156
Reword certificate verification -> validation
eramongodb Feb 16, 2023
2ec1238
Rename cmake_replace_latest -> cmake_replace_version
eramongodb Feb 16, 2023
5daa4aa
Update comments with find-cmake.sh -> find-cmake-latest.sh
eramongodb Feb 16, 2023
b99bbaa
Fix quotes around expansion in compile-windows.sh
eramongodb Feb 16, 2023
72cc689
Remove redundant ENABLE_CLIENT_SIDE_ENCRYPTION=ON
eramongodb Feb 16, 2023
8f6abba
Replace IOV_MEMCPY_CAST with unconditional cast
eramongodb Feb 16, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class CheckABICompliance(Function):
commands = [
bash_exec(
command_type=EvgCommandType.SETUP,
add_expansions_to_env=True,
working_dir='mongoc',
script='.evergreen/scripts/abi-compliance-check.sh'
),
Expand Down
99 changes: 99 additions & 0 deletions .evergreen/config_generator/components/scan_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
from shrub.v3.evg_build_variant import BuildVariant
from shrub.v3.evg_command import EvgCommandType
from shrub.v3.evg_command import FunctionCall
from shrub.v3.evg_task import EvgTaskRef

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.function import Function
from config_generator.etc.utils import bash_exec
from config_generator.etc.utils import Task


TAG = 'scan-build-matrix'


# pylint: disable=line-too-long
# fmt: off
MATRIX = [
('macos-1014', 'clang', None ),
('ubuntu1404', 'clang', None ),
('ubuntu1604-arm64', 'clang', None ),
('ubuntu1604', 'clang', 'i686'),
('ubuntu1604', 'clang', None ),
('ubuntu1804-arm64', 'clang', None ),
('ubuntu1804', 'clang', 'i686'),
]
# fmt: on
# pylint: enable=line-too-long


class ScanBuild(Function):
name = 'scan-build'
commands = [
bash_exec(
command_type=EvgCommandType.TEST,
add_expansions_to_env=True,
redirect_standard_error_to_output=True,
working_dir='mongoc',
script='.evergreen/scripts/compile-scan-build.sh',
),
]

@classmethod
def call(cls, **kwargs):
return cls.default_call(**kwargs)


def functions():
return ScanBuild.defn()


def tasks():
res = []

for distro_name, compiler, arch in MATRIX:
tags = [TAG, distro_name, compiler]

distro = find_large_distro(distro_name)

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

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

distro_str = make_distro_str(distro_name, compiler, arch)

task_name = f'scan-build-{distro_str}'

res.append(
Task(
name=task_name,
run_on=distro.name,
tags=tags,
commands=[
ScanBuild.call(vars=compile_vars),
FunctionCall(func='upload scan artifacts'),
],
)
)

# TODO: remove once BUILD-16814 is resolved.
for task in res:
if task.run_on == 'macos-1014':
task.disable = True

return res


def variants():
return [
BuildVariant(
name=TAG,
display_name=TAG,
tasks=[EvgTaskRef(name=f'.{TAG}')],
),
]
12 changes: 12 additions & 0 deletions .evergreen/generated_configs/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ functions:
params:
binary: bash
working_dir: mongoc
add_expansions_to_env: true
args:
- -c
- .evergreen/scripts/abi-compliance-check.sh
Expand Down Expand Up @@ -406,6 +407,17 @@ functions:
args:
- -c
- .evergreen/scripts/compile.sh
scan-build:
- command: subprocess.exec
type: test
params:
binary: bash
working_dir: mongoc
add_expansions_to_env: true
redirect_standard_error_to_output: true
args:
- -c
- .evergreen/scripts/compile-scan-build.sh
std-compile:
- command: subprocess.exec
type: test
Expand Down
39 changes: 4 additions & 35 deletions .evergreen/generated_configs/legacy-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -472,34 +472,6 @@ tasks:
set -o errexit
env CFLAGS="-fno-omit-frame-pointer" CHECK_LOG="ON" DEBUG="ON" EXTRA_CONFIGURE_FLAGS="-DENABLE_EXTRA_ALIGNMENT=OFF" SANITIZE="address" SNAPPY="OFF" SSL="OPENSSL" ZLIB="BUNDLED" ZSTD="OFF" bash .evergreen/scripts/compile.sh
- func: upload-build
- name: debug-compile-scan-build
tags:
- clang
- debug-compile
- scan-build
- special
commands:
- command: shell.exec
type: test
params:
working_dir: mongoc
add_expansions_to_env: true
shell: bash
script: |-
set -o errexit
env ANALYZE="ON" CC="clang" DEBUG="ON" bash .evergreen/scripts/compile.sh
- func: upload-build
- func: upload scan artifacts
- command: shell.exec
type: test
params:
working_dir: mongoc
shell: bash
script: |-
set -o errexit
if find scan -name \*.html | grep -q html; then
exit 123
fi
- name: compile-tracing
commands:
- command: shell.exec
Expand Down Expand Up @@ -9025,6 +8997,7 @@ tasks:
- func: fetch-source
- command: shell.exec
params:
add_expansions_to_env: true
shell: bash
script: |-
set -o errexit
Expand Down Expand Up @@ -9066,6 +9039,7 @@ tasks:
- func: fetch-source
- command: shell.exec
params:
add_expansions_to_env: true
shell: bash
script: |-
set -o errexit
Expand All @@ -9089,6 +9063,7 @@ tasks:
- func: fetch-source
- command: shell.exec
params:
add_expansions_to_env: true
shell: bash
script: |-
set -o errexit
Expand Down Expand Up @@ -9127,6 +9102,7 @@ tasks:
commands:
- command: shell.exec
params:
add_expansions_to_env: true
shell: bash
script: |-
set -o errexit
Expand Down Expand Up @@ -9287,7 +9263,6 @@ buildvariants:
CC: clang
run_on: ubuntu1404-build
tasks:
- debug-compile-scan-build
- release-compile
- debug-compile-rdtscp
- name: clang35
Expand Down Expand Up @@ -9337,7 +9312,6 @@ buildvariants:
MARCH: i686
run_on: ubuntu1804-test
tasks:
- debug-compile-scan-build
- release-compile
- debug-compile-nosasl-nossl
- debug-compile-no-align
Expand All @@ -9350,7 +9324,6 @@ buildvariants:
MARCH: i686
run_on: ubuntu1604-test
tasks:
- debug-compile-scan-build
- release-compile
- debug-compile-no-align
- name: clang38ubuntu
Expand All @@ -9360,7 +9333,6 @@ buildvariants:
run_on: ubuntu1604-test
tasks:
- .compression !.zstd
- debug-compile-scan-build
- release-compile
- debug-compile-sasl-openssl
- debug-compile-nosasl-openssl
Expand Down Expand Up @@ -9503,7 +9475,6 @@ buildvariants:
- debug-compile-nosrv
- debug-compile-sasl-darwinssl
- debug-compile-nosasl-nossl
- .debug-compile .clang
- .authentication-tests .darwinssl
- .latest .nossl
- test-dns-darwinssl
Expand Down Expand Up @@ -9616,7 +9587,6 @@ buildvariants:
run_on: ubuntu1804-arm64-large
tasks:
- .compression !.snappy !.zstd
- debug-compile-scan-build
- debug-compile-no-align
- release-compile
- debug-compile-nosasl-nossl
Expand All @@ -9633,7 +9603,6 @@ buildvariants:
run_on: ubuntu1604-arm64-large
tasks:
- .compression !.snappy !.zstd
- debug-compile-scan-build
- debug-compile-no-align
- release-compile
batchtime: 1440
Expand Down
59 changes: 59 additions & 0 deletions .evergreen/generated_configs/tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3194,6 +3194,65 @@ tasks:
- func: fetch-det
- func: bootstrap-mongo-orchestration
- func: run-tests
- name: scan-build-macos-1014-clang
run_on: macos-1014
tags: [scan-build-matrix, macos-1014, clang]
disable: true
commands:
- func: scan-build
vars:
CC: clang
- func: upload scan artifacts
- name: scan-build-ubuntu1404-clang
run_on: ubuntu1404-large
tags: [scan-build-matrix, ubuntu1404, clang]
commands:
- func: scan-build
vars:
CC: clang
- func: upload scan artifacts
- name: scan-build-ubuntu1604-arm64-clang
run_on: ubuntu1604-arm64-large
tags: [scan-build-matrix, ubuntu1604-arm64, clang]
commands:
- func: scan-build
vars:
CC: clang
- func: upload scan artifacts
- name: scan-build-ubuntu1604-clang
run_on: ubuntu1604-large
tags: [scan-build-matrix, ubuntu1604, clang]
commands:
- func: scan-build
vars:
CC: clang
- func: upload scan artifacts
- name: scan-build-ubuntu1604-clang-i686
run_on: ubuntu1604-large
tags: [scan-build-matrix, ubuntu1604, clang, i686]
commands:
- func: scan-build
vars:
CC: clang
MARCH: i686
- func: upload scan artifacts
- name: scan-build-ubuntu1804-arm64-clang
run_on: ubuntu1804-arm64-large
tags: [scan-build-matrix, ubuntu1804-arm64, clang]
commands:
- func: scan-build
vars:
CC: clang
- func: upload scan artifacts
- name: scan-build-ubuntu1804-clang-i686
run_on: ubuntu1804-large
tags: [scan-build-matrix, ubuntu1804, clang, i686]
commands:
- func: scan-build
vars:
CC: clang
MARCH: i686
- func: upload scan artifacts
- name: std-c11-archlinux-clang-compile
run_on: archlinux-large
tags: [std-matrix, archlinux, clang, compile, std-c11]
Expand Down
4 changes: 4 additions & 0 deletions .evergreen/generated_configs/variants.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ buildvariants:
DEBUG: "ON"
tasks:
- name: .sasl-matrix-winssl
- name: scan-build-matrix
display_name: scan-build-matrix
tasks:
- name: .scan-build-matrix
- name: std-matrix
display_name: std-matrix
tasks:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def shell_exec(script,
working_dir=None,
background=False,
add_expansions_to_env=False,
redirect_standard_error_to_output=False,
):
dedented = ''
if errexit:
Expand Down Expand Up @@ -85,6 +86,9 @@ def shell_exec(script,
if add_expansions_to_env:
command['params']['add_expansions_to_env'] = True

if redirect_standard_error_to_output:
command['params']['redirect_standard_error_to_output'] = True

command['params']['shell'] = 'bash'
command['params']['script'] = dedented
return command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,17 +184,6 @@ def __init__(self, task_name, suffix_commands, orchestration=True, **kwargs):
sanitize=['address'],
EXTRA_CONFIGURE_FLAGS="-DENABLE_EXTRA_ALIGNMENT=OFF",
SSL='OPENSSL'),
SpecialTask('debug-compile-scan-build',
tags=['clang', 'debug-compile', 'scan-build'],
continue_on_err=True,
ANALYZE='ON',
CC='clang',
suffix_commands=[
func('upload scan artifacts'),
shell_mongoc('''
if find scan -name \*.html | grep -q html; then
exit 123
fi''')]),
CompileTask('compile-tracing',
TRACING='ON', CFLAGS='-Werror -Wno-cast-align'),
CompileTask('release-compile',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _create_tasks():
AZUREKMS_CMD="tar xf testazurekms.tgz" \
$DRIVERS_TOOLS/.evergreen/csfle/azurekms/run-command.sh
echo "Untarring file ... end"
''', test=False),
''', test=False, add_expansions_to_env=True),
shell_exec (r'''
export AZUREKMS_RESOURCEGROUP=${testazurekms_resourcegroup}
export AZUREKMS_VMNAME=${AZUREKMS_VMNAME}
Expand All @@ -69,7 +69,7 @@ def _create_tasks():
pushd mongoc
./.evergreen/scripts/compile-test-azurekms.sh
popd
''', test=False),
''', test=False, add_expansions_to_env=True),
shell_exec (r'''
LD_LIBRARY_PATH=$PWD/install \
MONGODB_URI='mongodb://localhost:27017' \
Expand Down
Loading