From 29263b7666cca444802a02dfac0aee9e1f802b83 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 24 Oct 2023 10:35:37 -0500 Subject: [PATCH 01/28] Remove obsolete tar_options anchor --- .mci.yml | 40 +--------------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/.mci.yml b/.mci.yml index faf49d0f28..8b52612fcc 100644 --- a/.mci.yml +++ b/.mci.yml @@ -32,10 +32,6 @@ variables: msvc2015_extra_path: &msvc2015_extra_path "/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/MSBuild/14.0/Bin" msvc2017_extra_path: &msvc2017_extra_path "/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin" - ## tar options variables - tar_options: - linux_tar_options: &linux_tar_options --wildcards --no-anchored - ## cmake flag variables cmake_flags: linux_cmake_flags: &linux_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wconversion -Wnarrowing -Wno-expansion-to-defined -pedantic -Werror -Wno-missing-field-initializers -Wno-aligned-new $ignore_deprecated" @@ -1324,7 +1320,6 @@ axes: extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags build_type: "Debug" - tar_options: *linux_tar_options code_coverage_cmake_flags: *code_coverage_cmake_flags run_on: - ubuntu1804-build @@ -1333,8 +1328,7 @@ axes: variables: extra_path: *msvc2017_extra_path cmake_flags: *msvc2017_cmake_flags - build_type: "Debug" - tar_options: *linux_tar_options # Same for Windows and Linux + build_type: "Debug" # Same for Windows and Linux generator: *msvc2017_generator example_projects_cxx_standard: 17 run_on: @@ -1430,7 +1424,6 @@ buildvariants: display_name: "RHEL 9 Release (MongoDB Latest)" expansions: build_type: "Release" - tar_options: *linux_tar_options extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags mongodb_version: *version_latest @@ -1454,7 +1447,6 @@ buildvariants: display_name: "arm64 RHEL 9 Release (MongoDB Latest)" expansions: build_type: "Release" - tar_options: *linux_tar_options extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags mongodb_version: *version_latest @@ -1478,7 +1470,6 @@ buildvariants: display_name: "Debian 11 Release (MongoDB Latest)" expansions: build_type: "Release" - tar_options: *linux_tar_options extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags mongodb_version: *version_latest @@ -1502,7 +1493,6 @@ buildvariants: display_name: "Debian 11 Release (MongoDB 5.0)" expansions: build_type: "Release" - tar_options: *linux_tar_options extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags mongodb_version: *version_50 @@ -1526,7 +1516,6 @@ buildvariants: display_name: "Debian 10 Release (MongoDB Latest)" expansions: build_type: "Release" - tar_options: *linux_tar_options extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags mongodb_version: *version_latest @@ -1548,7 +1537,6 @@ buildvariants: display_name: "Debian 10 Release (MongoDB 5.0)" expansions: build_type: "Release" - tar_options: *linux_tar_options extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags mongodb_version: *version_50 @@ -1582,7 +1570,6 @@ buildvariants: display_name: "Ubuntu 20.04 Release (MongoDB Latest)" expansions: build_type: "Release" - tar_options: *linux_tar_options extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags mongodb_version: *version_latest @@ -1604,7 +1591,6 @@ buildvariants: display_name: "Ubuntu 20.04 Release (MongoDB 5.0)" expansions: build_type: "Release" - tar_options: *linux_tar_options extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags mongodb_version: *version_50 @@ -1626,7 +1612,6 @@ buildvariants: display_name: "Ubuntu 18.04 Release (MongoDB Latest)" expansions: build_type: "Release" - tar_options: *linux_tar_options extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags mongodb_version: *version_latest @@ -1649,7 +1634,6 @@ buildvariants: display_name: "Ubuntu 18.04 Release (MongoDB 5.0)" expansions: build_type: "Release" - tar_options: *linux_tar_options extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags mongodb_version: *version_50 @@ -1673,7 +1657,6 @@ buildvariants: display_name: "Ubuntu 16.04 Debug (std::experimental) (MongoDB 4.4)" expansions: build_type: "Debug" - tar_options: *linux_tar_options extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags poly_flags: *poly_std_experimental_flags @@ -1692,7 +1675,6 @@ buildvariants: display_name: "Valgrind Ubuntu 18.04 Debug (MongoDB Latest)" expansions: build_type: "Debug" - tar_options: *linux_tar_options extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags test_params: *valgrind_test_params @@ -1711,7 +1693,6 @@ buildvariants: display_name: "Valgrind Ubuntu 18.04 Debug (MongoDB 5.0)" expansions: build_type: "Debug" - tar_options: *linux_tar_options extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags test_params: *valgrind_test_params @@ -1730,7 +1711,6 @@ buildvariants: display_name: "ASAN Ubuntu 18.04 Debug (MongoDB Latest)" expansions: build_type: "Debug" - tar_options: *linux_tar_options extra_path: *linux_extra_path cmake_flags: *asan_cmake_flags test_params: *asan_test_params @@ -1751,7 +1731,6 @@ buildvariants: display_name: "ASAN Ubuntu 18.04 Debug (MongoDB 5.0)" expansions: build_type: "Debug" - tar_options: *linux_tar_options extra_path: *linux_extra_path cmake_flags: *asan_cmake_flags test_params: *asan_test_params @@ -1772,7 +1751,6 @@ buildvariants: display_name: "UBSAN Ubuntu 18.04 Debug (MongoDB Latest)" expansions: build_type: "Debug" - tar_options: *linux_tar_options extra_path: *linux_extra_path cmake_flags: *ubsan_cmake_flags test_params: *ubsan_test_params @@ -1794,7 +1772,6 @@ buildvariants: display_name: "UBSAN Ubuntu 18.04 Debug (MongoDB 5.0)" expansions: build_type: "Debug" - tar_options: *linux_tar_options extra_path: *linux_extra_path cmake_flags: *ubsan_cmake_flags test_params: *ubsan_test_params @@ -1816,7 +1793,6 @@ buildvariants: display_name: "Ubuntu 18.04 Debug (MongoDB Latest) (Extra)" expansions: build_type: "Debug" - tar_options: *linux_tar_options cmake_flags: *linux_cmake_flags mongodb_version: *version_latest run_on: @@ -1831,7 +1807,6 @@ buildvariants: display_name: "Ubuntu 22.04 Debug (GCC)" expansions: build_type: "Debug" - tar_options: *linux_tar_options cmake_flags: *linux_cmake_flags mongodb_version: *version_latest compiler: g++ @@ -1845,7 +1820,6 @@ buildvariants: display_name: "Ubuntu 22.04 Debug (Clang)" expansions: build_type: "Debug" - tar_options: *linux_tar_options cmake_flags: *linux_cmake_flags mongodb_version: *version_latest compiler: clang++ @@ -1859,7 +1833,6 @@ buildvariants: display_name: "Mongohouse Test" expansions: build_type: "Release" - tar_options: *linux_tar_options cmake_flags: *linux_cmake_flags mongodb_version: *version_latest run_on: ubuntu1804-test @@ -1871,7 +1844,6 @@ buildvariants: batchtime: 1440 # 1 day expansions: build_type: "Release" - tar_options: *linux_tar_options cmake_flags: *linux_cmake_flags mongodb_version: *version_latest cmake: "cmake" @@ -1890,7 +1862,6 @@ buildvariants: batchtime: 1440 # 1 day expansions: build_type: "Release" - tar_options: *linux_tar_options cmake_flags: *linux_cmake_flags mongodb_version: *version_60 cmake: "cmake" @@ -1909,7 +1880,6 @@ buildvariants: batchtime: 1440 # 1 day expansions: build_type: "Release" - tar_options: *linux_tar_options cmake_flags: *linux_cmake_flags mongodb_version: *version_50 cmake: "cmake" @@ -1928,7 +1898,6 @@ buildvariants: batchtime: 1440 # 1 day expansions: build_type: "Release" - tar_options: *linux_tar_options cmake_flags: *power8_cmake_flags mongodb_version: *version_latest cmake: "cmake" @@ -1947,7 +1916,6 @@ buildvariants: batchtime: 1440 # 1 day expansions: build_type: "Release" - tar_options: *linux_tar_options cmake_flags: *power8_cmake_flags mongodb_version: *version_50 cmake: "cmake" @@ -1966,7 +1934,6 @@ buildvariants: batchtime: 1440 # 1 day expansions: build_type: "Release" - tar_options: *linux_tar_options cmake_flags: *linux_cmake_flags mongodb_version: *version_latest run_on: @@ -1982,7 +1949,6 @@ buildvariants: batchtime: 1440 # 1 day expansions: build_type: "Release" - tar_options: *linux_tar_options cmake_flags: *linux_cmake_flags mongodb_version: *version_50 run_on: @@ -1999,7 +1965,6 @@ buildvariants: batchtime: 1440 # 1 day expansions: build_type: "Debug" - tar_options: *linux_tar_options cmake_flags: *linux_cmake_flags mongodb_version: *version_latest mongoc_version: *mongoc_version_minimum @@ -2064,7 +2029,6 @@ buildvariants: display_name: "Windows (VS 2015) Release (MongoDB 4.2)" expansions: build_type: "Release" - tar_options: *linux_tar_options extra_path: *msvc2015_extra_path cmake_flags: *msvc2015_cmake_flags mongodb_version: *version_42 @@ -2082,7 +2046,6 @@ buildvariants: display_name: "Windows (VS 2015) Debug Static (MongoDB 4.2)" expansions: build_type: "Debug" - tar_options: *linux_tar_options extra_path: *msvc2015_extra_path cmake_flags: *msvc2015_cmake_flags mongodb_version: *version_42 @@ -2098,7 +2061,6 @@ buildvariants: display_name: "Windows (VS 2015) Debug (MongoDB 4.2)" expansions: build_type: "Debug" - tar_options: *linux_tar_options extra_path: *msvc2015_extra_path cmake_flags: *msvc2015_cmake_flags generator: *msvc2015_generator From 6bd6d03e605c62b0c825cfe9e4b81acc3ac092fb Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 24 Oct 2023 10:52:20 -0500 Subject: [PATCH 02/28] Remove obsolete poly_mnmlstc anchor --- .mci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.mci.yml b/.mci.yml index 8b52612fcc..59b956ddfe 100644 --- a/.mci.yml +++ b/.mci.yml @@ -69,7 +69,6 @@ variables: poly_flags: poly_boost_flags: &poly_boost_flags -DBSONCXX_POLY_USE_BOOST=ON poly_std_experimental_flags: &poly_std_experimental_flags -DBSONCXX_POLY_USE_STD_EXPERIMENTAL=ON -DCMAKE_CXX_STANDARD=14 - poly_mnmlstc: &poly_mnmlstc -DBSONCXX_POLY_USE_MNMLSTC=ON ## test parameters test_params: From 6742672dce2daea6d8171d40f9b684deb67797ae Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 24 Oct 2023 10:30:06 -0500 Subject: [PATCH 03/28] Replace use of mongoc_version_default with minimum --- .evergreen/install_c_driver.sh | 2 +- .mci.yml | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.evergreen/install_c_driver.sh b/.evergreen/install_c_driver.sh index 2e63970094..1e2f777d7f 100755 --- a/.evergreen/install_c_driver.sh +++ b/.evergreen/install_c_driver.sh @@ -3,7 +3,7 @@ set -o errexit set -o pipefail -declare -r mongoc_version="${mongoc_version:-"${mongoc_version_default:?"missing mongoc version"}"}" +declare -r mongoc_version="${mongoc_version:-"${mongoc_version_minimum:?"missing mongoc version"}"}" : "${mongoc_version:?}" # Usage: diff --git a/.mci.yml b/.mci.yml index 59b956ddfe..863444a286 100644 --- a/.mci.yml +++ b/.mci.yml @@ -9,8 +9,6 @@ exec_timeout_secs: 3600 ####################################### variables: - mongoc_version_default: &mongoc_version_default "1.24.0" - # If updating mongoc_version_minimum, also update: # - the default value of --c-driver-build-ref in etc/make_release.py # - LIBMONGOC_REQUIRED_VERSION in src/mongocxx/CMakeLists.txt @@ -269,8 +267,8 @@ functions: type: setup params: updates: - - key: mongoc_version_default - value: *mongoc_version_default + - key: mongoc_version_minimum + value: *mongoc_version_minimum - command: shell.exec type: setup params: From 1d7924c8a8fd520fb2b8ee5ab14d451b626c189f Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 24 Oct 2023 11:17:50 -0500 Subject: [PATCH 04/28] Expand the integration test matrix into explicit variants --- .mci.yml | 424 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 321 insertions(+), 103 deletions(-) diff --git a/.mci.yml b/.mci.yml index 863444a286..d6a5706266 100644 --- a/.mci.yml +++ b/.mci.yml @@ -74,6 +74,40 @@ variables: ubsan_test_params: &ubsan_test_params PATH="/usr/lib/llvm-3.8/bin" UBSAN_OPTIONS="print_stacktrace=1" valgrind_test_params: &valgrind_test_params valgrind --leak-check=full --track-origins=yes --num-callers=50 --error-exitcode=1 --error-limit=no --read-var-info=yes --suppressions=../etc/memcheck.suppressions + integration_matrix: + integration_matrix_tasks_single: &integration_matrix_tasks_single + tasks: + - name: compile_and_test_with_shared_libs + - name: compile_and_test_with_shared_libs_extra_alignment + integration_matrix_tasks_replica: &integration_matrix_tasks_replica + tasks: + - name: compile_and_test_with_shared_libs_replica_set_with_libmongocrypt + integration_matrix_tasks_sharded: &integration_matrix_tasks_sharded + tasks: + - name: compile_and_test_with_shared_libs_sharded_cluster_with_libmongocrypt + integration_matrix_auth_tasks_single: &integration_matrix_auth_tasks_single + tasks: + - name: compile_and_test_auth_with_shared_libs + integration_matrix_versioned_api_tasks_single: &integration_matrix_versioned_api_tasks_single + tasks: + - name: test_versioned_api + - name: test_versioned_api_accept_version_two + # "Drivers MUST run all tests with mongocryptd on at least one platform for all tested server versions (4.2+)." + integration_matrix_mongocryptd_tasks: &integration_matrix_mongocryptd_tasks + tasks: + - name: compile_and_test_with_shared_libs_replica_set_with_libmongocrypt + - name: compile_and_test_with_shared_libs_sharded_cluster_with_libmongocrypt + integration_matrix_expansions_linux: &integration_matrix_expansions_linux + build_type: "Debug" + cmake_flags: *linux_cmake_flags + code_coverage_cmake_flags: *code_coverage_cmake_flags + extra_path: *linux_extra_path + integration_matrix_expansions_windows: &integration_matrix_expansions_windows + extra_path: *msvc2017_extra_path + cmake_flags: *msvc2017_cmake_flags + build_type: "Debug" # Same for Windows and Linux + generator: *msvc2017_generator + example_projects_cxx_standard: 17 ####################################### # Functions # @@ -1303,70 +1337,6 @@ task_groups: tasks: - test_search_index_helpers -####################################### -# MongoDB Version Matrix # -####################################### - -axes: - - id: os - display_name: "OS" - values: - - id: "ubuntu-1804" - display_name: "Ubuntu 18.04 Debug" - variables: - extra_path: *linux_extra_path - cmake_flags: *linux_cmake_flags - build_type: "Debug" - code_coverage_cmake_flags: *code_coverage_cmake_flags - run_on: - - ubuntu1804-build - - id: "windows-2k8" - display_name: "Windows (VS 2017) Debug" - variables: - extra_path: *msvc2017_extra_path - cmake_flags: *msvc2017_cmake_flags - build_type: "Debug" # Same for Windows and Linux - generator: *msvc2017_generator - example_projects_cxx_standard: 17 - run_on: - - windows-64-vs2017-compile - - - id: mongodb_version - display_name: "MongoDB Version" - values: - - id: "latest" - display_name: "Latest" - variables: - mongodb_version: *version_latest - - id: "7.0" - display_name: "7.0" - variables: - mongodb_version: *version_70 - - id: "6.0" - display_name: "6.0" - variables: - mongodb_version: *version_60 - - id: "5.0" - display_name: "5.0" - variables: - mongodb_version: *version_50 - - id: "4.4" - display_name: "4.4" - variables: - mongodb_version: *version_44 - - id: "4.2" - display_name: "4.2" - variables: - mongodb_version: *version_42 - - id: "4.0" - display_name: "4.0" - variables: - mongodb_version: *version_40 - - - id: use_mongocryptd - values: - - id: "true" - ####################################### # Buildvariants # @@ -1376,37 +1346,297 @@ buildvariants: ####################################### # Standard MongoDB Integration Tests # ####################################### - - matrix_name: "integration" - matrix_spec: {os: "*", mongodb_version: "*"} - display_name: "${os} (MongoDB ${mongodb_version})" - tasks: - - name: compile_and_test_with_shared_libs - - name: compile_and_test_with_shared_libs_extra_alignment + - name: integration-ubuntu1804-latest-single + display_name: "Ubuntu 18.04 Debug (MongoDB Latest)" + run_on: ubuntu1804-large + expansions: + mongodb_version: "latest" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_tasks_single - - matrix_name: "integration (replica set)" - matrix_spec: {os: "ubuntu-1804", mongodb_version: "*"} - display_name: "${os} replica set (MongoDB ${mongodb_version})" - tasks: - - name: compile_and_test_with_shared_libs_replica_set_with_libmongocrypt + - name: integration-ubuntu1804-7.0-single + display_name: "Ubuntu 18.04 Debug (MongoDB 7.0)" + run_on: ubuntu1804-large + expansions: + mongodb_version: "7.0" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_tasks_single - - matrix_name: "integration (sharded cluster)" - matrix_spec: {os: "ubuntu-1804", mongodb_version: "*"} - display_name: "${os} sharded cluster (MongoDB ${mongodb_version})" - tasks: - - name: compile_and_test_with_shared_libs_sharded_cluster_with_libmongocrypt + - name: integration-ubuntu1804-6.0-single + display_name: "Ubuntu 18.04 Debug (MongoDB 6.0)" + run_on: ubuntu1804-large + expansions: + mongodb_version: "6.0" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_tasks_single - - matrix_name: "auth" - matrix_spec: {os: "*", mongodb_version: "latest"} - display_name: "${os} ${mongodb_version} Auth" - tasks: - - name: compile_and_test_auth_with_shared_libs + - name: integration-ubuntu1804-5.0-single + display_name: "Ubuntu 18.04 Debug (MongoDB 5.0)" + run_on: ubuntu1804-large + expansions: + mongodb_version: "5.0" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_tasks_single - - matrix_name: "versioned api" - matrix_spec: {os: "*", mongodb_version: "latest"} - display_name: "${os} ${mongodb_version} Versioned API" - tasks: - - name: test_versioned_api - - name: test_versioned_api_accept_version_two + - name: integration-ubuntu1804-4.4-single + display_name: "Ubuntu 18.04 Debug (MongoDB 4.4)" + run_on: ubuntu1804-large + expansions: + mongodb_version: "4.4" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_tasks_single + + - name: integration-ubuntu1804-4.2-single + display_name: "Ubuntu 18.04 Debug (MongoDB 4.2)" + run_on: ubuntu1804-large + expansions: + mongodb_version: "4.2" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_tasks_single + + - name: integration-ubuntu1804-4.0-single + display_name: "Ubuntu 18.04 Debug (MongoDB 4.0)" + run_on: ubuntu1804-large + expansions: + mongodb_version: "4.0" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_tasks_single + + - name: integration-vs2017-latest-single + display_name: "Windows (VS 2017) Debug (MongoDB Latest)" + run_on: windows-64-vs2017-large + expansions: + mongodb_version: "latest" + <<: *integration_matrix_expansions_windows + <<: *integration_matrix_tasks_single + + - name: integration-vs2017-7.0-single + display_name: "Windows (VS 2017) Debug (MongoDB 7.0)" + run_on: windows-64-vs2017-large + expansions: + mongodb_version: "7.0" + <<: *integration_matrix_expansions_windows + <<: *integration_matrix_tasks_single + + - name: integration-vs2017-6.0-single + display_name: "Windows (VS 2017) Debug (MongoDB 6.0)" + run_on: windows-64-vs2017-large + expansions: + mongodb_version: "6.0" + <<: *integration_matrix_expansions_windows + <<: *integration_matrix_tasks_single + + - name: integration-vs2017-5.0-single + display_name: "Windows (VS 2017) Debug (MongoDB 5.0)" + run_on: windows-64-vs2017-large + expansions: + mongodb_version: "5.0" + <<: *integration_matrix_expansions_windows + <<: *integration_matrix_tasks_single + + - name: integration-vs2017-4.4-single + display_name: "Windows (VS 2017) Debug (MongoDB 4.4)" + run_on: windows-64-vs2017-large + expansions: + mongodb_version: "4.4" + <<: *integration_matrix_expansions_windows + <<: *integration_matrix_tasks_single + + - name: integration-vs2017-4.2-single + display_name: "Windows (VS 2017) Debug (MongoDB 4.2)" + run_on: windows-64-vs2017-large + expansions: + mongodb_version: "4.2" + <<: *integration_matrix_expansions_windows + <<: *integration_matrix_tasks_single + + - name: integration-vs2017-4.0-single + display_name: "Windows (VS 2017) Debug (MongoDB 4.0)" + run_on: windows-64-vs2017-large + expansions: + mongodb_version: "4.0" + <<: *integration_matrix_expansions_windows + <<: *integration_matrix_tasks_single + + - name: integration-ubuntu1804-latest-replica + display_name: "Ubuntu 18.04 Debug replica set (MongoDB Latest)" + run_on: ubuntu1804-large + expansions: + mongodb_version: "latest" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_tasks_replica + + - name: integration-ubuntu1804-7.0-replica + display_name: "Ubuntu 18.04 Debug replica set (MongoDB 7.0)" + run_on: ubuntu1804-large + expansions: + mongodb_version: "7.0" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_tasks_replica + + - name: integration-ubuntu1804-6.0-replica + display_name: "Ubuntu 18.04 Debug replica set (MongoDB 6.0)" + run_on: ubuntu1804-large + expansions: + mongodb_version: "6.0" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_tasks_replica + + - name: integration-ubuntu1804-5.0-replica + display_name: "Ubuntu 18.04 Debug replica set (MongoDB 5.0)" + run_on: ubuntu1804-large + expansions: + mongodb_version: "5.0" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_tasks_replica + + - name: integration-ubuntu1804-4.4-replica + display_name: "Ubuntu 18.04 Debug replica set (MongoDB 4.4)" + run_on: ubuntu1804-large + expansions: + mongodb_version: "4.4" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_tasks_replica + + - name: integration-ubuntu1804-4.2-replica + display_name: "Ubuntu 18.04 Debug replica set (MongoDB 4.2)" + run_on: ubuntu1804-large + expansions: + mongodb_version: "4.2" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_tasks_replica + + - name: integration-ubuntu1804-4.0-replica + display_name: "Ubuntu 18.04 Debug replica set (MongoDB 4.0)" + run_on: ubuntu1804-large + expansions: + mongodb_version: "4.0" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_tasks_replica + + - name: integration-ubuntu1804-latest-sharded + display_name: "Ubuntu 18.04 Debug sharded cluster (MongoDB Latest)" + run_on: ubuntu1804-large + expansions: + mongodb_version: "latest" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_tasks_sharded + + - name: integration-ubuntu1804-7.0-sharded + display_name: "Ubuntu 18.04 Debug sharded cluster (MongoDB 7.0)" + run_on: ubuntu1804-large + expansions: + mongodb_version: "7.0" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_tasks_sharded + + - name: integration-ubuntu1804-6.0-sharded + display_name: "Ubuntu 18.04 Debug sharded cluster (MongoDB 6.0)" + run_on: ubuntu1804-large + expansions: + mongodb_version: "6.0" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_tasks_sharded + + - name: integration-ubuntu1804-5.0-sharded + display_name: "Ubuntu 18.04 Debug sharded cluster (MongoDB 5.0)" + run_on: ubuntu1804-large + expansions: + mongodb_version: "5.0" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_tasks_sharded + + - name: integration-ubuntu1804-4.4-sharded + display_name: "Ubuntu 18.04 Debug sharded cluster (MongoDB 4.4)" + run_on: ubuntu1804-large + expansions: + mongodb_version: "4.4" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_tasks_sharded + + - name: integration-ubuntu1804-4.2-sharded + display_name: "Ubuntu 18.04 Debug sharded cluster (MongoDB 4.2)" + run_on: ubuntu1804-large + expansions: + mongodb_version: "4.2" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_tasks_sharded + + - name: integration-ubuntu1804-4.0-sharded + display_name: "Ubuntu 18.04 Debug sharded cluster (MongoDB 4.0)" + run_on: ubuntu1804-large + expansions: + mongodb_version: "4.0" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_tasks_sharded + + - name: integration-auth-ubuntu1804-latest-single + display_name: "Ubuntu 18.04 Debug Latest Auth" + run_on: ubuntu1804-large + expansions: + mongodb_version: "latest" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_auth_tasks_single + + - name: integration-auth-vs2017-latest-single + display_name: "Windows (VS 2017) Debug Latest Auth" + run_on: windows-64-vs2017-large + expansions: + mongodb_version: "latest" + <<: *integration_matrix_expansions_windows + <<: *integration_matrix_auth_tasks_single + + - name: integration-versioned-api-ubuntu1804-latest-single + display_name: "Ubuntu 18.04 Debug Latest Versioned API" + run_on: ubuntu1804-large + expansions: + mongodb_version: "latest" + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_versioned_api_tasks_single + + - name: integration-versioned-api-vs2017-latest-single + display_name: "Windows (VS 2017) Debug Latest Versioned API" + run_on: windows-64-vs2017-large + expansions: + mongodb_version: "latest" + <<: *integration_matrix_expansions_windows + <<: *integration_matrix_versioned_api_tasks_single + + - name: integration-mongocryptd-ubuntu1804-latest + display_name: "Ubuntu 18.04 Debug (MongoDB Latest) with mongocryptd" + run_on: ubuntu1804-large + expansions: + mongodb_version: "latest" + use_mongocryptd: true + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_mongocryptd_tasks + + - name: integration-mongocryptd-ubuntu1804-5.0 + display_name: "Ubuntu 18.04 Debug (MongoDB 5.0) with mongocryptd" + run_on: ubuntu1804-large + expansions: + mongodb_version: "5.0" + use_mongocryptd: true + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_mongocryptd_tasks + + - name: integration-mongocryptd-ubuntu1804-4.4 + display_name: "Ubuntu 18.04 Debug (MongoDB 4.4) with mongocryptd" + run_on: ubuntu1804-large + expansions: + mongodb_version: "4.4" + use_mongocryptd: true + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_mongocryptd_tasks + + - name: integration-mongocryptd-ubuntu1804-4.2 + display_name: "Ubuntu 18.04 Debug (MongoDB 4.2) with mongocryptd" + run_on: ubuntu1804-large + expansions: + mongodb_version: "4.2" + use_mongocryptd: true + <<: *integration_matrix_expansions_linux + <<: *integration_matrix_mongocryptd_tasks ####################################### # Linux Buildvariants # @@ -1551,18 +1781,6 @@ buildvariants: - debian10-large - name: uninstall_check - # Add matrix for specification test requirement of mongocryptd: - # "Drivers MUST run all tests with mongocryptd on at least one platform for all tested server versions (4.2+)." - - matrix_name: "mongocryptd" - matrix_spec: - os: "ubuntu-1804" - mongodb_version: ["4.2", "4.4", "5.0", "latest"] - use_mongocryptd: "true" - display_name: "${os} (MongoDB ${mongodb_version}) with mongocryptd" - tasks: - - name: compile_and_test_with_shared_libs_replica_set_with_libmongocrypt - - name: compile_and_test_with_shared_libs_sharded_cluster_with_libmongocrypt - - name: ubuntu2004-release-latest display_name: "Ubuntu 20.04 Release (MongoDB Latest)" expansions: From de0c17182db26f6457227921cbd57ddd70c790b3 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 24 Oct 2023 10:29:24 -0500 Subject: [PATCH 05/28] Substitute use of mongodb_version anchors --- .mci.yml | 79 +++++++++++++++++++++++++------------------------------- 1 file changed, 35 insertions(+), 44 deletions(-) diff --git a/.mci.yml b/.mci.yml index d6a5706266..e6e50cbacc 100644 --- a/.mci.yml +++ b/.mci.yml @@ -14,15 +14,6 @@ variables: # - LIBMONGOC_REQUIRED_VERSION in src/mongocxx/CMakeLists.txt mongoc_version_minimum: &mongoc_version_minimum "1.24.0" - mongodb_version: - version_latest: &version_latest "latest" - version_70: &version_70 "7.0" - version_60: &version_60 "6.0" - version_50: &version_50 "5.0" - version_44: &version_44 "4.4" - version_42: &version_42 "4.2" - version_40: &version_40 "4.0" - ## cmake path variables extra_path: linux_extra_path: &linux_extra_path /opt/cmake/bin @@ -1653,7 +1644,7 @@ buildvariants: build_type: "Release" extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags - mongodb_version: *version_latest + mongodb_version: "latest" lib_dir: "lib64" run_on: - rhel90-large @@ -1676,7 +1667,7 @@ buildvariants: build_type: "Release" extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags - mongodb_version: *version_latest + mongodb_version: "latest" lib_dir: "lib64" run_on: - rhel90-arm64-large @@ -1699,7 +1690,7 @@ buildvariants: build_type: "Release" extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags - mongodb_version: *version_latest + mongodb_version: "latest" run_on: - debian11-large tasks: @@ -1722,7 +1713,7 @@ buildvariants: build_type: "Release" extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags - mongodb_version: *version_50 + mongodb_version: "5.0" run_on: - debian11-large tasks: @@ -1745,7 +1736,7 @@ buildvariants: build_type: "Release" extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags - mongodb_version: *version_latest + mongodb_version: "latest" run_on: - debian10-large tasks: @@ -1766,7 +1757,7 @@ buildvariants: build_type: "Release" extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags - mongodb_version: *version_50 + mongodb_version: "5.0" run_on: - debian10-large tasks: @@ -1787,7 +1778,7 @@ buildvariants: build_type: "Release" extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags - mongodb_version: *version_latest + mongodb_version: "latest" run_on: - ubuntu2004-large tasks: @@ -1808,7 +1799,7 @@ buildvariants: build_type: "Release" extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags - mongodb_version: *version_50 + mongodb_version: "5.0" run_on: - ubuntu2004-large tasks: @@ -1829,7 +1820,7 @@ buildvariants: build_type: "Release" extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags - mongodb_version: *version_latest + mongodb_version: "latest" run_on: - ubuntu1804-build tasks: @@ -1851,7 +1842,7 @@ buildvariants: build_type: "Release" extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags - mongodb_version: *version_50 + mongodb_version: "5.0" run_on: - ubuntu1804-build tasks: @@ -1875,7 +1866,7 @@ buildvariants: extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags poly_flags: *poly_std_experimental_flags - mongodb_version: *version_44 + mongodb_version: "4.4" example_projects_cxx_standard: *std_experimental_cxx_standard use_mongocryptd: true # crypt_shared is not available for Ubuntu 16.04 run_on: @@ -1893,7 +1884,7 @@ buildvariants: extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags test_params: *valgrind_test_params - mongodb_version: *version_latest + mongodb_version: "latest" disable_slow_tests: 1 use_mongocryptd: true # false positives arise from the crypt_shared library run_on: @@ -1911,7 +1902,7 @@ buildvariants: extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags test_params: *valgrind_test_params - mongodb_version: *version_50 + mongodb_version: "5.0" disable_slow_tests: 1 use_mongocryptd: true run_on: @@ -1929,7 +1920,7 @@ buildvariants: extra_path: *linux_extra_path cmake_flags: *asan_cmake_flags test_params: *asan_test_params - mongodb_version: *version_latest + mongodb_version: "latest" example_projects_cc: *asan_cc_path example_projects_cxx: *asan_cxx_path example_projects_cxxflags: *asan_cxxflags @@ -1949,7 +1940,7 @@ buildvariants: extra_path: *linux_extra_path cmake_flags: *asan_cmake_flags test_params: *asan_test_params - mongodb_version: *version_50 + mongodb_version: "5.0" example_projects_cc: *asan_cc_path example_projects_cxx: *asan_cxx_path example_projects_cxxflags: *asan_cxxflags @@ -1969,7 +1960,7 @@ buildvariants: extra_path: *linux_extra_path cmake_flags: *ubsan_cmake_flags test_params: *ubsan_test_params - mongodb_version: *version_latest + mongodb_version: "latest" example_projects_cc: *ubsan_cc_path example_projects_cxx: *ubsan_cxx_path example_projects_cxxflags: *ubsan_cxxflags @@ -1990,7 +1981,7 @@ buildvariants: extra_path: *linux_extra_path cmake_flags: *ubsan_cmake_flags test_params: *ubsan_test_params - mongodb_version: *version_50 + mongodb_version: "5.0" example_projects_cc: *ubsan_cc_path example_projects_cxx: *ubsan_cxx_path example_projects_cxxflags: *ubsan_cxxflags @@ -2009,7 +2000,7 @@ buildvariants: expansions: build_type: "Debug" cmake_flags: *linux_cmake_flags - mongodb_version: *version_latest + mongodb_version: "latest" run_on: - ubuntu1804-build tasks: @@ -2023,7 +2014,7 @@ buildvariants: expansions: build_type: "Debug" cmake_flags: *linux_cmake_flags - mongodb_version: *version_latest + mongodb_version: "latest" compiler: g++ run_on: - ubuntu2204-small @@ -2036,7 +2027,7 @@ buildvariants: expansions: build_type: "Debug" cmake_flags: *linux_cmake_flags - mongodb_version: *version_latest + mongodb_version: "latest" compiler: clang++ run_on: - ubuntu2204-small @@ -2049,7 +2040,7 @@ buildvariants: expansions: build_type: "Release" cmake_flags: *linux_cmake_flags - mongodb_version: *version_latest + mongodb_version: "latest" run_on: ubuntu1804-test tasks: - name: test_mongohouse @@ -2060,7 +2051,7 @@ buildvariants: expansions: build_type: "Release" cmake_flags: *linux_cmake_flags - mongodb_version: *version_latest + mongodb_version: "latest" cmake: "cmake" lib_dir: "lib64" run_on: @@ -2078,7 +2069,7 @@ buildvariants: expansions: build_type: "Release" cmake_flags: *linux_cmake_flags - mongodb_version: *version_60 + mongodb_version: "6.0" cmake: "cmake" lib_dir: "lib64" run_on: @@ -2096,7 +2087,7 @@ buildvariants: expansions: build_type: "Release" cmake_flags: *linux_cmake_flags - mongodb_version: *version_50 + mongodb_version: "5.0" cmake: "cmake" lib_dir: "lib64" run_on: @@ -2114,7 +2105,7 @@ buildvariants: expansions: build_type: "Release" cmake_flags: *power8_cmake_flags - mongodb_version: *version_latest + mongodb_version: "latest" cmake: "cmake" lib_dir: "lib64" run_on: @@ -2132,7 +2123,7 @@ buildvariants: expansions: build_type: "Release" cmake_flags: *power8_cmake_flags - mongodb_version: *version_50 + mongodb_version: "5.0" cmake: "cmake" lib_dir: "lib64" run_on: @@ -2150,7 +2141,7 @@ buildvariants: expansions: build_type: "Release" cmake_flags: *linux_cmake_flags - mongodb_version: *version_latest + mongodb_version: "latest" run_on: - ubuntu1804-arm64-build tasks: @@ -2165,7 +2156,7 @@ buildvariants: expansions: build_type: "Release" cmake_flags: *linux_cmake_flags - mongodb_version: *version_50 + mongodb_version: "5.0" run_on: - ubuntu1804-arm64-build tasks: @@ -2181,7 +2172,7 @@ buildvariants: expansions: build_type: "Debug" cmake_flags: *linux_cmake_flags - mongodb_version: *version_latest + mongodb_version: "latest" mongoc_version: *mongoc_version_minimum run_on: - ubuntu1804-build @@ -2201,7 +2192,7 @@ buildvariants: extra_path: *macos_extra_path cmake_flags: *macos_cmake_flags poly_flags: *poly_boost_flags - mongodb_version: *version_latest + mongodb_version: "latest" run_on: - macos-1100 tasks: @@ -2217,7 +2208,7 @@ buildvariants: extra_path: *macos_extra_path cmake_flags: *macos_cmake_flags poly_flags: *poly_boost_flags - mongodb_version: *version_50 + mongodb_version: "5.0" run_on: - macos-1100 tasks: @@ -2233,7 +2224,7 @@ buildvariants: extra_path: *macos_extra_path cmake_flags: *macos_cmake_flags poly_flags: *poly_boost_flags - mongodb_version: *version_latest + mongodb_version: "latest" run_on: - macos-1100 tasks: @@ -2246,7 +2237,7 @@ buildvariants: build_type: "Release" extra_path: *msvc2015_extra_path cmake_flags: *msvc2015_cmake_flags - mongodb_version: *version_42 + mongodb_version: "4.2" generator: *msvc2015_generator run_on: - windows-64-vs2015-compile @@ -2263,7 +2254,7 @@ buildvariants: build_type: "Debug" extra_path: *msvc2015_extra_path cmake_flags: *msvc2015_cmake_flags - mongodb_version: *version_42 + mongodb_version: "4.2" generator: *msvc2015_generator run_on: - windows-64-vs2015-compile @@ -2279,7 +2270,7 @@ buildvariants: extra_path: *msvc2015_extra_path cmake_flags: *msvc2015_cmake_flags generator: *msvc2015_generator - mongodb_version: *version_42 + mongodb_version: "4.2" run_on: - windows-64-vs2015-compile tasks: From 8ae08ce1f4fd393a6582735899ede1ea486b9c2b Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 24 Oct 2023 10:33:25 -0500 Subject: [PATCH 06/28] Substitute use of example project anchors --- .mci.yml | 53 +++++++++++++++++------------------------------------ 1 file changed, 17 insertions(+), 36 deletions(-) diff --git a/.mci.yml b/.mci.yml index e6e50cbacc..789d273003 100644 --- a/.mci.yml +++ b/.mci.yml @@ -36,25 +36,6 @@ variables: # power8_cmake_flags includes -Wno-maybe-uninitialized to ignore a warning from the std::optional implementation of MNMLSTC. power8_cmake_flags: &power8_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wconversion -Wnarrowing -Wno-expansion-to-defined -pedantic -Werror -Wno-missing-field-initializers -Wno-aligned-new $ignore_deprecated -Wno-error=maybe-uninitialized" - example_projects_cc: - asan_cc_path: &asan_cc_path /usr/bin/clang - ubsan_cc_path: &ubsan_cc_path /usr/bin/clang - - example_projects_cxx: - asan_cxx_path: &asan_cxx_path /usr/bin/clang++ - ubsan_cxx_path: &ubsan_cxx_path /usr/bin/clang++ - - example_projects_cxxflags: - asan_cxxflags: &asan_cxxflags -D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=address -fno-omit-frame-pointer - ubsan_cxxflags: &ubsan_cxxflags -D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=undefined -fno-sanitize-recover=undefined -fno-omit-frame-pointer - - example_projects_ldflags: - asan_ldflags: &asan_ldflags -fsanitize=address - ubsan_ldflags: &ubsan_ldflags -fsanitize=undefined -fno-sanitize-recover=undefined - - example_projects_cxx_standard: - std_experimental_cxx_standard: &std_experimental_cxx_standard 14 - poly_flags: poly_boost_flags: &poly_boost_flags -DBSONCXX_POLY_USE_BOOST=ON poly_std_experimental_flags: &poly_std_experimental_flags -DBSONCXX_POLY_USE_STD_EXPERIMENTAL=ON -DCMAKE_CXX_STANDARD=14 @@ -1867,7 +1848,7 @@ buildvariants: cmake_flags: *linux_cmake_flags poly_flags: *poly_std_experimental_flags mongodb_version: "4.4" - example_projects_cxx_standard: *std_experimental_cxx_standard + example_projects_cxx_standard: 14 use_mongocryptd: true # crypt_shared is not available for Ubuntu 16.04 run_on: - ubuntu1604-build @@ -1921,10 +1902,10 @@ buildvariants: cmake_flags: *asan_cmake_flags test_params: *asan_test_params mongodb_version: "latest" - example_projects_cc: *asan_cc_path - example_projects_cxx: *asan_cxx_path - example_projects_cxxflags: *asan_cxxflags - example_projects_ldflags: *asan_ldflags + example_projects_cc: /usr/bin/clang + example_projects_cxx: /usr/bin/clang++ + example_projects_cxxflags: -D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=address -fno-omit-frame-pointer + example_projects_ldflags: -fsanitize=address run_on: - ubuntu1804-build tasks: @@ -1941,10 +1922,10 @@ buildvariants: cmake_flags: *asan_cmake_flags test_params: *asan_test_params mongodb_version: "5.0" - example_projects_cc: *asan_cc_path - example_projects_cxx: *asan_cxx_path - example_projects_cxxflags: *asan_cxxflags - example_projects_ldflags: *asan_ldflags + example_projects_cc: /usr/bin/clang + example_projects_cxx: /usr/bin/clang++ + example_projects_cxxflags: -D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=address -fno-omit-frame-pointer + example_projects_ldflags: -fsanitize=address run_on: - ubuntu1804-build tasks: @@ -1961,10 +1942,10 @@ buildvariants: cmake_flags: *ubsan_cmake_flags test_params: *ubsan_test_params mongodb_version: "latest" - example_projects_cc: *ubsan_cc_path - example_projects_cxx: *ubsan_cxx_path - example_projects_cxxflags: *ubsan_cxxflags - example_projects_ldflags: *ubsan_ldflags + example_projects_cc: /usr/bin/clang + example_projects_cxx: /usr/bin/clang++ + example_projects_cxxflags: -D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=undefined -fno-sanitize-recover=undefined -fno-omit-frame-pointer + example_projects_ldflags: -fsanitize=undefined -fno-sanitize-recover=undefined run_on: - ubuntu1804-build tasks: @@ -1982,10 +1963,10 @@ buildvariants: cmake_flags: *ubsan_cmake_flags test_params: *ubsan_test_params mongodb_version: "5.0" - example_projects_cc: *ubsan_cc_path - example_projects_cxx: *ubsan_cxx_path - example_projects_cxxflags: *ubsan_cxxflags - example_projects_ldflags: *ubsan_ldflags + example_projects_cc: /usr/bin/clang + example_projects_cxx: /usr/bin/clang++ + example_projects_cxxflags: -D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=undefined -fno-sanitize-recover=undefined -fno-omit-frame-pointer + example_projects_ldflags: -fsanitize=undefined -fno-sanitize-recover=undefined run_on: - ubuntu1804-build tasks: From 5ff43bfd8544ebedb3ce88d789aed0363b3be3c2 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 24 Oct 2023 11:43:07 -0500 Subject: [PATCH 07/28] Substitute use of polyfill library flags --- .mci.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.mci.yml b/.mci.yml index 789d273003..afa0f1b142 100644 --- a/.mci.yml +++ b/.mci.yml @@ -36,10 +36,6 @@ variables: # power8_cmake_flags includes -Wno-maybe-uninitialized to ignore a warning from the std::optional implementation of MNMLSTC. power8_cmake_flags: &power8_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wconversion -Wnarrowing -Wno-expansion-to-defined -pedantic -Werror -Wno-missing-field-initializers -Wno-aligned-new $ignore_deprecated -Wno-error=maybe-uninitialized" - poly_flags: - poly_boost_flags: &poly_boost_flags -DBSONCXX_POLY_USE_BOOST=ON - poly_std_experimental_flags: &poly_std_experimental_flags -DBSONCXX_POLY_USE_STD_EXPERIMENTAL=ON -DCMAKE_CXX_STANDARD=14 - ## test parameters test_params: asan_test_params: &asan_test_params PATH="/usr/lib/llvm-3.8/bin" ASAN_OPTIONS="detect_leaks=1" @@ -1846,7 +1842,7 @@ buildvariants: build_type: "Debug" extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags - poly_flags: *poly_std_experimental_flags + poly_flags: -DBSONCXX_POLY_USE_STD_EXPERIMENTAL=ON -DCMAKE_CXX_STANDARD=14 mongodb_version: "4.4" example_projects_cxx_standard: 14 use_mongocryptd: true # crypt_shared is not available for Ubuntu 16.04 @@ -2172,7 +2168,7 @@ buildvariants: build_type: "Release" extra_path: *macos_extra_path cmake_flags: *macos_cmake_flags - poly_flags: *poly_boost_flags + poly_flags: -DBSONCXX_POLY_USE_BOOST=ON mongodb_version: "latest" run_on: - macos-1100 @@ -2188,7 +2184,7 @@ buildvariants: build_type: "Release" extra_path: *macos_extra_path cmake_flags: *macos_cmake_flags - poly_flags: *poly_boost_flags + poly_flags: -DBSONCXX_POLY_USE_BOOST=ON mongodb_version: "5.0" run_on: - macos-1100 @@ -2204,7 +2200,7 @@ buildvariants: build_type: "Release" extra_path: *macos_extra_path cmake_flags: *macos_cmake_flags - poly_flags: *poly_boost_flags + poly_flags: -DBSONCXX_POLY_USE_BOOST=ON mongodb_version: "latest" run_on: - macos-1100 From c2ff76e3a0e44136fa586563a64195132e6c3a2b Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 24 Oct 2023 11:55:16 -0500 Subject: [PATCH 08/28] Substitute CMake path anchors with in-script search --- .mci.yml | 59 ++++++++++++++++++++++++-------------------------------- 1 file changed, 25 insertions(+), 34 deletions(-) diff --git a/.mci.yml b/.mci.yml index afa0f1b142..f588ad5e74 100644 --- a/.mci.yml +++ b/.mci.yml @@ -14,13 +14,6 @@ variables: # - LIBMONGOC_REQUIRED_VERSION in src/mongocxx/CMakeLists.txt mongoc_version_minimum: &mongoc_version_minimum "1.24.0" - ## cmake path variables - extra_path: - linux_extra_path: &linux_extra_path /opt/cmake/bin - macos_extra_path: &macos_extra_path /Applications/Cmake.app/Contents/bin - msvc2015_extra_path: &msvc2015_extra_path "/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/MSBuild/14.0/Bin" - msvc2017_extra_path: &msvc2017_extra_path "/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin" - ## cmake flag variables cmake_flags: linux_cmake_flags: &linux_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wconversion -Wnarrowing -Wno-expansion-to-defined -pedantic -Werror -Wno-missing-field-initializers -Wno-aligned-new $ignore_deprecated" @@ -69,9 +62,7 @@ variables: build_type: "Debug" cmake_flags: *linux_cmake_flags code_coverage_cmake_flags: *code_coverage_cmake_flags - extra_path: *linux_extra_path integration_matrix_expansions_windows: &integration_matrix_expansions_windows - extra_path: *msvc2017_extra_path cmake_flags: *msvc2017_cmake_flags build_type: "Debug" # Same for Windows and Linux generator: *msvc2017_generator @@ -376,9 +367,21 @@ functions: set -o pipefail export BUILD_TYPE=${build_type} export COMPILE_MACRO_GUARD_TESTS=${COMPILE_MACRO_GUARD_TESTS} - export PATH="${extra_path}:$PATH" export RUN_DISTCHECK=${RUN_DISTCHECK} + # Add MSBuild.exe to path. + if [[ "$OSTYPE" == "cygwin" ]]; then + case "${generator}" in + *2015*) + PATH="/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/MSBuild/14.0/Bin:$PATH" + ;; + *2017*) + PATH="/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin:$PATH" + ;; + esac + fi + export PATH + ADDL_OPTS=${code_coverage_cmake_flags} if [ "${USE_STATIC_LIBS}" ]; then ADDL_OPTS="$ADDL_OPTS -DBUILD_SHARED_LIBS=OFF" @@ -441,7 +444,18 @@ functions: fi popd # .. - export PATH="${extra_path}:$PATH" + # Add MSBuild.exe to path. + if [[ "$OSTYPE" == "cygwin" ]]; then + case "${generator}" in + *2015*) + PATH="/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/MSBuild/14.0/Bin:$PATH" + ;; + *2017*) + PATH="/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin:$PATH" + ;; + esac + fi + export PATH pushd build export PREFIX=$(pwd)/../../mongoc @@ -1619,7 +1633,6 @@ buildvariants: display_name: "RHEL 9 Release (MongoDB Latest)" expansions: build_type: "Release" - extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags mongodb_version: "latest" lib_dir: "lib64" @@ -1642,7 +1655,6 @@ buildvariants: display_name: "arm64 RHEL 9 Release (MongoDB Latest)" expansions: build_type: "Release" - extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags mongodb_version: "latest" lib_dir: "lib64" @@ -1665,7 +1677,6 @@ buildvariants: display_name: "Debian 11 Release (MongoDB Latest)" expansions: build_type: "Release" - extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags mongodb_version: "latest" run_on: @@ -1688,7 +1699,6 @@ buildvariants: display_name: "Debian 11 Release (MongoDB 5.0)" expansions: build_type: "Release" - extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags mongodb_version: "5.0" run_on: @@ -1711,7 +1721,6 @@ buildvariants: display_name: "Debian 10 Release (MongoDB Latest)" expansions: build_type: "Release" - extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags mongodb_version: "latest" run_on: @@ -1732,7 +1741,6 @@ buildvariants: display_name: "Debian 10 Release (MongoDB 5.0)" expansions: build_type: "Release" - extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags mongodb_version: "5.0" run_on: @@ -1753,7 +1761,6 @@ buildvariants: display_name: "Ubuntu 20.04 Release (MongoDB Latest)" expansions: build_type: "Release" - extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags mongodb_version: "latest" run_on: @@ -1774,7 +1781,6 @@ buildvariants: display_name: "Ubuntu 20.04 Release (MongoDB 5.0)" expansions: build_type: "Release" - extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags mongodb_version: "5.0" run_on: @@ -1795,7 +1801,6 @@ buildvariants: display_name: "Ubuntu 18.04 Release (MongoDB Latest)" expansions: build_type: "Release" - extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags mongodb_version: "latest" run_on: @@ -1817,7 +1822,6 @@ buildvariants: display_name: "Ubuntu 18.04 Release (MongoDB 5.0)" expansions: build_type: "Release" - extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags mongodb_version: "5.0" run_on: @@ -1840,7 +1844,6 @@ buildvariants: display_name: "Ubuntu 16.04 Debug (std::experimental) (MongoDB 4.4)" expansions: build_type: "Debug" - extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags poly_flags: -DBSONCXX_POLY_USE_STD_EXPERIMENTAL=ON -DCMAKE_CXX_STANDARD=14 mongodb_version: "4.4" @@ -1858,7 +1861,6 @@ buildvariants: display_name: "Valgrind Ubuntu 18.04 Debug (MongoDB Latest)" expansions: build_type: "Debug" - extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags test_params: *valgrind_test_params mongodb_version: "latest" @@ -1876,7 +1878,6 @@ buildvariants: display_name: "Valgrind Ubuntu 18.04 Debug (MongoDB 5.0)" expansions: build_type: "Debug" - extra_path: *linux_extra_path cmake_flags: *linux_cmake_flags test_params: *valgrind_test_params mongodb_version: "5.0" @@ -1894,7 +1895,6 @@ buildvariants: display_name: "ASAN Ubuntu 18.04 Debug (MongoDB Latest)" expansions: build_type: "Debug" - extra_path: *linux_extra_path cmake_flags: *asan_cmake_flags test_params: *asan_test_params mongodb_version: "latest" @@ -1914,7 +1914,6 @@ buildvariants: display_name: "ASAN Ubuntu 18.04 Debug (MongoDB 5.0)" expansions: build_type: "Debug" - extra_path: *linux_extra_path cmake_flags: *asan_cmake_flags test_params: *asan_test_params mongodb_version: "5.0" @@ -1934,7 +1933,6 @@ buildvariants: display_name: "UBSAN Ubuntu 18.04 Debug (MongoDB Latest)" expansions: build_type: "Debug" - extra_path: *linux_extra_path cmake_flags: *ubsan_cmake_flags test_params: *ubsan_test_params mongodb_version: "latest" @@ -1955,7 +1953,6 @@ buildvariants: display_name: "UBSAN Ubuntu 18.04 Debug (MongoDB 5.0)" expansions: build_type: "Debug" - extra_path: *linux_extra_path cmake_flags: *ubsan_cmake_flags test_params: *ubsan_test_params mongodb_version: "5.0" @@ -2166,7 +2163,6 @@ buildvariants: display_name: "MacOS 11.0 Release (Boost) (MongoDB Latest)" expansions: build_type: "Release" - extra_path: *macos_extra_path cmake_flags: *macos_cmake_flags poly_flags: -DBSONCXX_POLY_USE_BOOST=ON mongodb_version: "latest" @@ -2182,7 +2178,6 @@ buildvariants: display_name: "MacOS 11.0 Release (Boost) (MongoDB 5.0)" expansions: build_type: "Release" - extra_path: *macos_extra_path cmake_flags: *macos_cmake_flags poly_flags: -DBSONCXX_POLY_USE_BOOST=ON mongodb_version: "5.0" @@ -2198,7 +2193,6 @@ buildvariants: display_name: "MacOS 11.0 Release Versioned API" expansions: build_type: "Release" - extra_path: *macos_extra_path cmake_flags: *macos_cmake_flags poly_flags: -DBSONCXX_POLY_USE_BOOST=ON mongodb_version: "latest" @@ -2212,7 +2206,6 @@ buildvariants: display_name: "Windows (VS 2015) Release (MongoDB 4.2)" expansions: build_type: "Release" - extra_path: *msvc2015_extra_path cmake_flags: *msvc2015_cmake_flags mongodb_version: "4.2" generator: *msvc2015_generator @@ -2229,7 +2222,6 @@ buildvariants: display_name: "Windows (VS 2015) Debug Static (MongoDB 4.2)" expansions: build_type: "Debug" - extra_path: *msvc2015_extra_path cmake_flags: *msvc2015_cmake_flags mongodb_version: "4.2" generator: *msvc2015_generator @@ -2244,7 +2236,6 @@ buildvariants: display_name: "Windows (VS 2015) Debug (MongoDB 4.2)" expansions: build_type: "Debug" - extra_path: *msvc2015_extra_path cmake_flags: *msvc2015_cmake_flags generator: *msvc2015_generator mongodb_version: "4.2" From 3ed5c9a35f108fafe597a6b8fed68c9d1d3825fe Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 24 Oct 2023 13:59:16 -0500 Subject: [PATCH 09/28] Substitute use of test param anchors with in-script variables --- .mci.yml | 60 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/.mci.yml b/.mci.yml index f588ad5e74..a7450dc538 100644 --- a/.mci.yml +++ b/.mci.yml @@ -29,12 +29,6 @@ variables: # power8_cmake_flags includes -Wno-maybe-uninitialized to ignore a warning from the std::optional implementation of MNMLSTC. power8_cmake_flags: &power8_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wconversion -Wnarrowing -Wno-expansion-to-defined -pedantic -Werror -Wno-missing-field-initializers -Wno-aligned-new $ignore_deprecated -Wno-error=maybe-uninitialized" - ## test parameters - test_params: - asan_test_params: &asan_test_params PATH="/usr/lib/llvm-3.8/bin" ASAN_OPTIONS="detect_leaks=1" - ubsan_test_params: &ubsan_test_params PATH="/usr/lib/llvm-3.8/bin" UBSAN_OPTIONS="print_stacktrace=1" - valgrind_test_params: &valgrind_test_params valgrind --leak-check=full --track-origins=yes --num-callers=50 --error-exitcode=1 --error-limit=no --read-var-info=yes --suppressions=../etc/memcheck.suppressions - integration_matrix: integration_matrix_tasks_single: &integration_matrix_tasks_single tasks: @@ -642,20 +636,32 @@ functions: echo "CRYPT_SHARED_LIB_PATH=$CRYPT_SHARED_LIB_PATH" fi - # Run tests and examples 1-by-1 with "test_params" so we can run them with valgrind. - ${test_params} ./src/bsoncxx/test/test_bson - ${test_params} ./src/mongocxx/test/test_driver - ${test_params} ./src/mongocxx/test/test_client_side_encryption_specs - ${test_params} ./src/mongocxx/test/test_crud_specs - ${test_params} ./src/mongocxx/test/test_gridfs_specs - ${test_params} ./src/mongocxx/test/test_command_monitoring_specs - ${test_params} ./src/mongocxx/test/test_instance - ${test_params} ./src/mongocxx/test/test_transactions_specs - ${test_params} ./src/mongocxx/test/test_logging - ${test_params} ./src/mongocxx/test/test_retryable_reads_specs - ${test_params} ./src/mongocxx/test/test_read_write_concern_specs - ${test_params} ./src/mongocxx/test/test_unified_format_spec + export ASAN_OPTIONS="detect_leaks=1" + export UBSAN_OPTIONS="print_stacktrace=1" + + run_test() { $@; } + + if [[ "${TEST_WITH_ASAN}" == "ON" || "${TEST_WITH_UBSAN}" == "ON" ]]; then + export PATH="/usr/lib/llvm-3.8/bin:$PATH" + elif [[ "${TEST_WITH_VALGRIND}" == "ON" ]]; then + run_test() { + valgrind --leak-check=full --track-origins=yes --num-callers=50 --error-exitcode=1 --error-limit=no --read-var-info=yes --suppressions=../etc/memcheck.suppressions $@ + } + fi + # Run tests and examples 1-by-1 with "run_test" so we can run them with valgrind. + run_test ./src/bsoncxx/test/test_bson + run_test ./src/mongocxx/test/test_driver + run_test ./src/mongocxx/test/test_client_side_encryption_specs + run_test ./src/mongocxx/test/test_crud_specs + run_test ./src/mongocxx/test/test_gridfs_specs + run_test ./src/mongocxx/test/test_command_monitoring_specs + run_test ./src/mongocxx/test/test_instance + run_test ./src/mongocxx/test/test_transactions_specs + run_test ./src/mongocxx/test/test_logging + run_test ./src/mongocxx/test/test_retryable_reads_specs + run_test ./src/mongocxx/test/test_read_write_concern_specs + run_test ./src/mongocxx/test/test_unified_format_spec # Some platforms like OS X don't support the /mode syntax to the -perm option # of find(1), and some platforms like Ubuntu 16.04 don't support the +mode @@ -685,7 +691,7 @@ functions: echo " - TODO CXX-1201, enable for servers that support transactions" ;; *) - if ! ${test_params} $test >|output.txt 2>&1; then + if ! run_test $test >|output.txt 2>&1; then # Only emit output on failure. cat output.txt 1>&2 exit 1 @@ -724,7 +730,7 @@ functions: fi fi # The example projects never run under valgrind, since we haven't added execution - # logic to handle ${test_params}. + # logic to handle `run_test()`. # # Only run example projects if MONGODB_API_VERSION is unset. We do not append # API version to example clients, so example projects will fail when requireApiVersion @@ -1862,7 +1868,7 @@ buildvariants: expansions: build_type: "Debug" cmake_flags: *linux_cmake_flags - test_params: *valgrind_test_params + TEST_WITH_VALGRIND: "ON" mongodb_version: "latest" disable_slow_tests: 1 use_mongocryptd: true # false positives arise from the crypt_shared library @@ -1879,7 +1885,7 @@ buildvariants: expansions: build_type: "Debug" cmake_flags: *linux_cmake_flags - test_params: *valgrind_test_params + TEST_WITH_VALGRIND: "ON" mongodb_version: "5.0" disable_slow_tests: 1 use_mongocryptd: true @@ -1896,7 +1902,7 @@ buildvariants: expansions: build_type: "Debug" cmake_flags: *asan_cmake_flags - test_params: *asan_test_params + TEST_WITH_ASAN: "ON" mongodb_version: "latest" example_projects_cc: /usr/bin/clang example_projects_cxx: /usr/bin/clang++ @@ -1915,7 +1921,7 @@ buildvariants: expansions: build_type: "Debug" cmake_flags: *asan_cmake_flags - test_params: *asan_test_params + TEST_WITH_ASAN: "ON" mongodb_version: "5.0" example_projects_cc: /usr/bin/clang example_projects_cxx: /usr/bin/clang++ @@ -1934,7 +1940,7 @@ buildvariants: expansions: build_type: "Debug" cmake_flags: *ubsan_cmake_flags - test_params: *ubsan_test_params + TEST_WITH_UBSAN: "ON" mongodb_version: "latest" example_projects_cc: /usr/bin/clang example_projects_cxx: /usr/bin/clang++ @@ -1954,7 +1960,7 @@ buildvariants: expansions: build_type: "Debug" cmake_flags: *ubsan_cmake_flags - test_params: *ubsan_test_params + TEST_WITH_UBSAN: "ON" mongodb_version: "5.0" example_projects_cc: /usr/bin/clang example_projects_cxx: /usr/bin/clang++ From 8f83716356efd037498134a9b51e49e187327c39 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 24 Oct 2023 13:59:27 -0500 Subject: [PATCH 10/28] Substitute use of code coverage anchor with in-script variables --- .mci.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.mci.yml b/.mci.yml index a7450dc538..39898e7815 100644 --- a/.mci.yml +++ b/.mci.yml @@ -24,7 +24,6 @@ variables: msvc2015_generator: &msvc2015_generator Visual Studio 14 2015 Win64 msvc2017_cmake_flags: &msvc2017_cmake_flags -DCMAKE_CXX_STANDARD=17 msvc2017_generator: &msvc2017_generator Visual Studio 15 2017 Win64 - code_coverage_cmake_flags: &code_coverage_cmake_flags -DENABLE_CODE_COVERAGE=ON # power8_cmake_flags includes -Wno-maybe-uninitialized to ignore a warning from the std::optional implementation of MNMLSTC. power8_cmake_flags: &power8_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wconversion -Wnarrowing -Wno-expansion-to-defined -pedantic -Werror -Wno-missing-field-initializers -Wno-aligned-new $ignore_deprecated -Wno-error=maybe-uninitialized" @@ -55,7 +54,7 @@ variables: integration_matrix_expansions_linux: &integration_matrix_expansions_linux build_type: "Debug" cmake_flags: *linux_cmake_flags - code_coverage_cmake_flags: *code_coverage_cmake_flags + ENABLE_CODE_COVERAGE: ON integration_matrix_expansions_windows: &integration_matrix_expansions_windows cmake_flags: *msvc2017_cmake_flags build_type: "Debug" # Same for Windows and Linux @@ -376,7 +375,12 @@ functions: fi export PATH - ADDL_OPTS=${code_coverage_cmake_flags} + ADDL_OPTS="" + + if [[ "${ENABLE_CODE_COVERAGE}" == "ON" ]]; then + ADDL_OPTS+="-DENABLE_CODE_COVERAGE=ON" + fi + if [ "${USE_STATIC_LIBS}" ]; then ADDL_OPTS="$ADDL_OPTS -DBUILD_SHARED_LIBS=OFF" fi @@ -831,7 +835,7 @@ functions: set -o pipefail # Nothing to do if code coverage was not enabled. - if [[ -z "${code_coverage_cmake_flags}" ]]; then + if [[ "${ENABLE_CODE_COVERAGE}" != "ON" ]]; then exit 0 fi From fca7aeffcf78cbf5f2ecf35a04d8a49217d5f830 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 25 Oct 2023 12:01:30 -0500 Subject: [PATCH 11/28] Remove Make-dependent commands in distcheck routines --- cmake/make_dist/MakeDistCheck.cmake | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/cmake/make_dist/MakeDistCheck.cmake b/cmake/make_dist/MakeDistCheck.cmake index d3647d2585..464c843ba8 100644 --- a/cmake/make_dist/MakeDistCheck.cmake +++ b/cmake/make_dist/MakeDistCheck.cmake @@ -16,14 +16,6 @@ function (RUN_DIST_CHECK PACKAGE_PREFIX EXT) set (TAR_OPTION "jxf") endif () - set (MY_CMAKE_COMMAND "") - set (MY_CMAKE_COMMAND ${CMAKE_COMMAND} -E env) - - find_program (MAKE_COMMAND NAMES make gmake) - if (${MAKE_COMMAND} STREQUAL "MAKE_COMMAND-NOTFOUND") - message (FATAL_ERROR "Can't find the 'make' or 'gmake' program.") - endif () - execute_process_and_check_result ( COMMAND ${CMAKE_COMMAND} -E tar ${TAR_OPTION} ${tarball} WORKING_DIRECTORY . @@ -56,7 +48,7 @@ function (RUN_DIST_CHECK PACKAGE_PREFIX EXT) endif () separate_arguments (build_opts) execute_process_and_check_result ( - COMMAND ${MY_CMAKE_COMMAND} ${MAKE_COMMAND} ${build_opts} + COMMAND ${CMAKE_COMMAND} --build . -- ${build_opts} WORKING_DIRECTORY ${BUILD_DIR} ERROR_MSG "Make build failed." ) @@ -65,14 +57,14 @@ function (RUN_DIST_CHECK PACKAGE_PREFIX EXT) set (install_opts $ENV{DISTCHECK_INSTALL_OPTS}) separate_arguments (install_opts) execute_process_and_check_result ( - COMMAND ${MY_CMAKE_COMMAND} ${MAKE_COMMAND} install ${install_opts} + COMMAND ${CMAKE_COMMAND} --build . --target install -- ${install_opts} WORKING_DIRECTORY ${BUILD_DIR} ERROR_MSG "Make install failed." ) # Run make dist execute_process_and_check_result ( - COMMAND ${MY_CMAKE_COMMAND} ${MAKE_COMMAND} dist + COMMAND ${CMAKE_COMMAND} --build . --target dist WORKING_DIRECTORY ${BUILD_DIR} ERROR_MSG "Make dist failed." ) From 81d67f6c1ae8079a16450a5c9f1d09675da4de6a Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 25 Oct 2023 13:52:18 -0500 Subject: [PATCH 12/28] Ensure distcheck is configured with correct polyfill library --- .evergreen/compile.sh | 2 +- cmake/make_dist/MakeDistCheck.cmake | 32 +++++++++++++++++++---------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/.evergreen/compile.sh b/.evergreen/compile.sh index 4a8d07372d..98443e98db 100755 --- a/.evergreen/compile.sh +++ b/.evergreen/compile.sh @@ -65,5 +65,5 @@ fi "${cmake_binary}" --build . --config $BUILD_TYPE --target $CMAKE_EXAMPLES_TARGET -- $CMAKE_BUILD_OPTS if [ "$_RUN_DISTCHECK" ]; then - DISTCHECK_BUILD_OPTS="-j$CONCURRENCY" "${cmake_binary}" --build . --config $BUILD_TYPE --target distcheck + "${cmake_binary}" --build . --config $BUILD_TYPE --target distcheck fi diff --git a/cmake/make_dist/MakeDistCheck.cmake b/cmake/make_dist/MakeDistCheck.cmake index 464c843ba8..eca454be42 100644 --- a/cmake/make_dist/MakeDistCheck.cmake +++ b/cmake/make_dist/MakeDistCheck.cmake @@ -28,36 +28,46 @@ function (RUN_DIST_CHECK PACKAGE_PREFIX EXT) file (MAKE_DIRECTORY ${BUILD_DIR} ${INSTALL_DIR}) + # Ensure distcheck inherits polyfill library selection. + set(polyfill_flags "") + if (NOT "${CMAKE_CXX_STANDARD}" STREQUAL "") + list(APPEND polyfill_flags "-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}") + endif () + if (NOT "${BOOST_ROOT}" STREQUAL "") + list(APPEND polyfill_flags "-DBOOST_ROOT=${BOOST_ROOT}") + endif () + + execute_process_and_check_result ( + COMMAND ${CMAKE_COMMAND} -E echo "Configuring distcheck with CMake flags: ${polyfill_flags}" + WORKING_DIRECTORY . + ERROR_MSG "Failed to echo polyfill flags" + ) + execute_process_and_check_result ( COMMAND ${CMAKE_COMMAND} + -S ../${PACKAGE_PREFIX} + -B . -DCMAKE_BUILD_TYPE=Release -DMONGOCXX_ENABLE_SLOW_TESTS=ON -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DCMAKE_INSTALL_PREFIX=../${INSTALL_DIR} - -DMONGOCXX_ENABLE_SLOW_TESTS=ON - ../${PACKAGE_PREFIX} + ${polyfill_flags} + WORKING_DIRECTORY ${BUILD_DIR} ERROR_MSG "CMake configure command failed." ) # Run make in the build directory - if (DEFINED ENV{DISTCHECK_BUILD_OPTS}) - set (build_opts $ENV{DISTCHECK_BUILD_OPTS}) - else () - set (build_opts "-j 8") - endif () separate_arguments (build_opts) execute_process_and_check_result ( - COMMAND ${CMAKE_COMMAND} --build . -- ${build_opts} + COMMAND ${CMAKE_COMMAND} --build . WORKING_DIRECTORY ${BUILD_DIR} ERROR_MSG "Make build failed." ) # Run make install - set (install_opts $ENV{DISTCHECK_INSTALL_OPTS}) - separate_arguments (install_opts) execute_process_and_check_result ( - COMMAND ${CMAKE_COMMAND} --build . --target install -- ${install_opts} + COMMAND ${CMAKE_COMMAND} --build . --target install WORKING_DIRECTORY ${BUILD_DIR} ERROR_MSG "Make install failed." ) From 1199f1dad3a1dd36a665f60d4544ae5fef70ded3 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 26 Oct 2023 14:02:53 -0500 Subject: [PATCH 13/28] CXX-2772 Move ubuntu1804 MongoDB Latest and 7.0 tasks to ubuntu2004 --- .mci.yml | 118 ++++++++++++++++++++++++------------------------------- 1 file changed, 51 insertions(+), 67 deletions(-) diff --git a/.mci.yml b/.mci.yml index 39898e7815..a3252b295b 100644 --- a/.mci.yml +++ b/.mci.yml @@ -886,6 +886,7 @@ post: tasks: - name: lint + run_on: ubuntu1804-large commands: - func: "setup" - func: "lint" @@ -1338,17 +1339,17 @@ buildvariants: ####################################### # Standard MongoDB Integration Tests # ####################################### - - name: integration-ubuntu1804-latest-single - display_name: "Ubuntu 18.04 Debug (MongoDB Latest)" - run_on: ubuntu1804-large + - name: integration-ubuntu2004-latest-single + display_name: "Ubuntu 20.04 Debug (MongoDB Latest)" + run_on: ubuntu2004-large expansions: mongodb_version: "latest" <<: *integration_matrix_expansions_linux <<: *integration_matrix_tasks_single - - name: integration-ubuntu1804-7.0-single - display_name: "Ubuntu 18.04 Debug (MongoDB 7.0)" - run_on: ubuntu1804-large + - name: integration-ubuntu2004-7.0-single + display_name: "Ubuntu 20.04 Debug (MongoDB 7.0)" + run_on: ubuntu2004-large expansions: mongodb_version: "7.0" <<: *integration_matrix_expansions_linux @@ -1450,17 +1451,17 @@ buildvariants: <<: *integration_matrix_expansions_windows <<: *integration_matrix_tasks_single - - name: integration-ubuntu1804-latest-replica - display_name: "Ubuntu 18.04 Debug replica set (MongoDB Latest)" - run_on: ubuntu1804-large + - name: integration-ubuntu2004-latest-replica + display_name: "Ubuntu 20.04 Debug replica set (MongoDB Latest)" + run_on: ubuntu2004-large expansions: mongodb_version: "latest" <<: *integration_matrix_expansions_linux <<: *integration_matrix_tasks_replica - - name: integration-ubuntu1804-7.0-replica - display_name: "Ubuntu 18.04 Debug replica set (MongoDB 7.0)" - run_on: ubuntu1804-large + - name: integration-ubuntu2004-7.0-replica + display_name: "Ubuntu 20.04 Debug replica set (MongoDB 7.0)" + run_on: ubuntu2004-large expansions: mongodb_version: "7.0" <<: *integration_matrix_expansions_linux @@ -1506,17 +1507,17 @@ buildvariants: <<: *integration_matrix_expansions_linux <<: *integration_matrix_tasks_replica - - name: integration-ubuntu1804-latest-sharded - display_name: "Ubuntu 18.04 Debug sharded cluster (MongoDB Latest)" - run_on: ubuntu1804-large + - name: integration-ubuntu2004-latest-sharded + display_name: "Ubuntu 20.04 Debug sharded cluster (MongoDB Latest)" + run_on: ubuntu2004-large expansions: mongodb_version: "latest" <<: *integration_matrix_expansions_linux <<: *integration_matrix_tasks_sharded - - name: integration-ubuntu1804-7.0-sharded - display_name: "Ubuntu 18.04 Debug sharded cluster (MongoDB 7.0)" - run_on: ubuntu1804-large + - name: integration-ubuntu2004-7.0-sharded + display_name: "Ubuntu 20.04 Debug sharded cluster (MongoDB 7.0)" + run_on: ubuntu2004-large expansions: mongodb_version: "7.0" <<: *integration_matrix_expansions_linux @@ -1562,9 +1563,9 @@ buildvariants: <<: *integration_matrix_expansions_linux <<: *integration_matrix_tasks_sharded - - name: integration-auth-ubuntu1804-latest-single - display_name: "Ubuntu 18.04 Debug Latest Auth" - run_on: ubuntu1804-large + - name: integration-auth-ubuntu2004-latest-single + display_name: "Ubuntu 20.04 Debug Latest Auth" + run_on: ubuntu2004-large expansions: mongodb_version: "latest" <<: *integration_matrix_expansions_linux @@ -1578,9 +1579,9 @@ buildvariants: <<: *integration_matrix_expansions_windows <<: *integration_matrix_auth_tasks_single - - name: integration-versioned-api-ubuntu1804-latest-single - display_name: "Ubuntu 18.04 Debug Latest Versioned API" - run_on: ubuntu1804-large + - name: integration-versioned-api-ubuntu2004-latest-single + display_name: "Ubuntu 20.04 Debug Latest Versioned API" + run_on: ubuntu2004-large expansions: mongodb_version: "latest" <<: *integration_matrix_expansions_linux @@ -1594,9 +1595,9 @@ buildvariants: <<: *integration_matrix_expansions_windows <<: *integration_matrix_versioned_api_tasks_single - - name: integration-mongocryptd-ubuntu1804-latest - display_name: "Ubuntu 18.04 Debug (MongoDB Latest) with mongocryptd" - run_on: ubuntu1804-large + - name: integration-mongocryptd-ubuntu2004-latest + display_name: "Ubuntu 20.04 Debug (MongoDB Latest) with mongocryptd" + run_on: ubuntu2004-large expansions: mongodb_version: "latest" use_mongocryptd: true @@ -1807,27 +1808,6 @@ buildvariants: - ubuntu2004-large - name: uninstall_check - - name: ubuntu1804-release-latest - display_name: "Ubuntu 18.04 Release (MongoDB Latest)" - expansions: - build_type: "Release" - cmake_flags: *linux_cmake_flags - mongodb_version: "latest" - run_on: - - ubuntu1804-build - tasks: - - name: lint - - name: compile_and_test_with_shared_libs - - name: compile_and_test_with_shared_libs_extra_alignment - - name: compile_and_test_with_static_libs - - name: compile_and_test_with_static_libs_extra_alignment - - name: compile_and_test_with_shared_libs_replica_set_with_libmongocrypt - - name: compile_and_test_with_shared_libs_sharded_cluster_with_libmongocrypt - - name: build_example_with_add_subdirectory - distros: - - ubuntu1804-build - - name: uninstall_check - - name: ubuntu1804-release-50 display_name: "Ubuntu 18.04 Release (MongoDB 5.0)" expansions: @@ -1867,8 +1847,8 @@ buildvariants: - name: compile_and_test_with_static_libs - name: compile_and_test_with_static_libs_extra_alignment - - name: ubuntu1804-debug-valgrind-latest - display_name: "Valgrind Ubuntu 18.04 Debug (MongoDB Latest)" + - name: ubuntu2004-debug-valgrind-latest + display_name: "Valgrind Ubuntu 20.04 Debug (MongoDB Latest)" expansions: build_type: "Debug" cmake_flags: *linux_cmake_flags @@ -1877,7 +1857,7 @@ buildvariants: disable_slow_tests: 1 use_mongocryptd: true # false positives arise from the crypt_shared library run_on: - - ubuntu1804-build + - ubuntu2004-build tasks: - name: compile_and_test_with_shared_libs - name: compile_and_test_with_shared_libs_extra_alignment @@ -1901,8 +1881,8 @@ buildvariants: - name: compile_and_test_with_static_libs - name: compile_and_test_with_static_libs_extra_alignment - - name: ubuntu1804-debug-asan-latest - display_name: "ASAN Ubuntu 18.04 Debug (MongoDB Latest)" + - name: ubuntu2004-debug-asan-latest + display_name: "ASAN Ubuntu 20.04 Debug (MongoDB Latest)" expansions: build_type: "Debug" cmake_flags: *asan_cmake_flags @@ -1913,7 +1893,7 @@ buildvariants: example_projects_cxxflags: -D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=address -fno-omit-frame-pointer example_projects_ldflags: -fsanitize=address run_on: - - ubuntu1804-build + - ubuntu2004-build tasks: - name: compile_and_test_with_shared_libs - name: compile_and_test_with_shared_libs_extra_alignment @@ -1939,8 +1919,8 @@ buildvariants: - name: compile_and_test_with_static_libs - name: compile_and_test_with_static_libs_extra_alignment - - name: ubuntu1804-debug-ubsan-latest - display_name: "UBSAN Ubuntu 18.04 Debug (MongoDB Latest)" + - name: ubuntu2004-debug-ubsan-latest + display_name: "UBSAN Ubuntu 20.04 Debug (MongoDB Latest)" expansions: build_type: "Debug" cmake_flags: *ubsan_cmake_flags @@ -1951,7 +1931,7 @@ buildvariants: example_projects_cxxflags: -D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=undefined -fno-sanitize-recover=undefined -fno-omit-frame-pointer example_projects_ldflags: -fsanitize=undefined -fno-sanitize-recover=undefined run_on: - - ubuntu1804-build + - ubuntu2004-build tasks: # We currently don't run UBSAN on the shared library due to issues with UBSAN reporting # numerous false positive instances of undefined behavior in the mock tests, when the @@ -1979,14 +1959,14 @@ buildvariants: # signature. - name: compile_and_test_with_static_libs - - name: ubuntu1804-debug - display_name: "Ubuntu 18.04 Debug (MongoDB Latest) (Extra)" + - name: ubuntu2004-debug + display_name: "Ubuntu 20.04 Debug (MongoDB Latest) (Extra)" expansions: build_type: "Debug" cmake_flags: *linux_cmake_flags mongodb_version: "latest" run_on: - - ubuntu1804-build + - ubuntu2004-build tasks: - name: clang-tidy - name: compile_without_tests @@ -2025,7 +2005,7 @@ buildvariants: build_type: "Release" cmake_flags: *linux_cmake_flags mongodb_version: "latest" - run_on: ubuntu1804-test + run_on: ubuntu2004-test tasks: - name: test_mongohouse @@ -2119,15 +2099,15 @@ buildvariants: - name: compile_and_test_with_static_libs - name: compile_and_test_with_static_libs_extra_alignment - - name: arm-ubuntu1804-latest - display_name: "arm64 Ubuntu 18.04 (MongoDB Latest)" + - name: arm-ubuntu2004-latest + display_name: "arm64 Ubuntu 20.04 (MongoDB Latest)" batchtime: 1440 # 1 day expansions: build_type: "Release" cmake_flags: *linux_cmake_flags mongodb_version: "latest" run_on: - - ubuntu1804-arm64-build + - ubuntu2004-arm64-build tasks: - name: compile_and_test_with_shared_libs - name: compile_and_test_with_shared_libs_extra_alignment @@ -2150,8 +2130,8 @@ buildvariants: - name: compile_and_test_with_static_libs_extra_alignment # Test that we actually support building against the minimum required C version claimed. - - name: ubuntu1804-min-libmongoc - display_name: "Ubuntu 18.04 with minimum libmongoc (MongoDB Latest)" + - name: ubuntu2004-min-libmongoc + display_name: "Ubuntu 20.04 with minimum libmongoc (MongoDB Latest)" batchtime: 1440 # 1 day expansions: build_type: "Debug" @@ -2159,7 +2139,7 @@ buildvariants: mongodb_version: "latest" mongoc_version: *mongoc_version_minimum run_on: - - ubuntu1804-build + - ubuntu2004-build tasks: - name: compile_and_test_with_shared_libs - name: compile_and_test_with_shared_libs_extra_alignment @@ -2264,3 +2244,7 @@ buildvariants: - name: rpm-package-build distros: - rhel90-arm64-small + + - name: lint + display_name: Lint + tasks: [lint] From 7c147d8305b55d034b708b2db3c953d89fde1c3c Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 26 Oct 2023 14:04:35 -0500 Subject: [PATCH 14/28] Remove redundant use of distros field in variant task list --- .mci.yml | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/.mci.yml b/.mci.yml index a3252b295b..8d6c3b1247 100644 --- a/.mci.yml +++ b/.mci.yml @@ -1159,6 +1159,7 @@ tasks: ./build/hello_mongocxx - name: debian-package-build + run_on: ubuntu1804-test commands: - func: "setup" - command: shell.exec @@ -1182,6 +1183,7 @@ tasks: display_name: "deb.tar.gz" - name: debian-package-build-mnmlstc + run_on: ubuntu1804-test commands: - func: "setup" - command: shell.exec @@ -1206,6 +1208,7 @@ tasks: display_name: "deb.tar.gz" - name: rpm-package-build + run_on: rhel90-arm64-small commands: - func: "setup" - command: shell.exec @@ -1659,8 +1662,6 @@ buildvariants: - name: compile_and_test_with_shared_libs_replica_set_with_libmongocrypt - name: compile_and_test_with_shared_libs_sharded_cluster_with_libmongocrypt - name: build_example_with_add_subdirectory - distros: - - rhel90-large - name: arm-rhel9-release-latest display_name: "arm64 RHEL 9 Release (MongoDB Latest)" @@ -1681,8 +1682,6 @@ buildvariants: - name: compile_and_test_with_shared_libs_replica_set_with_libmongocrypt - name: compile_and_test_with_shared_libs_sharded_cluster_with_libmongocrypt - name: build_example_with_add_subdirectory - distros: - - rhel90-arm64-large - name: debian11-release-latest display_name: "Debian 11 Release (MongoDB Latest)" @@ -1702,8 +1701,6 @@ buildvariants: - name: compile_and_test_with_shared_libs_replica_set_with_libmongocrypt - name: compile_and_test_with_shared_libs_sharded_cluster_with_libmongocrypt - name: build_example_with_add_subdirectory - distros: - - debian11-large - name: uninstall_check - name: debian11-release-50 @@ -1724,8 +1721,6 @@ buildvariants: - name: compile_and_test_with_shared_libs_replica_set - name: compile_and_test_with_shared_libs_sharded_cluster - name: build_example_with_add_subdirectory - distros: - - debian11-large - name: uninstall_check - name: debian10-release-latest @@ -1744,8 +1739,6 @@ buildvariants: - name: compile_and_test_with_shared_libs_replica_set_with_libmongocrypt - name: compile_and_test_with_shared_libs_sharded_cluster_with_libmongocrypt - name: build_example_with_add_subdirectory - distros: - - debian10-large - name: uninstall_check - name: debian10-release-50 @@ -1764,8 +1757,6 @@ buildvariants: - name: compile_and_test_with_shared_libs_replica_set - name: compile_and_test_with_shared_libs_sharded_cluster - name: build_example_with_add_subdirectory - distros: - - debian10-large - name: uninstall_check - name: ubuntu2004-release-latest @@ -1784,8 +1775,6 @@ buildvariants: - name: compile_and_test_with_shared_libs_replica_set_with_libmongocrypt - name: compile_and_test_with_shared_libs_sharded_cluster_with_libmongocrypt - name: build_example_with_add_subdirectory - distros: - - ubuntu2004-large - name: uninstall_check - name: ubuntu2004-release-50 @@ -1804,8 +1793,6 @@ buildvariants: - name: compile_and_test_with_shared_libs_replica_set - name: compile_and_test_with_shared_libs_sharded_cluster - name: build_example_with_add_subdirectory - distros: - - ubuntu2004-large - name: uninstall_check - name: ubuntu1804-release-50 @@ -1824,8 +1811,6 @@ buildvariants: - name: compile_and_test_with_shared_libs_replica_set - name: compile_and_test_with_shared_libs_sharded_cluster - name: build_example_with_add_subdirectory - distros: - - ubuntu1804-build - name: uninstall_check # TODO CXX-2260 Upgrade std::experimental tasks to use Ubuntu 18.04 and mongodb_latest @@ -2237,13 +2222,10 @@ buildvariants: - name: packaging display_name: Linux Distro Packaging - run_on: ubuntu1804-test tasks: - name: debian-package-build - name: debian-package-build-mnmlstc - name: rpm-package-build - distros: - - rhel90-arm64-small - name: lint display_name: Lint From 1791da73df3cd6fdb6b5398bfc64837c6e971ad0 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 26 Oct 2023 17:23:54 -0500 Subject: [PATCH 15/28] Remove obsolete -Wno-aligned-new warning from compile flags --- .mci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.mci.yml b/.mci.yml index 8d6c3b1247..c56b9041ba 100644 --- a/.mci.yml +++ b/.mci.yml @@ -16,7 +16,7 @@ variables: ## cmake flag variables cmake_flags: - linux_cmake_flags: &linux_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wconversion -Wnarrowing -Wno-expansion-to-defined -pedantic -Werror -Wno-missing-field-initializers -Wno-aligned-new $ignore_deprecated" + linux_cmake_flags: &linux_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wconversion -Wnarrowing -Wno-expansion-to-defined -pedantic -Werror -Wno-missing-field-initializers $ignore_deprecated" macos_cmake_flags: &macos_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-stdlib=libc++ -Wall -Wextra -Wconversion -Wnarrowing -pedantic -Werror $ignore_deprecated" asan_cmake_flags: &asan_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_COMPILER="/usr/bin/clang++" -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=address -O1 -g -fno-omit-frame-pointer -Wall -Wextra -Wconversion -Wnarrowing -pedantic -Werror $ignore_deprecated" ubsan_cmake_flags: &ubsan_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_COMPILER="/usr/bin/clang++" -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=undefined -fsanitize-blacklist=$(pwd)/etc/ubsan.ignorelist -fno-sanitize-recover=undefined -O1 -g -fno-omit-frame-pointer -Wall -Wextra -Wconversion -Wnarrowing -pedantic -Werror $ignore_deprecated" @@ -26,7 +26,7 @@ variables: msvc2017_generator: &msvc2017_generator Visual Studio 15 2017 Win64 # power8_cmake_flags includes -Wno-maybe-uninitialized to ignore a warning from the std::optional implementation of MNMLSTC. - power8_cmake_flags: &power8_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wconversion -Wnarrowing -Wno-expansion-to-defined -pedantic -Werror -Wno-missing-field-initializers -Wno-aligned-new $ignore_deprecated -Wno-error=maybe-uninitialized" + power8_cmake_flags: &power8_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wconversion -Wnarrowing -Wno-expansion-to-defined -pedantic -Werror -Wno-missing-field-initializers $ignore_deprecated -Wno-error=maybe-uninitialized" integration_matrix: integration_matrix_tasks_single: &integration_matrix_tasks_single From ceb686d4cfddb10d2bcf608e24b91a20c76038a5 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 26 Oct 2023 15:41:28 -0500 Subject: [PATCH 16/28] Update clang-tidy task --- .mci.yml | 13 ++++++----- etc/run-clang-tidy.sh | 54 +++++++++++++++++++++++++++++++++++++------ 2 files changed, 54 insertions(+), 13 deletions(-) diff --git a/.mci.yml b/.mci.yml index c56b9041ba..577ce68716 100644 --- a/.mci.yml +++ b/.mci.yml @@ -289,10 +289,12 @@ functions: params: shell: bash working_dir: "mongo-cxx-driver" - script: | - set -o errexit - set -o pipefail - ./etc/run-clang-tidy.sh + include_expansions_in_env: + - distro_id + env: + CC: ${cc_compiler} + CXX: ${cxx_compiler} + script: ./etc/run-clang-tidy.sh "clone_drivers-evergreen-tools": - command: shell.exec @@ -894,8 +896,7 @@ tasks: - name: clang-tidy commands: - func: "setup" - - func: "fetch_c_driver_source" - - func: "compile" + - func: "install_c_driver" - func: "clang-tidy" - name: compile_and_test_with_shared_libs diff --git a/etc/run-clang-tidy.sh b/etc/run-clang-tidy.sh index 09189af16d..e1e6c3b069 100755 --- a/etc/run-clang-tidy.sh +++ b/etc/run-clang-tidy.sh @@ -1,11 +1,40 @@ #!/usr/bin/env bash + set -o errexit +set -o pipefail + +if [[ "${distro_id:?}" != ubuntu* ]]; then + echo "run-clang-tidy.sh expects to be run on an Ubuntu distro!" 1>&2 + exit 1 +fi -if ! which clang-tidy > /dev/null; then - sudo apt-get install -y clang-tidy +if ! command -V parallel >/dev/null; then + sudo apt-get install -q -y parallel +fi + +if ! command -V clang-tidy >/dev/null; then + sudo apt-get install -q -y clang-tidy fi clang-tidy -version +. ../mongoc/.evergreen/scripts/find-cmake-latest.sh +cmake_binary="$(find_cmake_latest)" +command -v "${cmake_binary:?}" + +cmake_config_flags=( + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + -DCMAKE_BUILD_TYPE=Debug + -DCMAKE_PREFIX_PATH="$(pwd)/../mongoc" # Avoid downloading C Driver. + -DCMAKE_CXX_STANDARD=17 # Avoid downloading mnmlstc/core. +) + +# Generate the compilation database file. +"${cmake_binary:?}" -S . -B build "${cmake_config_flags[@]}" + +# Some files (i.e. headers) may need to be generated during the build step. +CMAKE_BUILD_PARALLEL_LEVEL="$(nproc)" \ + "${cmake_binary:?}" --build build + # # Each check has a name and the checks to run can be chosen using the -checks= option, which specifies a comma-separated # list of positive and negative (prefixed with -) globs. For example: @@ -20,11 +49,22 @@ clang-tidy -version # # see https://clang.llvm.org/extra/clang-tidy # -CMD="clang-tidy -p=build" echo "Running clang-tidy with configuration:" -eval $CMD -dump-config +clang-tidy -p=build -dump-config + +find_args=( + -type f + \( -name *.hh -o -name *.hpp -o -name *.cpp \) # All sources including headers. + -not -path "*/third_party/*" # Excluding third party headers. + -not -path "*/config/*.hpp" # Excluding config headers. + -not -path "*bsoncxx/v_noabi/bsoncxx/enums/*.hpp" # Excluding X macro headers. +) + +echo "Scanning the following files:" +find src "${find_args[@]}" -# all source and header files, excluding third party libraries -FIND="find src -type f \( -name \*.hh -o -name \*.hpp -o -name \*.cpp \) -not -path \"*third_party*\"" -eval $FIND | xargs $CMD +# TODO: update clang-tidy config and address warnings. +{ + find src "${find_args[@]}" | parallel clang-tidy --quiet -p=build {} 2>/dev/null +} || true From e07fabf9bd9549c0fe958493f49a27ec947b3e6c Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 26 Oct 2023 16:33:57 -0500 Subject: [PATCH 17/28] Move clang-tidy task to Clang variant --- .mci.yml | 2 +- etc/run-clang-tidy.sh | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.mci.yml b/.mci.yml index 577ce68716..fe186ed5de 100644 --- a/.mci.yml +++ b/.mci.yml @@ -1954,7 +1954,6 @@ buildvariants: run_on: - ubuntu2004-build tasks: - - name: clang-tidy - name: compile_without_tests - name: compile_macro_guard_tests - name: test_atlas_task_group_search_indexes @@ -1982,6 +1981,7 @@ buildvariants: run_on: - ubuntu2204-small tasks: + - name: clang-tidy - name: compile_without_tests - name: compile_macro_guard_tests diff --git a/etc/run-clang-tidy.sh b/etc/run-clang-tidy.sh index e1e6c3b069..e0a963c4f6 100755 --- a/etc/run-clang-tidy.sh +++ b/etc/run-clang-tidy.sh @@ -32,8 +32,7 @@ cmake_config_flags=( "${cmake_binary:?}" -S . -B build "${cmake_config_flags[@]}" # Some files (i.e. headers) may need to be generated during the build step. -CMAKE_BUILD_PARALLEL_LEVEL="$(nproc)" \ - "${cmake_binary:?}" --build build +CMAKE_BUILD_PARALLEL_LEVEL="$(nproc)" "${cmake_binary:?}" --build build # # Each check has a name and the checks to run can be chosen using the -checks= option, which specifies a comma-separated From 3d74e3f2c694e198fefdadb7f89b4d63b80111c0 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 26 Oct 2023 16:37:48 -0500 Subject: [PATCH 18/28] Fix GCC vs. Clang compiler selection via env vars --- .mci.yml | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/.mci.yml b/.mci.yml index fe186ed5de..4182cc548c 100644 --- a/.mci.yml +++ b/.mci.yml @@ -18,8 +18,8 @@ variables: cmake_flags: linux_cmake_flags: &linux_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wconversion -Wnarrowing -Wno-expansion-to-defined -pedantic -Werror -Wno-missing-field-initializers $ignore_deprecated" macos_cmake_flags: &macos_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-stdlib=libc++ -Wall -Wextra -Wconversion -Wnarrowing -pedantic -Werror $ignore_deprecated" - asan_cmake_flags: &asan_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_COMPILER="/usr/bin/clang++" -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=address -O1 -g -fno-omit-frame-pointer -Wall -Wextra -Wconversion -Wnarrowing -pedantic -Werror $ignore_deprecated" - ubsan_cmake_flags: &ubsan_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_COMPILER="/usr/bin/clang++" -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=undefined -fsanitize-blacklist=$(pwd)/etc/ubsan.ignorelist -fno-sanitize-recover=undefined -O1 -g -fno-omit-frame-pointer -Wall -Wextra -Wconversion -Wnarrowing -pedantic -Werror $ignore_deprecated" + asan_cmake_flags: &asan_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=address -O1 -g -fno-omit-frame-pointer -Wall -Wextra -Wconversion -Wnarrowing -pedantic -Werror $ignore_deprecated" + ubsan_cmake_flags: &ubsan_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=undefined -fsanitize-blacklist=$(pwd)/etc/ubsan.ignorelist -fno-sanitize-recover=undefined -O1 -g -fno-omit-frame-pointer -Wall -Wextra -Wconversion -Wnarrowing -pedantic -Werror $ignore_deprecated" msvc2015_cmake_flags: &msvc2015_cmake_flags -DBOOST_ROOT=c:/local/boost_1_60_0 msvc2015_generator: &msvc2015_generator Visual Studio 14 2015 Win64 msvc2017_cmake_flags: &msvc2017_cmake_flags -DCMAKE_CXX_STANDARD=17 @@ -357,6 +357,9 @@ functions: shell: bash working_dir: "mongo-cxx-driver" include_expansions_in_env: ["distro_id"] + env: + CC: ${cc_compiler} + CXX: ${cxx_compiler} script: | set -o errexit set -o pipefail @@ -1871,11 +1874,13 @@ buildvariants: display_name: "ASAN Ubuntu 20.04 Debug (MongoDB Latest)" expansions: build_type: "Debug" + cc_compiler: clang + cxx_compiler: clang++ cmake_flags: *asan_cmake_flags TEST_WITH_ASAN: "ON" mongodb_version: "latest" - example_projects_cc: /usr/bin/clang - example_projects_cxx: /usr/bin/clang++ + example_projects_cc: clang + example_projects_cxx: clang++ example_projects_cxxflags: -D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=address -fno-omit-frame-pointer example_projects_ldflags: -fsanitize=address run_on: @@ -1890,11 +1895,13 @@ buildvariants: display_name: "ASAN Ubuntu 18.04 Debug (MongoDB 5.0)" expansions: build_type: "Debug" + cc_compiler: clang + cxx_compiler: clang++ cmake_flags: *asan_cmake_flags TEST_WITH_ASAN: "ON" mongodb_version: "5.0" - example_projects_cc: /usr/bin/clang - example_projects_cxx: /usr/bin/clang++ + example_projects_cc: clang + example_projects_cxx: clang++ example_projects_cxxflags: -D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=address -fno-omit-frame-pointer example_projects_ldflags: -fsanitize=address run_on: @@ -1909,11 +1916,13 @@ buildvariants: display_name: "UBSAN Ubuntu 20.04 Debug (MongoDB Latest)" expansions: build_type: "Debug" + cc_compiler: clang + cxx_compiler: clang++ cmake_flags: *ubsan_cmake_flags TEST_WITH_UBSAN: "ON" mongodb_version: "latest" - example_projects_cc: /usr/bin/clang - example_projects_cxx: /usr/bin/clang++ + example_projects_cc: clang + example_projects_cxx: clang++ example_projects_cxxflags: -D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=undefined -fno-sanitize-recover=undefined -fno-omit-frame-pointer example_projects_ldflags: -fsanitize=undefined -fno-sanitize-recover=undefined run_on: @@ -1929,11 +1938,13 @@ buildvariants: display_name: "UBSAN Ubuntu 18.04 Debug (MongoDB 5.0)" expansions: build_type: "Debug" + cc_compiler: clang + cxx_compiler: clang++ cmake_flags: *ubsan_cmake_flags TEST_WITH_UBSAN: "ON" mongodb_version: "5.0" - example_projects_cc: /usr/bin/clang - example_projects_cxx: /usr/bin/clang++ + example_projects_cc: clang + example_projects_cxx: clang++ example_projects_cxxflags: -D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=undefined -fno-sanitize-recover=undefined -fno-omit-frame-pointer example_projects_ldflags: -fsanitize=undefined -fno-sanitize-recover=undefined run_on: @@ -1964,7 +1975,8 @@ buildvariants: build_type: "Debug" cmake_flags: *linux_cmake_flags mongodb_version: "latest" - compiler: g++ + cc_compiler: gcc + cxx_compiler: g++ run_on: - ubuntu2204-small tasks: @@ -1977,7 +1989,8 @@ buildvariants: build_type: "Debug" cmake_flags: *linux_cmake_flags mongodb_version: "latest" - compiler: clang++ + cc_compiler: clang + cxx_compiler: clang++ run_on: - ubuntu2204-small tasks: From 40dcdebe637d8c9e5a46adda5a44dd9c72783c6e Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 26 Oct 2023 16:55:54 -0500 Subject: [PATCH 19/28] Move GCC vs. Clang variants to Ubuntu 20.04 --- .mci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.mci.yml b/.mci.yml index 4182cc548c..314d158595 100644 --- a/.mci.yml +++ b/.mci.yml @@ -1969,8 +1969,8 @@ buildvariants: - name: compile_macro_guard_tests - name: test_atlas_task_group_search_indexes - - name: ubuntu2204-debug-gcc - display_name: "Ubuntu 22.04 Debug (GCC)" + - name: ubuntu2004-debug-gcc + display_name: "Ubuntu 20.04 Debug (GCC)" expansions: build_type: "Debug" cmake_flags: *linux_cmake_flags @@ -1978,13 +1978,13 @@ buildvariants: cc_compiler: gcc cxx_compiler: g++ run_on: - - ubuntu2204-small + - ubuntu2004-small tasks: - name: compile_without_tests - name: compile_macro_guard_tests - - name: ubuntu2204-debug-clang - display_name: "Ubuntu 22.04 Debug (Clang)" + - name: ubuntu2004-debug-clang + display_name: "Ubuntu 20.04 Debug (Clang)" expansions: build_type: "Debug" cmake_flags: *linux_cmake_flags @@ -1992,7 +1992,7 @@ buildvariants: cc_compiler: clang cxx_compiler: clang++ run_on: - - ubuntu2204-small + - ubuntu2004-small tasks: - name: clang-tidy - name: compile_without_tests From cf1fcd64939906506b9fbc988ce8fb963587373d Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 26 Oct 2023 13:44:39 -0500 Subject: [PATCH 20/28] Move test commands into .evergreen/test.sh --- .evergreen/test.sh | 349 +++++++++++++++++++++++++++++++++++++++++++++ .mci.yml | 346 ++++---------------------------------------- 2 files changed, 375 insertions(+), 320 deletions(-) create mode 100755 .evergreen/test.sh diff --git a/.evergreen/test.sh b/.evergreen/test.sh new file mode 100755 index 0000000000..78a7592373 --- /dev/null +++ b/.evergreen/test.sh @@ -0,0 +1,349 @@ +#!/usr/bin/env bash + +set -o errexit +set -o pipefail + +: "${build_type:?}" +: "${cse_aws_access_key_id:?}" +: "${cse_aws_secret_access_key:?}" +: "${cse_azure_client_id:?}" +: "${cse_azure_client_secret:?}" +: "${cse_azure_tenant_id:?}" +: "${cse_gcp_email:?}" +: "${cse_gcp_privatekey:?}" +: "${distro_id:?}" + +: "${CRYPT_SHARED_LIB_PATH:-}" +: "${disable_slow_tests:-}" +: "${example_projects_cc:-}" +: "${example_projects_cxx_standard:-}" +: "${example_projects_cxx:-}" +: "${example_projects_cxxflags:-}" +: "${example_projects_ldflags:-}" +: "${generator:-}" +: "${lib_dir:-}" +: "${MONGODB_API_VERSION:-}" +: "${TEST_WITH_ASAN:-}" +: "${TEST_WITH_UBSAN:-}" +: "${TEST_WITH_VALGRIND:-}" +: "${use_mongocryptd:-}" +: "${USE_STATIC_LIBS:-}" + +# Grabs the mongocryptd path +pushd .. +export MONGOCRYPTD_PATH=$(pwd)/ +if [[ "$OSTYPE" =~ cygwin ]]; then + export MONGOCRYPTD_PATH=$(cygpath -m $MONGOCRYPTD_PATH) +fi +popd # .. + +# Add MSBuild.exe to path. +if [[ "$OSTYPE" == "cygwin" ]]; then + case "${generator}" in + *2015*) + PATH="/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/MSBuild/14.0/Bin:$PATH" + ;; + *2017*) + PATH="/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin:$PATH" + ;; + esac +fi +export PATH + +pushd build +export PREFIX=$(pwd)/../../mongoc + +# Use PATH / LD_LIBRARY_PATH / DYLD_LIBRARY_PATH to inform the tests where to find +# mongoc library dependencies on Windows / Linux / Mac OS, respectively. +# Additionally, on Windows, we also need to inform the tests where to find +# mongocxx library dependencies. +if [ -n "${lib_dir}" ]; then + export LD_LIBRARY_PATH=.:$PREFIX/${lib_dir}/ + export DYLD_LIBRARY_PATH=.:$PREFIX/${lib_dir}/ +else + export LD_LIBRARY_PATH=.:$PREFIX/lib/ + export DYLD_LIBRARY_PATH=.:$PREFIX/lib/ +fi +PATH="$(pwd)/src/mongocxx/test/${build_type}:$PATH" +PATH="$(pwd)/src/bsoncxx/test/${build_type}:$PATH" +PATH="$(pwd)/src/mongocxx/${build_type}:$PATH" +PATH="$(pwd)/src/bsoncxx/${build_type}:$PATH" +PATH="$PREFIX/bin:$PATH" +PATH="$(pwd)/install/bin:$PATH" + +export CHANGE_STREAMS_UNIFIED_TESTS_PATH="$(pwd)/../data/change-streams/unified" +export CLIENT_SIDE_ENCRYPTION_LEGACY_TESTS_PATH="$(pwd)/../data/client_side_encryption/legacy" +export CLIENT_SIDE_ENCRYPTION_TESTS_PATH="$(pwd)/../data/client_side_encryption" +export CLIENT_SIDE_ENCRYPTION_UNIFIED_TESTS_PATH="$(pwd)/../data/client_side_encryption/unified" +export COLLECTION_MANAGEMENT_TESTS_PATH="$(pwd)/../data/collection-management" +export COMMAND_MONITORING_TESTS_PATH="$(pwd)/../data/command-monitoring" +export CRUD_LEGACY_TESTS_PATH="$(pwd)/../data/crud/legacy" +export CRUD_UNIFIED_TESTS_PATH="$(pwd)/../data/crud/unified" +export GRIDFS_TESTS_PATH="$(pwd)/../data/gridfs" +export INITIAL_DNS_SEEDLIST_DISCOVERY_TESTS_PATH="$(pwd)/../data/initial_dns_seedlist_discovery" +export READ_WRITE_CONCERN_OPERATION_TESTS_PATH="$(pwd)/../data/read-write-concern/operation" +export RETRYABLE_READS_LEGACY_TESTS_PATH="$(pwd)/../data/retryable-reads/legacy" +export RETRYABLE_READS_UNIFIED_TESTS_PATH="$(pwd)/../data/retryable-reads/unified" +export RETRYABLE_WRITES_UNIFIED_TESTS_PATH="$(pwd)/../data/retryable-writes/unified" +export SESSION_UNIFIED_TESTS_PATH="$(pwd)/../data/sessions/unified" +export TRANSACTIONS_LEGACY_TESTS_PATH="$(pwd)/../data/transactions/legacy" +export TRANSACTIONS_UNIFIED_TESTS_PATH="$(pwd)/../data/transactions/unified" +export UNIFIED_FORMAT_TESTS_PATH=$(pwd)/../data/unified-format +export URI_OPTIONS_TESTS_PATH="$(pwd)/../data/uri-options" +export VERSIONED_API_TESTS_PATH=$(pwd)/../data/versioned-api +export WITH_TRANSACTION_TESTS_PATH="$(pwd)/../data/with_transaction" +export INDEX_MANAGEMENT_TESTS_PATH="$(pwd)/../data/index-management" + +export MONGODB_API_VERSION="${MONGODB_API_VERSION}" + +pushd ../../drivers-evergreen-tools +export DRIVERS_TOOLS=$(pwd) +if [[ "$OSTYPE" =~ cygwin ]]; then + export DRIVERS_TOOLS=$(cygpath -m $DRIVERS_TOOLS) +fi +popd # ../../drivers-evergreen-tools + +export MONGOCXX_TEST_TLS_CA_FILE="$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem" + +if [ "$(uname -m)" == "ppc64le" ]; then + echo "Skipping CSFLE test setup (CDRIVER-4246/CXX-2423)" +else + # export environment variables for encryption tests + set +o errexit + + # Avoid printing credentials in logs. + set +o xtrace + + echo "Setting temporary credentials..." + pushd "$DRIVERS_TOOLS/.evergreen/csfle" + export AWS_SECRET_ACCESS_KEY="${cse_aws_secret_access_key}" + export AWS_ACCESS_KEY_ID="${cse_aws_access_key_id}" + export AWS_DEFAULT_REGION="us-east-1" + echo "Running activate-kmstlsvenv.sh..." + . ./activate-kmstlsvenv.sh + echo "Running activate-kmstlsvenv.sh... done." + echo "Running set-temp-creds.sh..." + . ./set-temp-creds.sh + echo "Running set-temp-creds.sh... done." + deactivate + popd # "$DRIVERS_TOOLS/.evergreen/csfle" + echo "Setting temporary credentials... done." + + # Ensure temporary credentials were properly set. + if [ -z "$CSFLE_AWS_TEMP_ACCESS_KEY_ID" ]; then + echo "Failed to set temporary credentials!" + exit 1 + fi + + export MONGOCXX_TEST_CSFLE_TLS_CA_FILE=$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem + export MONGOCXX_TEST_CSFLE_TLS_CERTIFICATE_KEY_FILE=$DRIVERS_TOOLS/.evergreen/x509gen/client.pem + export MONGOCXX_TEST_AWS_TEMP_ACCESS_KEY_ID="$CSFLE_AWS_TEMP_ACCESS_KEY_ID" + export MONGOCXX_TEST_AWS_TEMP_SECRET_ACCESS_KEY="$CSFLE_AWS_TEMP_SECRET_ACCESS_KEY" + export MONGOCXX_TEST_AWS_TEMP_SESSION_TOKEN="$CSFLE_AWS_TEMP_SESSION_TOKEN" + export MONGOCXX_TEST_AWS_SECRET_ACCESS_KEY="${cse_aws_secret_access_key}" + export MONGOCXX_TEST_AWS_ACCESS_KEY_ID="${cse_aws_access_key_id}" + export MONGOCXX_TEST_AZURE_TENANT_ID="${cse_azure_tenant_id}" + export MONGOCXX_TEST_AZURE_CLIENT_ID="${cse_azure_client_id}" + export MONGOCXX_TEST_AZURE_CLIENT_SECRET="${cse_azure_client_secret}" + export MONGOCXX_TEST_GCP_EMAIL="${cse_gcp_email}" + export MONGOCXX_TEST_GCP_PRIVATEKEY="${cse_gcp_privatekey}" + + set -o errexit +fi + +if [ "$(uname -m)" == "ppc64le" ]; then + echo "Skipping CSFLE test setup (CDRIVER-4246/CXX-2423)" +else + # Register CA certificate required by KMS TLS connections. + echo "Registering CA certificate for KMS TLS tests..." + register_ca_cert() { + local OS=$(uname -s | tr '[:upper:]' '[:lower:]') + echo "register_ca_cert: OS: $OS" + case "$OSTYPE" in + cygwin*) + certutil.exe -addstore "Root" "$DRIVERS_TOOLS\.evergreen\x509gen\ca.pem" + ;; + darwin*) + sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain $DRIVERS_TOOLS/.evergreen/x509gen/ca.pem + ;; + *) + if [ -f /etc/redhat-release ]; then + # CSE KMS TLS tests are disabled on RHEL due to sudo permissions. See BUILD-14068. + # sudo cp -v $DRIVERS_TOOLS/.evergreen/x509gen/ca.pem /usr/share/pki/ca-trust-source/anchors/cdriver.crt + # sudo update-ca-trust extract --verbose + export MONGOCXX_TEST_SKIP_KMS_TLS_TESTS=1 + else + sudo cp -v $DRIVERS_TOOLS/.evergreen/x509gen/ca.pem /usr/local/share/ca-certificates/cdriver.crt + sudo update-ca-certificates --verbose + fi + ;; + esac + } >/dev/null + register_ca_cert + echo "Registering CA certificate for KMS TLS tests... done." + + # Ensure mock KMS servers are running before starting tests. + wait_for_kms_server() { + for i in $(seq 60); do + # Exit code 7: "Failed to connect to host". + if + curl -s "localhost:$1" + (($? != 7)) + then + return 0 + else + sleep 1 + fi + done + echo "Could not detect mock KMS server on port $1" + return 1 + } + echo "Waiting for mock KMS servers to start..." + wait_for_kms_server 8999 + wait_for_kms_server 9000 + wait_for_kms_server 9001 + wait_for_kms_server 9002 + wait_for_kms_server 5698 + echo "Waiting for mock KMS servers to start... done." +fi + +if [[ "$OSTYPE" =~ cygwin ]]; then + CTEST_OUTPUT_ON_FAILURE=1 MSBuild.exe /p:Configuration=${build_type} /verbosity:minimal RUN_TESTS.vcxproj + # Only run examples if MONGODB_API_VERSION is unset. We do not append + # API version to example clients, so examples will fail when requireApiVersion + # is true. + if [[ -z "$MONGODB_API_VERSION" ]]; then + echo "Running examples..." + if ! CTEST_OUTPUT_ON_FAILURE=1 MSBuild.exe /p:Configuration=${build_type} /verbosity:minimal examples/run-examples.vcxproj >|output.txt 2>&1; then + # Only emit output on failure. + cat output.txt 1>&2 + exit 1 + fi + echo "Running examples... done." + fi +else + # ENABLE_SLOW_TESTS is required to run the slow tests that are disabled by default. The slow tests should not be run if explicitly disabled. + if [ -z "${disable_slow_tests}" ]; then + export MONGOCXX_ENABLE_SLOW_TESTS=1 + fi + + ulimit -c unlimited || true + + if [ "${use_mongocryptd}" = "true" ]; then + echo "Will run tests using mongocryptd (instead of crypt_shared library)" + else + echo "Will run tests using crypt_shared library (instead of mongocryptd)" + # Set by run-orchestration.sh in "start_mongod". + export CRYPT_SHARED_LIB_PATH="${CRYPT_SHARED_LIB_PATH}" + echo "CRYPT_SHARED_LIB_PATH=$CRYPT_SHARED_LIB_PATH" + fi + + export ASAN_OPTIONS="detect_leaks=1" + export UBSAN_OPTIONS="print_stacktrace=1" + + run_test() { $@; } + + if [[ "${TEST_WITH_ASAN}" == "ON" || "${TEST_WITH_UBSAN}" == "ON" ]]; then + export PATH="/usr/lib/llvm-3.8/bin:$PATH" + elif [[ "${TEST_WITH_VALGRIND}" == "ON" ]]; then + run_test() { + valgrind --leak-check=full --track-origins=yes --num-callers=50 --error-exitcode=1 --error-limit=no --read-var-info=yes --suppressions=../etc/memcheck.suppressions $@ + } + fi + + # Run tests and examples 1-by-1 with "run_test" so we can run them with valgrind. + run_test ./src/bsoncxx/test/test_bson + run_test ./src/mongocxx/test/test_driver + run_test ./src/mongocxx/test/test_client_side_encryption_specs + run_test ./src/mongocxx/test/test_crud_specs + run_test ./src/mongocxx/test/test_gridfs_specs + run_test ./src/mongocxx/test/test_command_monitoring_specs + run_test ./src/mongocxx/test/test_instance + run_test ./src/mongocxx/test/test_transactions_specs + run_test ./src/mongocxx/test/test_logging + run_test ./src/mongocxx/test/test_retryable_reads_specs + run_test ./src/mongocxx/test/test_read_write_concern_specs + run_test ./src/mongocxx/test/test_unified_format_spec + + # Some platforms like OS X don't support the /mode syntax to the -perm option + # of find(1), and some platforms like Ubuntu 16.04 don't support the +mode + # syntax, so we use Perl to help us find executable files. + EXAMPLES=$(find examples -type f | sort | perl -nlwe 'print if -x') + + # Only run examples if MONGODB_API_VERSION is unset. We do not append + # API version to example clients, so examples will fail when requireApiVersion + # is true. + if [[ -z "$MONGODB_API_VERSION" ]]; then + for test in $EXAMPLES; do + echo "Running $test" + case "$test" in + *encryption*) + echo " - Skipping client side encryption example" + ;; + *change_stream*) + echo " - TODO CXX-1201, enable for servers that support change streams" + ;; + *client_session*) + echo " - TODO CXX-1201, enable for servers that support change streams" + ;; + *with_transaction*) + echo " - TODO CXX-1201, enable for servers that support transactions" + ;; + *causal_consistency*) + echo " - TODO CXX-1201, enable for servers that support transactions" + ;; + *) + if ! run_test $test >|output.txt 2>&1; then + # Only emit output on failure. + cat output.txt 1>&2 + exit 1 + fi + ;; + esac + done + fi +fi + +popd # ./build + +export CMAKE_PREFIX_PATH=$PREFIX:$(pwd)/build/install +if [ -n "${lib_dir}" ]; then + export PKG_CONFIG_PATH=$PREFIX/${lib_dir}/pkgconfig:$(pwd)/build/install/${lib_dir}/pkgconfig +else + export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig:$(pwd)/build/install/lib/pkgconfig +fi +export USE_STATIC_LIBS="${USE_STATIC_LIBS}" +export BUILD_TYPE="${build_type}" + +export CXXFLAGS="${example_projects_cxxflags}" +export LDFLAGS="${example_projects_ldflags}" +export CC="${example_projects_cc}" +export CXX="${example_projects_cxx}" +export CXX_STANDARD="${example_projects_cxx_standard}" +if [[ "$OSTYPE" =~ cygwin ]]; then + export MSVC=1 +elif [ "$(uname -s | tr '[:upper:]' '[:lower:]')" == "darwin" ]; then + export DYLD_LIBRARY_PATH="$(pwd)/build/install/lib:$DYLD_LIBRARY_PATH" +else + if [ -n "${lib_dir}" ]; then # only needed on Linux + export LD_LIBRARY_PATH="$(pwd)/build/install/${lib_dir}:$LD_LIBRARY_PATH" + else + export LD_LIBRARY_PATH="$(pwd)/build/install/lib:$LD_LIBRARY_PATH" + fi +fi +# The example projects never run under valgrind, since we haven't added execution +# logic to handle `run_test()`. +# +# Only run example projects if MONGODB_API_VERSION is unset. We do not append +# API version to example clients, so example projects will fail when requireApiVersion +# is true. +if [[ -z "$MONGODB_API_VERSION" ]]; then + echo "Building example projects..." + . "$PREFIX/.evergreen/scripts/find-cmake-latest.sh" + export cmake_binary + cmake_binary="$(find_cmake_latest)" + command -v "$cmake_binary" + .evergreen/build_example_projects.sh + echo "Building example projects... done." +fi +unset MONGODB_API_VERSION diff --git a/.mci.yml b/.mci.yml index 314d158595..66c314353f 100644 --- a/.mci.yml +++ b/.mci.yml @@ -434,326 +434,32 @@ functions: params: shell: bash working_dir: "mongo-cxx-driver" - include_expansions_in_env: ["distro_id"] - script: | - set -o errexit - set -o pipefail - - # Grabs the mongocryptd path - pushd .. - export MONGOCRYPTD_PATH=$(pwd)/ - if [[ "$OSTYPE" =~ cygwin ]]; then - export MONGOCRYPTD_PATH=$(cygpath -m $MONGOCRYPTD_PATH) - fi - popd # .. - - # Add MSBuild.exe to path. - if [[ "$OSTYPE" == "cygwin" ]]; then - case "${generator}" in - *2015*) - PATH="/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/MSBuild/14.0/Bin:$PATH" - ;; - *2017*) - PATH="/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin:$PATH" - ;; - esac - fi - export PATH - - pushd build - export PREFIX=$(pwd)/../../mongoc - - # Use PATH / LD_LIBRARY_PATH / DYLD_LIBRARY_PATH to inform the tests where to find - # mongoc library dependencies on Windows / Linux / Mac OS, respectively. - # Additionally, on Windows, we also need to inform the tests where to find - # mongocxx library dependencies. - if [ -n "${lib_dir}" ]; then - export LD_LIBRARY_PATH=.:$PREFIX/${lib_dir}/ - export DYLD_LIBRARY_PATH=.:$PREFIX/${lib_dir}/ - else - export LD_LIBRARY_PATH=.:$PREFIX/lib/ - export DYLD_LIBRARY_PATH=.:$PREFIX/lib/ - fi - PATH="$(pwd)/src/mongocxx/test/${build_type}:$PATH" - PATH="$(pwd)/src/bsoncxx/test/${build_type}:$PATH" - PATH="$(pwd)/src/mongocxx/${build_type}:$PATH" - PATH="$(pwd)/src/bsoncxx/${build_type}:$PATH" - PATH="$PREFIX/bin:$PATH" - PATH="$(pwd)/install/bin:$PATH" - - export CHANGE_STREAMS_UNIFIED_TESTS_PATH="$(pwd)/../data/change-streams/unified" - export CLIENT_SIDE_ENCRYPTION_LEGACY_TESTS_PATH="$(pwd)/../data/client_side_encryption/legacy" - export CLIENT_SIDE_ENCRYPTION_TESTS_PATH="$(pwd)/../data/client_side_encryption" - export CLIENT_SIDE_ENCRYPTION_UNIFIED_TESTS_PATH="$(pwd)/../data/client_side_encryption/unified" - export COLLECTION_MANAGEMENT_TESTS_PATH="$(pwd)/../data/collection-management" - export COMMAND_MONITORING_TESTS_PATH="$(pwd)/../data/command-monitoring" - export CRUD_LEGACY_TESTS_PATH="$(pwd)/../data/crud/legacy" - export CRUD_UNIFIED_TESTS_PATH="$(pwd)/../data/crud/unified" - export GRIDFS_TESTS_PATH="$(pwd)/../data/gridfs" - export INITIAL_DNS_SEEDLIST_DISCOVERY_TESTS_PATH="$(pwd)/../data/initial_dns_seedlist_discovery" - export READ_WRITE_CONCERN_OPERATION_TESTS_PATH="$(pwd)/../data/read-write-concern/operation" - export RETRYABLE_READS_LEGACY_TESTS_PATH="$(pwd)/../data/retryable-reads/legacy" - export RETRYABLE_READS_UNIFIED_TESTS_PATH="$(pwd)/../data/retryable-reads/unified" - export RETRYABLE_WRITES_UNIFIED_TESTS_PATH="$(pwd)/../data/retryable-writes/unified" - export SESSION_UNIFIED_TESTS_PATH="$(pwd)/../data/sessions/unified" - export TRANSACTIONS_LEGACY_TESTS_PATH="$(pwd)/../data/transactions/legacy" - export TRANSACTIONS_UNIFIED_TESTS_PATH="$(pwd)/../data/transactions/unified" - export UNIFIED_FORMAT_TESTS_PATH=$(pwd)/../data/unified-format - export URI_OPTIONS_TESTS_PATH="$(pwd)/../data/uri-options" - export VERSIONED_API_TESTS_PATH=$(pwd)/../data/versioned-api - export WITH_TRANSACTION_TESTS_PATH="$(pwd)/../data/with_transaction" - export INDEX_MANAGEMENT_TESTS_PATH="$(pwd)/../data/index-management" - - export MONGODB_API_VERSION="${MONGODB_API_VERSION}" - - pushd ../../drivers-evergreen-tools - export DRIVERS_TOOLS=$(pwd) - if [[ "$OSTYPE" =~ cygwin ]]; then - export DRIVERS_TOOLS=$(cygpath -m $DRIVERS_TOOLS) - fi - popd # ../../drivers-evergreen-tools - - export MONGOCXX_TEST_TLS_CA_FILE="$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem" - - if [ "$(uname -m)" == "ppc64le" ]; then - echo "Skipping CSFLE test setup (CDRIVER-4246/CXX-2423)" - else - # export environment variables for encryption tests - set +o errexit - - # Avoid printing credentials in logs. - set +o xtrace - - echo "Setting temporary credentials..." - pushd "$DRIVERS_TOOLS/.evergreen/csfle" - export AWS_SECRET_ACCESS_KEY="${cse_aws_secret_access_key}" - export AWS_ACCESS_KEY_ID="${cse_aws_access_key_id}" - export AWS_DEFAULT_REGION="us-east-1" - echo "Running activate-kmstlsvenv.sh..." - . ./activate-kmstlsvenv.sh - echo "Running activate-kmstlsvenv.sh... done." - echo "Running set-temp-creds.sh..." - . ./set-temp-creds.sh - echo "Running set-temp-creds.sh... done." - deactivate - popd # "$DRIVERS_TOOLS/.evergreen/csfle" - echo "Setting temporary credentials... done." - - # Ensure temporary credentials were properly set. - if [ -z "$CSFLE_AWS_TEMP_ACCESS_KEY_ID" ]; then - echo "Failed to set temporary credentials!" - exit 1 - fi - - export MONGOCXX_TEST_CSFLE_TLS_CA_FILE=$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem - export MONGOCXX_TEST_CSFLE_TLS_CERTIFICATE_KEY_FILE=$DRIVERS_TOOLS/.evergreen/x509gen/client.pem - export MONGOCXX_TEST_AWS_TEMP_ACCESS_KEY_ID="$CSFLE_AWS_TEMP_ACCESS_KEY_ID" - export MONGOCXX_TEST_AWS_TEMP_SECRET_ACCESS_KEY="$CSFLE_AWS_TEMP_SECRET_ACCESS_KEY" - export MONGOCXX_TEST_AWS_TEMP_SESSION_TOKEN="$CSFLE_AWS_TEMP_SESSION_TOKEN" - export MONGOCXX_TEST_AWS_SECRET_ACCESS_KEY="${cse_aws_secret_access_key}" - export MONGOCXX_TEST_AWS_ACCESS_KEY_ID="${cse_aws_access_key_id}" - export MONGOCXX_TEST_AZURE_TENANT_ID="${cse_azure_tenant_id}" - export MONGOCXX_TEST_AZURE_CLIENT_ID="${cse_azure_client_id}" - export MONGOCXX_TEST_AZURE_CLIENT_SECRET="${cse_azure_client_secret}" - export MONGOCXX_TEST_GCP_EMAIL="${cse_gcp_email}" - export MONGOCXX_TEST_GCP_PRIVATEKEY="${cse_gcp_privatekey}" - - set -o errexit - fi - - if [ "$(uname -m)" == "ppc64le" ]; then - echo "Skipping CSFLE test setup (CDRIVER-4246/CXX-2423)" - else - # Register CA certificate required by KMS TLS connections. - echo "Registering CA certificate for KMS TLS tests..." - register_ca_cert() { - local OS=$(uname -s | tr '[:upper:]' '[:lower:]') - echo "register_ca_cert: OS: $OS" - case "$OSTYPE" in - cygwin*) - certutil.exe -addstore "Root" "$DRIVERS_TOOLS\.evergreen\x509gen\ca.pem" - ;; - darwin*) - sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain $DRIVERS_TOOLS/.evergreen/x509gen/ca.pem - ;; - *) - if [ -f /etc/redhat-release ]; then - # CSE KMS TLS tests are disabled on RHEL due to sudo permissions. See BUILD-14068. - # sudo cp -v $DRIVERS_TOOLS/.evergreen/x509gen/ca.pem /usr/share/pki/ca-trust-source/anchors/cdriver.crt - # sudo update-ca-trust extract --verbose - export MONGOCXX_TEST_SKIP_KMS_TLS_TESTS=1 - else - sudo cp -v $DRIVERS_TOOLS/.evergreen/x509gen/ca.pem /usr/local/share/ca-certificates/cdriver.crt - sudo update-ca-certificates --verbose - fi - ;; - esac - } >/dev/null - register_ca_cert - echo "Registering CA certificate for KMS TLS tests... done." - - # Ensure mock KMS servers are running before starting tests. - wait_for_kms_server() { - for i in $(seq 60); do - # Exit code 7: "Failed to connect to host". - if curl -s "localhost:$1"; (($? != 7)); then - return 0 - else - sleep 1 - fi - done - echo "Could not detect mock KMS server on port $1" - return 1 - } - echo "Waiting for mock KMS servers to start..." - wait_for_kms_server 8999 - wait_for_kms_server 9000 - wait_for_kms_server 9001 - wait_for_kms_server 9002 - wait_for_kms_server 5698 - echo "Waiting for mock KMS servers to start... done." - fi - - if [[ "$OSTYPE" =~ cygwin ]]; then - CTEST_OUTPUT_ON_FAILURE=1 MSBuild.exe /p:Configuration=${build_type} /verbosity:minimal RUN_TESTS.vcxproj - # Only run examples if MONGODB_API_VERSION is unset. We do not append - # API version to example clients, so examples will fail when requireApiVersion - # is true. - if [[ -z "$MONGODB_API_VERSION" ]]; then - echo "Running examples..." - if ! CTEST_OUTPUT_ON_FAILURE=1 MSBuild.exe /p:Configuration=${build_type} /verbosity:minimal examples/run-examples.vcxproj >|output.txt 2>&1; then - # Only emit output on failure. - cat output.txt 1>&2 - exit 1 - fi - echo "Running examples... done." - fi - else - # ENABLE_SLOW_TESTS is required to run the slow tests that are disabled by default. The slow tests should not be run if explicitly disabled. - if [ -z "${disable_slow_tests}" ]; then - export MONGOCXX_ENABLE_SLOW_TESTS=1 - fi - - ulimit -c unlimited || true - - if [ "${use_mongocryptd}" = "true" ]; then - echo "Will run tests using mongocryptd (instead of crypt_shared library)" - else - echo "Will run tests using crypt_shared library (instead of mongocryptd)" - # Set by run-orchestration.sh in "start_mongod". - export CRYPT_SHARED_LIB_PATH="${CRYPT_SHARED_LIB_PATH}" - echo "CRYPT_SHARED_LIB_PATH=$CRYPT_SHARED_LIB_PATH" - fi - - export ASAN_OPTIONS="detect_leaks=1" - export UBSAN_OPTIONS="print_stacktrace=1" - - run_test() { $@; } - - if [[ "${TEST_WITH_ASAN}" == "ON" || "${TEST_WITH_UBSAN}" == "ON" ]]; then - export PATH="/usr/lib/llvm-3.8/bin:$PATH" - elif [[ "${TEST_WITH_VALGRIND}" == "ON" ]]; then - run_test() { - valgrind --leak-check=full --track-origins=yes --num-callers=50 --error-exitcode=1 --error-limit=no --read-var-info=yes --suppressions=../etc/memcheck.suppressions $@ - } - fi - - # Run tests and examples 1-by-1 with "run_test" so we can run them with valgrind. - run_test ./src/bsoncxx/test/test_bson - run_test ./src/mongocxx/test/test_driver - run_test ./src/mongocxx/test/test_client_side_encryption_specs - run_test ./src/mongocxx/test/test_crud_specs - run_test ./src/mongocxx/test/test_gridfs_specs - run_test ./src/mongocxx/test/test_command_monitoring_specs - run_test ./src/mongocxx/test/test_instance - run_test ./src/mongocxx/test/test_transactions_specs - run_test ./src/mongocxx/test/test_logging - run_test ./src/mongocxx/test/test_retryable_reads_specs - run_test ./src/mongocxx/test/test_read_write_concern_specs - run_test ./src/mongocxx/test/test_unified_format_spec - - # Some platforms like OS X don't support the /mode syntax to the -perm option - # of find(1), and some platforms like Ubuntu 16.04 don't support the +mode - # syntax, so we use Perl to help us find executable files. - EXAMPLES=$(find examples -type f | sort | perl -nlwe 'print if -x') - - # Only run examples if MONGODB_API_VERSION is unset. We do not append - # API version to example clients, so examples will fail when requireApiVersion - # is true. - if [[ -z "$MONGODB_API_VERSION" ]]; then - for test in $EXAMPLES; do - echo "Running $test" - case "$test" in - *encryption*) - echo " - Skipping client side encryption example" - ;; - *change_stream*) - echo " - TODO CXX-1201, enable for servers that support change streams" - ;; - *client_session*) - echo " - TODO CXX-1201, enable for servers that support change streams" - ;; - *with_transaction*) - echo " - TODO CXX-1201, enable for servers that support transactions" - ;; - *causal_consistency*) - echo " - TODO CXX-1201, enable for servers that support transactions" - ;; - *) - if ! run_test $test >|output.txt 2>&1; then - # Only emit output on failure. - cat output.txt 1>&2 - exit 1 - fi - ;; - esac - done - fi - fi - - popd # ./build - - export CMAKE_PREFIX_PATH=$PREFIX:$(pwd)/build/install - if [ -n "${lib_dir}" ]; then - export PKG_CONFIG_PATH=$PREFIX/${lib_dir}/pkgconfig:$(pwd)/build/install/${lib_dir}/pkgconfig - else - export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig:$(pwd)/build/install/lib/pkgconfig - fi - export USE_STATIC_LIBS="${USE_STATIC_LIBS}" - export BUILD_TYPE="${build_type}" - - export CXXFLAGS="${example_projects_cxxflags}" - export LDFLAGS="${example_projects_ldflags}" - export CC="${example_projects_cc}" - export CXX="${example_projects_cxx}" - export CXX_STANDARD="${example_projects_cxx_standard}" - if [[ "$OSTYPE" =~ cygwin ]]; then - export MSVC=1 - elif [ "$(uname -s | tr '[:upper:]' '[:lower:]')" == "darwin" ]; then - export DYLD_LIBRARY_PATH="$(pwd)/build/install/lib:$DYLD_LIBRARY_PATH" - else - if [ -n "${lib_dir}" ]; then # only needed on Linux - export LD_LIBRARY_PATH="$(pwd)/build/install/${lib_dir}:$LD_LIBRARY_PATH" - else - export LD_LIBRARY_PATH="$(pwd)/build/install/lib:$LD_LIBRARY_PATH" - fi - fi - # The example projects never run under valgrind, since we haven't added execution - # logic to handle `run_test()`. - # - # Only run example projects if MONGODB_API_VERSION is unset. We do not append - # API version to example clients, so example projects will fail when requireApiVersion - # is true. - if [[ -z "$MONGODB_API_VERSION" ]]; then - echo "Building example projects..." - . "$PREFIX/.evergreen/scripts/find-cmake-latest.sh" - export cmake_binary - cmake_binary="$(find_cmake_latest)" - command -v "$cmake_binary" - .evergreen/build_example_projects.sh - echo "Building example projects... done." - fi - unset MONGODB_API_VERSION + include_expansions_in_env: + - build_type + - CRYPT_SHARED_LIB_PATH + - cse_aws_access_key_id + - cse_aws_secret_access_key + - cse_azure_client_id + - cse_azure_client_secret + - cse_azure_tenant_id + - cse_gcp_email + - cse_gcp_privatekey + - disable_slow_tests + - distro_id + - example_projects_cc + - example_projects_cxx + - example_projects_cxx_standard + - example_projects_cxxflags + - example_projects_ldflags + - generator + - lib_dir + - MONGODB_API_VERSION + - TEST_WITH_ASAN + - TEST_WITH_UBSAN + - TEST_WITH_VALGRIND + - use_mongocryptd + - USE_STATIC_LIBS + script: .evergreen/test.sh "test auth": - command: shell.exec From 5e3e26ca5b78e69620f464dfd41b971be4db52f3 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 26 Oct 2023 14:36:37 -0500 Subject: [PATCH 21/28] Tidy test.sh --- .evergreen/test.sh | 233 ++++++++++++++++++++++++--------------------- .mci.yml | 2 +- 2 files changed, 125 insertions(+), 110 deletions(-) diff --git a/.evergreen/test.sh b/.evergreen/test.sh index 78a7592373..0e939d107e 100755 --- a/.evergreen/test.sh +++ b/.evergreen/test.sh @@ -29,12 +29,15 @@ set -o pipefail : "${use_mongocryptd:-}" : "${USE_STATIC_LIBS:-}" +working_dir="$(pwd)" + # Grabs the mongocryptd path pushd .. -export MONGOCRYPTD_PATH=$(pwd)/ -if [[ "$OSTYPE" =~ cygwin ]]; then - export MONGOCRYPTD_PATH=$(cygpath -m $MONGOCRYPTD_PATH) +MONGOCRYPTD_PATH="$(pwd)/" +if [[ "${OSTYPE:?}" =~ cygwin ]]; then + MONGOCRYPTD_PATH=$(cygpath -m "${MONGOCRYPTD_PATH:?}") fi +export MONGOCRYPTD_PATH popd # .. # Add MSBuild.exe to path. @@ -50,60 +53,61 @@ if [[ "$OSTYPE" == "cygwin" ]]; then fi export PATH -pushd build -export PREFIX=$(pwd)/../../mongoc +mongoc_dir="${working_dir:?}/../mongoc" +export mongoc_dir # Use PATH / LD_LIBRARY_PATH / DYLD_LIBRARY_PATH to inform the tests where to find # mongoc library dependencies on Windows / Linux / Mac OS, respectively. # Additionally, on Windows, we also need to inform the tests where to find # mongocxx library dependencies. -if [ -n "${lib_dir}" ]; then - export LD_LIBRARY_PATH=.:$PREFIX/${lib_dir}/ - export DYLD_LIBRARY_PATH=.:$PREFIX/${lib_dir}/ +if [ -n "${lib_dir:-}" ]; then + export LD_LIBRARY_PATH="${working_dir:?}/build:${mongoc_dir:?}/${lib_dir:?}/" + export DYLD_LIBRARY_PATH="${working_dir:?}/build:${mongoc_dir:?}/${lib_dir:?}/" else - export LD_LIBRARY_PATH=.:$PREFIX/lib/ - export DYLD_LIBRARY_PATH=.:$PREFIX/lib/ + export LD_LIBRARY_PATH="${working_dir:?}/build:${mongoc_dir:?}/lib/" + export DYLD_LIBRARY_PATH="${working_dir:?}/build:${mongoc_dir:?}/lib/" fi -PATH="$(pwd)/src/mongocxx/test/${build_type}:$PATH" -PATH="$(pwd)/src/bsoncxx/test/${build_type}:$PATH" -PATH="$(pwd)/src/mongocxx/${build_type}:$PATH" -PATH="$(pwd)/src/bsoncxx/${build_type}:$PATH" -PATH="$PREFIX/bin:$PATH" -PATH="$(pwd)/install/bin:$PATH" - -export CHANGE_STREAMS_UNIFIED_TESTS_PATH="$(pwd)/../data/change-streams/unified" -export CLIENT_SIDE_ENCRYPTION_LEGACY_TESTS_PATH="$(pwd)/../data/client_side_encryption/legacy" -export CLIENT_SIDE_ENCRYPTION_TESTS_PATH="$(pwd)/../data/client_side_encryption" -export CLIENT_SIDE_ENCRYPTION_UNIFIED_TESTS_PATH="$(pwd)/../data/client_side_encryption/unified" -export COLLECTION_MANAGEMENT_TESTS_PATH="$(pwd)/../data/collection-management" -export COMMAND_MONITORING_TESTS_PATH="$(pwd)/../data/command-monitoring" -export CRUD_LEGACY_TESTS_PATH="$(pwd)/../data/crud/legacy" -export CRUD_UNIFIED_TESTS_PATH="$(pwd)/../data/crud/unified" -export GRIDFS_TESTS_PATH="$(pwd)/../data/gridfs" -export INITIAL_DNS_SEEDLIST_DISCOVERY_TESTS_PATH="$(pwd)/../data/initial_dns_seedlist_discovery" -export READ_WRITE_CONCERN_OPERATION_TESTS_PATH="$(pwd)/../data/read-write-concern/operation" -export RETRYABLE_READS_LEGACY_TESTS_PATH="$(pwd)/../data/retryable-reads/legacy" -export RETRYABLE_READS_UNIFIED_TESTS_PATH="$(pwd)/../data/retryable-reads/unified" -export RETRYABLE_WRITES_UNIFIED_TESTS_PATH="$(pwd)/../data/retryable-writes/unified" -export SESSION_UNIFIED_TESTS_PATH="$(pwd)/../data/sessions/unified" -export TRANSACTIONS_LEGACY_TESTS_PATH="$(pwd)/../data/transactions/legacy" -export TRANSACTIONS_UNIFIED_TESTS_PATH="$(pwd)/../data/transactions/unified" -export UNIFIED_FORMAT_TESTS_PATH=$(pwd)/../data/unified-format -export URI_OPTIONS_TESTS_PATH="$(pwd)/../data/uri-options" -export VERSIONED_API_TESTS_PATH=$(pwd)/../data/versioned-api -export WITH_TRANSACTION_TESTS_PATH="$(pwd)/../data/with_transaction" -export INDEX_MANAGEMENT_TESTS_PATH="$(pwd)/../data/index-management" - -export MONGODB_API_VERSION="${MONGODB_API_VERSION}" - -pushd ../../drivers-evergreen-tools -export DRIVERS_TOOLS=$(pwd) -if [[ "$OSTYPE" =~ cygwin ]]; then - export DRIVERS_TOOLS=$(cygpath -m $DRIVERS_TOOLS) +PATH="${working_dir:?}/build/src/mongocxx/test/${build_type:?}:${PATH:-}" +PATH="${working_dir:?}/build/src/bsoncxx/test/${build_type:?}:${PATH:-}" +PATH="${working_dir:?}/build/src/mongocxx/${build_type:?}:${PATH:-}" +PATH="${working_dir:?}/build/src/bsoncxx/${build_type:?}:${PATH:-}" +PATH="${mongoc_dir:?}/bin:${PATH:-}" +PATH="${working_dir:?}/build/install/bin:${PATH:-}" + +data_dir="${working_dir}/data" + +export CHANGE_STREAMS_UNIFIED_TESTS_PATH="${data_dir}/change-streams/unified" +export CLIENT_SIDE_ENCRYPTION_LEGACY_TESTS_PATH="${data_dir}/client_side_encryption/legacy" +export CLIENT_SIDE_ENCRYPTION_TESTS_PATH="${data_dir}/client_side_encryption" +export CLIENT_SIDE_ENCRYPTION_UNIFIED_TESTS_PATH="${data_dir}/client_side_encryption/unified" +export COLLECTION_MANAGEMENT_TESTS_PATH="${data_dir}/collection-management" +export COMMAND_MONITORING_TESTS_PATH="${data_dir}/command-monitoring" +export CRUD_LEGACY_TESTS_PATH="${data_dir}/crud/legacy" +export CRUD_UNIFIED_TESTS_PATH="${data_dir}/crud/unified" +export GRIDFS_TESTS_PATH="${data_dir}/gridfs" +export INITIAL_DNS_SEEDLIST_DISCOVERY_TESTS_PATH="${data_dir}/initial_dns_seedlist_discovery" +export READ_WRITE_CONCERN_OPERATION_TESTS_PATH="${data_dir}/read-write-concern/operation" +export RETRYABLE_READS_LEGACY_TESTS_PATH="${data_dir}/retryable-reads/legacy" +export RETRYABLE_READS_UNIFIED_TESTS_PATH="${data_dir}/retryable-reads/unified" +export RETRYABLE_WRITES_UNIFIED_TESTS_PATH="${data_dir}/retryable-writes/unified" +export SESSION_UNIFIED_TESTS_PATH="${data_dir}/sessions/unified" +export TRANSACTIONS_LEGACY_TESTS_PATH="${data_dir}/transactions/legacy" +export TRANSACTIONS_UNIFIED_TESTS_PATH="${data_dir}/transactions/unified" +export UNIFIED_FORMAT_TESTS_PATH="${data_dir}/unified-format" +export URI_OPTIONS_TESTS_PATH="${data_dir}/uri-options" +export VERSIONED_API_TESTS_PATH="${data_dir}/versioned-api" +export WITH_TRANSACTION_TESTS_PATH="${data_dir}/with_transaction" +export INDEX_MANAGEMENT_TESTS_PATH="${data_dir}/index-management" + +pushd "${working_dir:?}/../drivers-evergreen-tools" +DRIVERS_TOOLS="$(pwd)" +if [[ "${OSTYPE:?}" =~ cygwin ]]; then + DRIVERS_TOOLS="$(cygpath -m "${DRIVERS_TOOLS:?}")" fi -popd # ../../drivers-evergreen-tools +export DRIVERS_TOOLS +popd # "${working_dir:?}/../drivers-evergreen-tools" -export MONGOCXX_TEST_TLS_CA_FILE="$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem" +export MONGOCXX_TEST_TLS_CA_FILE="${DRIVERS_TOOLS:?}/.evergreen/x509gen/ca.pem" if [ "$(uname -m)" == "ppc64le" ]; then echo "Skipping CSFLE test setup (CDRIVER-4246/CXX-2423)" @@ -115,38 +119,40 @@ else set +o xtrace echo "Setting temporary credentials..." - pushd "$DRIVERS_TOOLS/.evergreen/csfle" - export AWS_SECRET_ACCESS_KEY="${cse_aws_secret_access_key}" - export AWS_ACCESS_KEY_ID="${cse_aws_access_key_id}" + pushd "${DRIVERS_TOOLS:?}/.evergreen/csfle" + export AWS_SECRET_ACCESS_KEY="${cse_aws_secret_access_key:?}" + export AWS_ACCESS_KEY_ID="${cse_aws_access_key_id:?}" export AWS_DEFAULT_REGION="us-east-1" echo "Running activate-kmstlsvenv.sh..." + # shellcheck source=/dev/null . ./activate-kmstlsvenv.sh echo "Running activate-kmstlsvenv.sh... done." echo "Running set-temp-creds.sh..." + # shellcheck source=/dev/null . ./set-temp-creds.sh echo "Running set-temp-creds.sh... done." deactivate - popd # "$DRIVERS_TOOLS/.evergreen/csfle" + popd # "${DRIVERS_TOOLS:?}/.evergreen/csfle" echo "Setting temporary credentials... done." # Ensure temporary credentials were properly set. - if [ -z "$CSFLE_AWS_TEMP_ACCESS_KEY_ID" ]; then + if [ -z "${CSFLE_AWS_TEMP_ACCESS_KEY_ID:-}" ]; then echo "Failed to set temporary credentials!" exit 1 fi - export MONGOCXX_TEST_CSFLE_TLS_CA_FILE=$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem - export MONGOCXX_TEST_CSFLE_TLS_CERTIFICATE_KEY_FILE=$DRIVERS_TOOLS/.evergreen/x509gen/client.pem + export MONGOCXX_TEST_CSFLE_TLS_CA_FILE=${DRIVERS_TOOLS:?}/.evergreen/x509gen/ca.pem + export MONGOCXX_TEST_CSFLE_TLS_CERTIFICATE_KEY_FILE=${DRIVERS_TOOLS:?}/.evergreen/x509gen/client.pem export MONGOCXX_TEST_AWS_TEMP_ACCESS_KEY_ID="$CSFLE_AWS_TEMP_ACCESS_KEY_ID" export MONGOCXX_TEST_AWS_TEMP_SECRET_ACCESS_KEY="$CSFLE_AWS_TEMP_SECRET_ACCESS_KEY" export MONGOCXX_TEST_AWS_TEMP_SESSION_TOKEN="$CSFLE_AWS_TEMP_SESSION_TOKEN" - export MONGOCXX_TEST_AWS_SECRET_ACCESS_KEY="${cse_aws_secret_access_key}" - export MONGOCXX_TEST_AWS_ACCESS_KEY_ID="${cse_aws_access_key_id}" - export MONGOCXX_TEST_AZURE_TENANT_ID="${cse_azure_tenant_id}" - export MONGOCXX_TEST_AZURE_CLIENT_ID="${cse_azure_client_id}" - export MONGOCXX_TEST_AZURE_CLIENT_SECRET="${cse_azure_client_secret}" - export MONGOCXX_TEST_GCP_EMAIL="${cse_gcp_email}" - export MONGOCXX_TEST_GCP_PRIVATEKEY="${cse_gcp_privatekey}" + export MONGOCXX_TEST_AWS_SECRET_ACCESS_KEY="${cse_aws_secret_access_key:?}" + export MONGOCXX_TEST_AWS_ACCESS_KEY_ID="${cse_aws_access_key_id:?}" + export MONGOCXX_TEST_AZURE_TENANT_ID="${cse_azure_tenant_id:?}" + export MONGOCXX_TEST_AZURE_CLIENT_ID="${cse_azure_client_id:?}" + export MONGOCXX_TEST_AZURE_CLIENT_SECRET="${cse_azure_client_secret:?}" + export MONGOCXX_TEST_GCP_EMAIL="${cse_gcp_email:?}" + export MONGOCXX_TEST_GCP_PRIVATEKEY="${cse_gcp_privatekey:?}" set -o errexit fi @@ -157,23 +163,21 @@ else # Register CA certificate required by KMS TLS connections. echo "Registering CA certificate for KMS TLS tests..." register_ca_cert() { - local OS=$(uname -s | tr '[:upper:]' '[:lower:]') - echo "register_ca_cert: OS: $OS" - case "$OSTYPE" in + case "${OSTYPE:?}" in cygwin*) - certutil.exe -addstore "Root" "$DRIVERS_TOOLS\.evergreen\x509gen\ca.pem" + certutil.exe -addstore "Root" "${DRIVERS_TOOLS:?}\.evergreen\x509gen\ca.pem" ;; darwin*) - sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain $DRIVERS_TOOLS/.evergreen/x509gen/ca.pem + sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain "${DRIVERS_TOOLS:?}/.evergreen/x509gen/ca.pem" ;; *) if [ -f /etc/redhat-release ]; then # CSE KMS TLS tests are disabled on RHEL due to sudo permissions. See BUILD-14068. - # sudo cp -v $DRIVERS_TOOLS/.evergreen/x509gen/ca.pem /usr/share/pki/ca-trust-source/anchors/cdriver.crt + # sudo cp -v ${DRIVERS_TOOLS:?}/.evergreen/x509gen/ca.pem /usr/share/pki/ca-trust-source/anchors/cdriver.crt # sudo update-ca-trust extract --verbose export MONGOCXX_TEST_SKIP_KMS_TLS_TESTS=1 else - sudo cp -v $DRIVERS_TOOLS/.evergreen/x509gen/ca.pem /usr/local/share/ca-certificates/cdriver.crt + sudo cp -v "${DRIVERS_TOOLS:?}/.evergreen/x509gen/ca.pem" /usr/local/share/ca-certificates/cdriver.crt sudo update-ca-certificates --verbose fi ;; @@ -184,10 +188,11 @@ else # Ensure mock KMS servers are running before starting tests. wait_for_kms_server() { - for i in $(seq 60); do + port="${1:?}" + for _ in $(seq 60); do # Exit code 7: "Failed to connect to host". if - curl -s "localhost:$1" + curl -s "localhost:${port:?}" (($? != 7)) then return 0 @@ -195,7 +200,7 @@ else sleep 1 fi done - echo "Could not detect mock KMS server on port $1" + echo "Could not detect mock KMS server on port ${port:?}" return 1 } echo "Waiting for mock KMS servers to start..." @@ -207,14 +212,16 @@ else echo "Waiting for mock KMS servers to start... done." fi -if [[ "$OSTYPE" =~ cygwin ]]; then - CTEST_OUTPUT_ON_FAILURE=1 MSBuild.exe /p:Configuration=${build_type} /verbosity:minimal RUN_TESTS.vcxproj +pushd "${working_dir:?}/build" + +if [[ "${OSTYPE:?}" =~ cygwin ]]; then + CTEST_OUTPUT_ON_FAILURE=1 MSBuild.exe /p:Configuration="${build_type:?}" /verbosity:minimal RUN_TESTS.vcxproj # Only run examples if MONGODB_API_VERSION is unset. We do not append # API version to example clients, so examples will fail when requireApiVersion # is true. if [[ -z "$MONGODB_API_VERSION" ]]; then echo "Running examples..." - if ! CTEST_OUTPUT_ON_FAILURE=1 MSBuild.exe /p:Configuration=${build_type} /verbosity:minimal examples/run-examples.vcxproj >|output.txt 2>&1; then + if ! CTEST_OUTPUT_ON_FAILURE=1 MSBuild.exe /p:Configuration="${build_type:?}" /verbosity:minimal examples/run-examples.vcxproj >|output.txt 2>&1; then # Only emit output on failure. cat output.txt 1>&2 exit 1 @@ -223,31 +230,28 @@ if [[ "$OSTYPE" =~ cygwin ]]; then fi else # ENABLE_SLOW_TESTS is required to run the slow tests that are disabled by default. The slow tests should not be run if explicitly disabled. - if [ -z "${disable_slow_tests}" ]; then - export MONGOCXX_ENABLE_SLOW_TESTS=1 + if [ -z "${disable_slow_tests:-}" ]; then + export MONGOCXX_ENABLE_SLOW_TESTS="1" fi ulimit -c unlimited || true - if [ "${use_mongocryptd}" = "true" ]; then + if [ "${use_mongocryptd:-}" = "true" ]; then echo "Will run tests using mongocryptd (instead of crypt_shared library)" else echo "Will run tests using crypt_shared library (instead of mongocryptd)" - # Set by run-orchestration.sh in "start_mongod". - export CRYPT_SHARED_LIB_PATH="${CRYPT_SHARED_LIB_PATH}" - echo "CRYPT_SHARED_LIB_PATH=$CRYPT_SHARED_LIB_PATH" + echo "CRYPT_SHARED_LIB_PATH=${CRYPT_SHARED_LIB_PATH:?}" fi - export ASAN_OPTIONS="detect_leaks=1" - export UBSAN_OPTIONS="print_stacktrace=1" - - run_test() { $@; } + run_test() { "$@"; } - if [[ "${TEST_WITH_ASAN}" == "ON" || "${TEST_WITH_UBSAN}" == "ON" ]]; then - export PATH="/usr/lib/llvm-3.8/bin:$PATH" - elif [[ "${TEST_WITH_VALGRIND}" == "ON" ]]; then + if [[ "${TEST_WITH_ASAN:-}" == "ON" || "${TEST_WITH_UBSAN:-}" == "ON" ]]; then + export ASAN_OPTIONS="detect_leaks=1" + export UBSAN_OPTIONS="print_stacktrace=1" + export PATH="/usr/lib/llvm-3.8/bin:${PATH:-}" + elif [[ "${TEST_WITH_VALGRIND:-}" == "ON" ]]; then run_test() { - valgrind --leak-check=full --track-origins=yes --num-callers=50 --error-exitcode=1 --error-limit=no --read-var-info=yes --suppressions=../etc/memcheck.suppressions $@ + valgrind --leak-check=full --track-origins=yes --num-callers=50 --error-exitcode=1 --error-limit=no --read-var-info=yes --suppressions=../etc/memcheck.suppressions "$@" } fi @@ -268,15 +272,15 @@ else # Some platforms like OS X don't support the /mode syntax to the -perm option # of find(1), and some platforms like Ubuntu 16.04 don't support the +mode # syntax, so we use Perl to help us find executable files. - EXAMPLES=$(find examples -type f | sort | perl -nlwe 'print if -x') + EXAMPLES="$(find examples -type f | sort | perl -nlwe 'print if -x')" # Only run examples if MONGODB_API_VERSION is unset. We do not append # API version to example clients, so examples will fail when requireApiVersion # is true. - if [[ -z "$MONGODB_API_VERSION" ]]; then - for test in $EXAMPLES; do - echo "Running $test" - case "$test" in + if [[ -z "${MONGODB_API_VERSION:-}" ]]; then + for test in ${EXAMPLES:?}; do + echo "Running ${test:?}" + case "${test:?}" in *encryption*) echo " - Skipping client side encryption example" ;; @@ -293,7 +297,7 @@ else echo " - TODO CXX-1201, enable for servers that support transactions" ;; *) - if ! run_test $test >|output.txt 2>&1; then + if ! run_test "${test:?}" >|output.txt 2>&1; then # Only emit output on failure. cat output.txt 1>&2 exit 1 @@ -304,45 +308,56 @@ else fi fi -popd # ./build +popd # "${working_dir:?}/build" -export CMAKE_PREFIX_PATH=$PREFIX:$(pwd)/build/install -if [ -n "${lib_dir}" ]; then - export PKG_CONFIG_PATH=$PREFIX/${lib_dir}/pkgconfig:$(pwd)/build/install/${lib_dir}/pkgconfig +CMAKE_PREFIX_PATH="${mongoc_dir:?}:${working_dir:?}/build/install" +export CMAKE_PREFIX_PATH + +PKG_CONFIG_PATH="" +if [ -n "${lib_dir:-}" ]; then + PKG_CONFIG_PATH+=":${mongoc_dir:?}/${lib_dir:?}/pkgconfig" + PKG_CONFIG_PATH+=":${working_dir:?}/build/install/${lib_dir:?}/pkgconfig" else - export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig:$(pwd)/build/install/lib/pkgconfig + PKG_CONFIG_PATH+=":${mongoc_dir:?}/lib/pkgconfig" + PKG_CONFIG_PATH+=":${working_dir:?}/build/install/lib/pkgconfig" fi -export USE_STATIC_LIBS="${USE_STATIC_LIBS}" -export BUILD_TYPE="${build_type}" +export PKG_CONFIG_PATH +# Environment variables used by example projects. +export BUILD_TYPE="${build_type:?}" export CXXFLAGS="${example_projects_cxxflags}" export LDFLAGS="${example_projects_ldflags}" export CC="${example_projects_cc}" export CXX="${example_projects_cxx}" export CXX_STANDARD="${example_projects_cxx_standard}" + if [[ "$OSTYPE" =~ cygwin ]]; then export MSVC=1 elif [ "$(uname -s | tr '[:upper:]' '[:lower:]')" == "darwin" ]; then - export DYLD_LIBRARY_PATH="$(pwd)/build/install/lib:$DYLD_LIBRARY_PATH" + DYLD_LIBRARY_PATH="$(pwd)/build/install/lib:${DYLD_LIBRARY_PATH:-}" + export DYLD_LIBRARY_PATH else - if [ -n "${lib_dir}" ]; then # only needed on Linux - export LD_LIBRARY_PATH="$(pwd)/build/install/${lib_dir}:$LD_LIBRARY_PATH" + if [ -n "${lib_dir:-}" ]; then # only needed on Linux + LD_LIBRARY_PATH="${working_dir:?}/build/install/${lib_dir:?}:${LD_LIBRARY_PATH:-}" else - export LD_LIBRARY_PATH="$(pwd)/build/install/lib:$LD_LIBRARY_PATH" + LD_LIBRARY_PATH="${working_dir:?}/build/install/lib:${LD_LIBRARY_PATH:-}" fi + export LD_LIBRARY_PATH fi + # The example projects never run under valgrind, since we haven't added execution # logic to handle `run_test()`. # # Only run example projects if MONGODB_API_VERSION is unset. We do not append # API version to example clients, so example projects will fail when requireApiVersion # is true. -if [[ -z "$MONGODB_API_VERSION" ]]; then +if [[ -z "${MONGODB_API_VERSION:-}" ]]; then echo "Building example projects..." - . "$PREFIX/.evergreen/scripts/find-cmake-latest.sh" + # shellcheck source=/dev/null + . "${mongoc_dir:?}/.evergreen/scripts/find-cmake-latest.sh" export cmake_binary cmake_binary="$(find_cmake_latest)" - command -v "$cmake_binary" + command -v "${cmake_binary:?}" .evergreen/build_example_projects.sh echo "Building example projects... done." fi diff --git a/.mci.yml b/.mci.yml index 66c314353f..e14bd49a3c 100644 --- a/.mci.yml +++ b/.mci.yml @@ -436,7 +436,7 @@ functions: working_dir: "mongo-cxx-driver" include_expansions_in_env: - build_type - - CRYPT_SHARED_LIB_PATH + - CRYPT_SHARED_LIB_PATH # Set by run-orchestration.sh in "start_mongod". - cse_aws_access_key_id - cse_aws_secret_access_key - cse_azure_client_id From 8e2bd991d7e13ecbc8160d959af3c69c1d1a1b15 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Fri, 27 Oct 2023 14:04:00 -0500 Subject: [PATCH 22/28] Substitute use of CMake flag anchors with in-script variables --- .evergreen/compile.sh | 104 ++++++++++++++++++++++++++++++++++++++++-- .mci.yml | 89 +++++++++--------------------------- 2 files changed, 122 insertions(+), 71 deletions(-) diff --git a/.evergreen/compile.sh b/.evergreen/compile.sh index 98443e98db..70120a3b26 100755 --- a/.evergreen/compile.sh +++ b/.evergreen/compile.sh @@ -30,7 +30,6 @@ export CMAKE_BUILD_PARALLEL_LEVEL case "$OS" in darwin|linux) - GENERATOR=${GENERATOR:-"Unix Makefiles"} CMAKE_EXAMPLES_TARGET=examples if [ "$RUN_DISTCHECK" ]; then _RUN_DISTCHECK=$RUN_DISTCHECK @@ -38,7 +37,6 @@ case "$OS" in ;; cygwin*) - GENERATOR=${GENERATOR:-"Visual Studio 14 2015 Win64"} CMAKE_BUILD_OPTS="/verbosity:minimal" CMAKE_EXAMPLES_TARGET=examples/examples ;; @@ -50,7 +48,107 @@ case "$OS" in esac cd build -"${cmake_binary}" -G "$GENERATOR" "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" -DBUILD_TESTING=ON -DMONGOCXX_ENABLE_SLOW_TESTS=ON -DENABLE_UNINSTALL=ON "$@" .. + +cmake_flags=( + -DCMAKE_BUILD_TYPE=${BUILD_TYPE} + -DCMAKE_PREFIX_PATH="${MONGOC_PREFIX:?}" + -DBUILD_TESTING=ON + -DMONGOCXX_ENABLE_SLOW_TESTS=ON + -DCMAKE_INSTALL_PREFIX=install + -DENABLE_UNINSTALL=ON + ${ADDL_OPTS:-} +) + +case "${OSTYPE:?}" in +cygwin) + case "${generator:-}" in + *2015*) cmake_flags+=(-DBOOST_ROOT=C:/local/boost_1_60_0) ;; + *2017*) cmake_flags+=(-DCMAKE_CXX_STANDARD=17) ;; + *) echo "missing CMake Generator on Windows distro" 1>&2; exit 1 ;; + esac + ;; +darwin*|linux*) + : ${generator:="Unix Makefiles"} + ;; +*) + echo "unrecognized operating system ${OSTYPE:?}" 1>&2 + exit 1 + ;; +esac +export CMAKE_GENERATOR="${generator:?}" + +if [[ "${USE_POLYFILL_STD_EXPERIMENTAL:-}" == "ON" ]]; then + cmake_flags+=(-DCMAKE_CXX_STANDARD=14 -DBSONCXX_POLY_USE_STD_EXPERIMENTAL=ON) +fi + +if [[ "${USE_POLYFILL_BOOST:-}" == "ON" ]]; then + cmake_flags+=(-DBSONCXX_POLY_USE_BOOST=ON) +fi + +cc_flags_init=(-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers) +cxx_flags_init=(-Wall -Wextra -Wconversion -Wnarrowing -pedantic -Werror) +cc_flags=() +cxx_flags=() + +case "${OSTYPE:?}" in +cygwin) + ;; +darwin*) + cc_flags+=("${cc_flags_init[@]}") + cxx_flags+=("${cxx_flags_init[@]}" -stdlib=libc++) + ;; +linux*) + cc_flags+=("${cc_flags_init[@]}") + cxx_flags+=("${cxx_flags_init[@]}" -Wno-expansion-to-defined -Wno-missing-field-initializers) + ;; +*) + echo "unrecognized operating system ${OSTYPE:?}" 1>&2 + exit 1 + ;; +esac + +# Sanitizers overwrite the usual compiler flags. +if [[ "${USE_SANITIZER_ASAN:-}" == "ON" ]]; then + cxx_flags=( + "${cxx_flags_init[@]}" + -D_GLIBCXX_USE_CXX11_ABI=0 + -fsanitize=address + -O1 -g -fno-omit-frame-pointer + ) +fi +if [[ "${USE_SANITIZER_UBSAN:-}" == "ON" ]]; then + cxx_flags=( + "${cxx_flags_init[@]}" + -D_GLIBCXX_USE_CXX11_ABI=0 + -fsanitize=undefined + -fsanitize-blacklist="$(pwd)/../etc/ubsan.ignorelist" + -fno-sanitize-recover=undefined + -O1 -g -fno-omit-frame-pointer + ) +fi + +# Ignore warnings generated by core::optional in mnmlstc/core. +if [[ "${HOSTTYPE:?}" == powerpc64le ]]; then + cxx_flags+=(-Wno-error=maybe-uninitialized) +fi + +# Ignore deprecation warnings when building on a release branch. +if [ "$(echo "${branch_name:?}" | cut -f2 -d'/')" != "${branch_name:?}" ]; then + cc_flags+=(-Wno-deprecated-declarations) + cxx_flags+=(-Wno-deprecated-declarations) +fi + +if [[ "${#cc_flags[@]}" > 0 ]]; then + cmake_flags+=("-DCMAKE_C_FLAGS=${cc_flags[*]}") +fi + +if [[ "${#cxx_flags[@]}" > 0 ]]; then + cmake_flags+=("-DCMAKE_CXX_FLAGS=${cxx_flags[*]}") +fi + +echo "Configuring with CMake flags: ${cmake_flags[*]}" + +"${cmake_binary}" "${cmake_flags[@]}" .. if [[ "${COMPILE_MACRO_GUARD_TESTS:-"OFF"}" == "ON" ]]; then # We only need to compile the macro guard tests. diff --git a/.mci.yml b/.mci.yml index e14bd49a3c..2d09e48a9d 100644 --- a/.mci.yml +++ b/.mci.yml @@ -14,20 +14,6 @@ variables: # - LIBMONGOC_REQUIRED_VERSION in src/mongocxx/CMakeLists.txt mongoc_version_minimum: &mongoc_version_minimum "1.24.0" - ## cmake flag variables - cmake_flags: - linux_cmake_flags: &linux_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wconversion -Wnarrowing -Wno-expansion-to-defined -pedantic -Werror -Wno-missing-field-initializers $ignore_deprecated" - macos_cmake_flags: &macos_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-stdlib=libc++ -Wall -Wextra -Wconversion -Wnarrowing -pedantic -Werror $ignore_deprecated" - asan_cmake_flags: &asan_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=address -O1 -g -fno-omit-frame-pointer -Wall -Wextra -Wconversion -Wnarrowing -pedantic -Werror $ignore_deprecated" - ubsan_cmake_flags: &ubsan_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=undefined -fsanitize-blacklist=$(pwd)/etc/ubsan.ignorelist -fno-sanitize-recover=undefined -O1 -g -fno-omit-frame-pointer -Wall -Wextra -Wconversion -Wnarrowing -pedantic -Werror $ignore_deprecated" - msvc2015_cmake_flags: &msvc2015_cmake_flags -DBOOST_ROOT=c:/local/boost_1_60_0 - msvc2015_generator: &msvc2015_generator Visual Studio 14 2015 Win64 - msvc2017_cmake_flags: &msvc2017_cmake_flags -DCMAKE_CXX_STANDARD=17 - msvc2017_generator: &msvc2017_generator Visual Studio 15 2017 Win64 - - # power8_cmake_flags includes -Wno-maybe-uninitialized to ignore a warning from the std::optional implementation of MNMLSTC. - power8_cmake_flags: &power8_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wconversion -Wnarrowing -Wno-expansion-to-defined -pedantic -Werror -Wno-missing-field-initializers $ignore_deprecated -Wno-error=maybe-uninitialized" - integration_matrix: integration_matrix_tasks_single: &integration_matrix_tasks_single tasks: @@ -53,12 +39,10 @@ variables: - name: compile_and_test_with_shared_libs_sharded_cluster_with_libmongocrypt integration_matrix_expansions_linux: &integration_matrix_expansions_linux build_type: "Debug" - cmake_flags: *linux_cmake_flags ENABLE_CODE_COVERAGE: ON integration_matrix_expansions_windows: &integration_matrix_expansions_windows - cmake_flags: *msvc2017_cmake_flags build_type: "Debug" # Same for Windows and Linux - generator: *msvc2017_generator + generator: Visual Studio 15 2017 Win64 example_projects_cxx_standard: 17 ####################################### @@ -356,7 +340,14 @@ functions: params: shell: bash working_dir: "mongo-cxx-driver" - include_expansions_in_env: ["distro_id"] + include_expansions_in_env: + - branch_name + - distro_id + - generator + - USE_POLYFILL_BOOST + - USE_POLYFILL_STD_EXPERIMENTAL + - USE_SANITIZER_ASAN + - USE_SANITIZER_UBSAN env: CC: ${cc_compiler} CXX: ${cxx_compiler} @@ -419,15 +410,7 @@ functions: venvcreate "$(find_python3)" venv python -m pip install GitPython - export GENERATOR="${generator}" - - ignore_deprecated="" - if [ "$(echo ${branch_name} | cut -f2 -d'/')" != "${branch_name}" ]; then - # ignore deprecation warnings when building on a release branch - ignore_deprecated=-Wno-deprecated-declarations - fi - - .evergreen/compile.sh -DCMAKE_PREFIX_PATH="$MONGOC_PREFIX" ${cmake_flags} ${poly_flags} $ADDL_OPTS -DCMAKE_INSTALL_PREFIX=install + ADDL_OPTS="$ADDL_OPTS" MONGOC_PREFIX="$MONGOC_PREFIX" .evergreen/compile.sh "test": - command: shell.exec @@ -1357,7 +1340,6 @@ buildvariants: display_name: "RHEL 9 Release (MongoDB Latest)" expansions: build_type: "Release" - cmake_flags: *linux_cmake_flags mongodb_version: "latest" lib_dir: "lib64" run_on: @@ -1377,7 +1359,6 @@ buildvariants: display_name: "arm64 RHEL 9 Release (MongoDB Latest)" expansions: build_type: "Release" - cmake_flags: *linux_cmake_flags mongodb_version: "latest" lib_dir: "lib64" run_on: @@ -1397,7 +1378,6 @@ buildvariants: display_name: "Debian 11 Release (MongoDB Latest)" expansions: build_type: "Release" - cmake_flags: *linux_cmake_flags mongodb_version: "latest" run_on: - debian11-large @@ -1417,7 +1397,6 @@ buildvariants: display_name: "Debian 11 Release (MongoDB 5.0)" expansions: build_type: "Release" - cmake_flags: *linux_cmake_flags mongodb_version: "5.0" run_on: - debian11-large @@ -1437,7 +1416,6 @@ buildvariants: display_name: "Debian 10 Release (MongoDB Latest)" expansions: build_type: "Release" - cmake_flags: *linux_cmake_flags mongodb_version: "latest" run_on: - debian10-large @@ -1455,7 +1433,6 @@ buildvariants: display_name: "Debian 10 Release (MongoDB 5.0)" expansions: build_type: "Release" - cmake_flags: *linux_cmake_flags mongodb_version: "5.0" run_on: - debian10-large @@ -1473,7 +1450,6 @@ buildvariants: display_name: "Ubuntu 20.04 Release (MongoDB Latest)" expansions: build_type: "Release" - cmake_flags: *linux_cmake_flags mongodb_version: "latest" run_on: - ubuntu2004-large @@ -1491,7 +1467,6 @@ buildvariants: display_name: "Ubuntu 20.04 Release (MongoDB 5.0)" expansions: build_type: "Release" - cmake_flags: *linux_cmake_flags mongodb_version: "5.0" run_on: - ubuntu2004-large @@ -1509,7 +1484,6 @@ buildvariants: display_name: "Ubuntu 18.04 Release (MongoDB 5.0)" expansions: build_type: "Release" - cmake_flags: *linux_cmake_flags mongodb_version: "5.0" run_on: - ubuntu1804-build @@ -1529,8 +1503,7 @@ buildvariants: display_name: "Ubuntu 16.04 Debug (std::experimental) (MongoDB 4.4)" expansions: build_type: "Debug" - cmake_flags: *linux_cmake_flags - poly_flags: -DBSONCXX_POLY_USE_STD_EXPERIMENTAL=ON -DCMAKE_CXX_STANDARD=14 + USE_POLYFILL_STD_EXPERIMENTAL: ON mongodb_version: "4.4" example_projects_cxx_standard: 14 use_mongocryptd: true # crypt_shared is not available for Ubuntu 16.04 @@ -1546,7 +1519,6 @@ buildvariants: display_name: "Valgrind Ubuntu 20.04 Debug (MongoDB Latest)" expansions: build_type: "Debug" - cmake_flags: *linux_cmake_flags TEST_WITH_VALGRIND: "ON" mongodb_version: "latest" disable_slow_tests: 1 @@ -1563,7 +1535,6 @@ buildvariants: display_name: "Valgrind Ubuntu 18.04 Debug (MongoDB 5.0)" expansions: build_type: "Debug" - cmake_flags: *linux_cmake_flags TEST_WITH_VALGRIND: "ON" mongodb_version: "5.0" disable_slow_tests: 1 @@ -1582,7 +1553,7 @@ buildvariants: build_type: "Debug" cc_compiler: clang cxx_compiler: clang++ - cmake_flags: *asan_cmake_flags + USE_SANITIZER_ASAN: ON TEST_WITH_ASAN: "ON" mongodb_version: "latest" example_projects_cc: clang @@ -1603,7 +1574,7 @@ buildvariants: build_type: "Debug" cc_compiler: clang cxx_compiler: clang++ - cmake_flags: *asan_cmake_flags + USE_SANITIZER_ASAN: ON TEST_WITH_ASAN: "ON" mongodb_version: "5.0" example_projects_cc: clang @@ -1624,7 +1595,7 @@ buildvariants: build_type: "Debug" cc_compiler: clang cxx_compiler: clang++ - cmake_flags: *ubsan_cmake_flags + USE_SANITIZER_UBSAN: ON TEST_WITH_UBSAN: "ON" mongodb_version: "latest" example_projects_cc: clang @@ -1646,7 +1617,7 @@ buildvariants: build_type: "Debug" cc_compiler: clang cxx_compiler: clang++ - cmake_flags: *ubsan_cmake_flags + USE_SANITIZER_UBSAN: ON TEST_WITH_UBSAN: "ON" mongodb_version: "5.0" example_projects_cc: clang @@ -1666,7 +1637,6 @@ buildvariants: display_name: "Ubuntu 20.04 Debug (MongoDB Latest) (Extra)" expansions: build_type: "Debug" - cmake_flags: *linux_cmake_flags mongodb_version: "latest" run_on: - ubuntu2004-build @@ -1679,7 +1649,6 @@ buildvariants: display_name: "Ubuntu 20.04 Debug (GCC)" expansions: build_type: "Debug" - cmake_flags: *linux_cmake_flags mongodb_version: "latest" cc_compiler: gcc cxx_compiler: g++ @@ -1693,7 +1662,6 @@ buildvariants: display_name: "Ubuntu 20.04 Debug (Clang)" expansions: build_type: "Debug" - cmake_flags: *linux_cmake_flags mongodb_version: "latest" cc_compiler: clang cxx_compiler: clang++ @@ -1708,7 +1676,6 @@ buildvariants: display_name: "Mongohouse Test" expansions: build_type: "Release" - cmake_flags: *linux_cmake_flags mongodb_version: "latest" run_on: ubuntu2004-test tasks: @@ -1719,7 +1686,6 @@ buildvariants: batchtime: 1440 # 1 day expansions: build_type: "Release" - cmake_flags: *linux_cmake_flags mongodb_version: "latest" cmake: "cmake" lib_dir: "lib64" @@ -1737,7 +1703,6 @@ buildvariants: batchtime: 1440 # 1 day expansions: build_type: "Release" - cmake_flags: *linux_cmake_flags mongodb_version: "6.0" cmake: "cmake" lib_dir: "lib64" @@ -1755,7 +1720,6 @@ buildvariants: batchtime: 1440 # 1 day expansions: build_type: "Release" - cmake_flags: *linux_cmake_flags mongodb_version: "5.0" cmake: "cmake" lib_dir: "lib64" @@ -1773,7 +1737,6 @@ buildvariants: batchtime: 1440 # 1 day expansions: build_type: "Release" - cmake_flags: *power8_cmake_flags mongodb_version: "latest" cmake: "cmake" lib_dir: "lib64" @@ -1791,7 +1754,6 @@ buildvariants: batchtime: 1440 # 1 day expansions: build_type: "Release" - cmake_flags: *power8_cmake_flags mongodb_version: "5.0" cmake: "cmake" lib_dir: "lib64" @@ -1809,7 +1771,6 @@ buildvariants: batchtime: 1440 # 1 day expansions: build_type: "Release" - cmake_flags: *linux_cmake_flags mongodb_version: "latest" run_on: - ubuntu2004-arm64-build @@ -1824,7 +1785,6 @@ buildvariants: batchtime: 1440 # 1 day expansions: build_type: "Release" - cmake_flags: *linux_cmake_flags mongodb_version: "5.0" run_on: - ubuntu1804-arm64-build @@ -1840,7 +1800,6 @@ buildvariants: batchtime: 1440 # 1 day expansions: build_type: "Debug" - cmake_flags: *linux_cmake_flags mongodb_version: "latest" mongoc_version: *mongoc_version_minimum run_on: @@ -1858,8 +1817,7 @@ buildvariants: display_name: "MacOS 11.0 Release (Boost) (MongoDB Latest)" expansions: build_type: "Release" - cmake_flags: *macos_cmake_flags - poly_flags: -DBSONCXX_POLY_USE_BOOST=ON + USE_POLYFILL_BOOST: ON mongodb_version: "latest" run_on: - macos-1100 @@ -1873,8 +1831,7 @@ buildvariants: display_name: "MacOS 11.0 Release (Boost) (MongoDB 5.0)" expansions: build_type: "Release" - cmake_flags: *macos_cmake_flags - poly_flags: -DBSONCXX_POLY_USE_BOOST=ON + USE_POLYFILL_BOOST: ON mongodb_version: "5.0" run_on: - macos-1100 @@ -1888,8 +1845,7 @@ buildvariants: display_name: "MacOS 11.0 Release Versioned API" expansions: build_type: "Release" - cmake_flags: *macos_cmake_flags - poly_flags: -DBSONCXX_POLY_USE_BOOST=ON + USE_POLYFILL_BOOST: ON mongodb_version: "latest" run_on: - macos-1100 @@ -1901,9 +1857,8 @@ buildvariants: display_name: "Windows (VS 2015) Release (MongoDB 4.2)" expansions: build_type: "Release" - cmake_flags: *msvc2015_cmake_flags mongodb_version: "4.2" - generator: *msvc2015_generator + generator: Visual Studio 14 2015 Win64 run_on: - windows-64-vs2015-compile tasks: @@ -1917,9 +1872,8 @@ buildvariants: display_name: "Windows (VS 2015) Debug Static (MongoDB 4.2)" expansions: build_type: "Debug" - cmake_flags: *msvc2015_cmake_flags mongodb_version: "4.2" - generator: *msvc2015_generator + generator: Visual Studio 14 2015 Win64 run_on: - windows-64-vs2015-compile tasks: @@ -1931,8 +1885,7 @@ buildvariants: display_name: "Windows (VS 2015) Debug (MongoDB 4.2)" expansions: build_type: "Debug" - cmake_flags: *msvc2015_cmake_flags - generator: *msvc2015_generator + generator: Visual Studio 14 2015 Win64 mongodb_version: "4.2" run_on: - windows-64-vs2015-compile From ce5e14556505afd78cbb65ca252afdc46fcfc614 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Mon, 30 Oct 2023 11:00:32 -0500 Subject: [PATCH 23/28] Move compile commands into .evergreen/compile.sh --- .evergreen/compile.sh | 72 ++++++++++++++++++++++++++++++++++++------- .mci.yml | 68 +++++----------------------------------- 2 files changed, 69 insertions(+), 71 deletions(-) diff --git a/.evergreen/compile.sh b/.evergreen/compile.sh index 70120a3b26..3c21f7f86b 100755 --- a/.evergreen/compile.sh +++ b/.evergreen/compile.sh @@ -6,13 +6,47 @@ # This script should be run from the root of the repository. This script will run the build from # the default build directory './build'. The following environment variables will change the # behavior of this script: -# - BUILD_TYPE: must be set to "Release" or "Debug" +# - build_type: must be set to "Release" or "Debug" set -o errexit set -o pipefail -if [ "$BUILD_TYPE" != "Debug" -a "$BUILD_TYPE" != "Release" ]; then - echo "$0: expected BUILD_TYPE environment variable to be set to 'Debug' or 'Release'" >&2 +# Add MSBuild.exe to path. +if [[ "${OSTYPE:?}" == "cygwin" ]]; then + case "${generator:-}" in + *2015*) + PATH="/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/MSBuild/14.0/Bin:$PATH" + ;; + *2017*) + PATH="/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin:$PATH" + ;; + esac +fi +export PATH + +mongoc_prefix="$(pwd)/../mongoc" +echo "mongoc_prefix=${mongoc_prefix:?}" + +if [[ "${OSTYPE:?}" =~ cygwin ]]; then + mongoc_prefix=$(cygpath -m "${mongoc_prefix:?}") +fi + +. "${mongoc_prefix:?}/.evergreen/scripts/find-cmake-latest.sh" +export cmake_binary +cmake_binary="$(find_cmake_latest)" +command -v "$cmake_binary" + +if [ ! -d ../drivers-evergreen-tools ]; then + git clone --depth 1 git@github.com:mongodb-labs/drivers-evergreen-tools.git ../drivers-evergreen-tools +fi +. ../drivers-evergreen-tools/.evergreen/find-python3.sh +. ../drivers-evergreen-tools/.evergreen/venv-utils.sh + +venvcreate "$(find_python3)" venv +python -m pip install GitPython + +if [ "$build_type" != "Debug" -a "$build_type" != "Release" ]; then + echo "$0: expected build_type environment variable to be set to 'Debug' or 'Release'" >&2 exit 1 fi @@ -50,13 +84,12 @@ esac cd build cmake_flags=( - -DCMAKE_BUILD_TYPE=${BUILD_TYPE} - -DCMAKE_PREFIX_PATH="${MONGOC_PREFIX:?}" + -DCMAKE_BUILD_TYPE=${build_type} + -DCMAKE_PREFIX_PATH="${mongoc_prefix:?}" -DBUILD_TESTING=ON -DMONGOCXX_ENABLE_SLOW_TESTS=ON -DCMAKE_INSTALL_PREFIX=install -DENABLE_UNINSTALL=ON - ${ADDL_OPTS:-} ) case "${OSTYPE:?}" in @@ -146,6 +179,23 @@ if [[ "${#cxx_flags[@]}" > 0 ]]; then cmake_flags+=("-DCMAKE_CXX_FLAGS=${cxx_flags[*]}") fi +if [[ "${ENABLE_CODE_COVERAGE:-}" == "ON" ]]; then + cmake_flags+=("-DENABLE_CODE_COVERAGE=ON") +fi + +if [ "${USE_STATIC_LIBS:-}" ]; then + cmake_flags+=("-DBUILD_SHARED_LIBS=OFF") +fi + +if [ "${ENABLE_TESTS:-}" = "OFF" ]; then + cmake_flags+=("-DENABLE_TESTS=OFF") +fi + +if [[ -n "${REQUIRED_CXX_STANDARD:-}" ]]; then + cmake_flags+=("-DCMAKE_CXX_STANDARD=${REQUIRED_CXX_STANDARD:?}") + cmake_flags+=("-DCMAKE_CXX_STANDARD_REQUIRED=ON") +fi + echo "Configuring with CMake flags: ${cmake_flags[*]}" "${cmake_binary}" "${cmake_flags[@]}" .. @@ -153,15 +203,15 @@ echo "Configuring with CMake flags: ${cmake_flags[*]}" if [[ "${COMPILE_MACRO_GUARD_TESTS:-"OFF"}" == "ON" ]]; then # We only need to compile the macro guard tests. "${cmake_binary}" -DENABLE_MACRO_GUARD_TESTS=ON .. - "${cmake_binary}" --build . --config $BUILD_TYPE --target test_bsoncxx_macro_guards test_mongocxx_macro_guards -- $CMAKE_BUILD_OPTS + "${cmake_binary}" --build . --config $build_type --target test_bsoncxx_macro_guards test_mongocxx_macro_guards -- $CMAKE_BUILD_OPTS exit # Nothing else to be done. fi # Regular build and install routine. -"${cmake_binary}" --build . --config $BUILD_TYPE -- $CMAKE_BUILD_OPTS -"${cmake_binary}" --build . --config $BUILD_TYPE --target install -- $CMAKE_BUILD_OPTS -"${cmake_binary}" --build . --config $BUILD_TYPE --target $CMAKE_EXAMPLES_TARGET -- $CMAKE_BUILD_OPTS +"${cmake_binary}" --build . --config $build_type -- $CMAKE_BUILD_OPTS +"${cmake_binary}" --build . --config $build_type --target install -- $CMAKE_BUILD_OPTS +"${cmake_binary}" --build . --config $build_type --target $CMAKE_EXAMPLES_TARGET -- $CMAKE_BUILD_OPTS if [ "$_RUN_DISTCHECK" ]; then - "${cmake_binary}" --build . --config $BUILD_TYPE --target distcheck + "${cmake_binary}" --build . --config $build_type --target distcheck fi diff --git a/.mci.yml b/.mci.yml index 2d09e48a9d..994d1d787c 100644 --- a/.mci.yml +++ b/.mci.yml @@ -342,75 +342,23 @@ functions: working_dir: "mongo-cxx-driver" include_expansions_in_env: - branch_name + - build_type + - COMPILE_MACRO_GUARD_TESTS - distro_id + - ENABLE_CODE_COVERAGE + - ENABLE_TESTS - generator + - REQUIRED_CXX_STANDARD + - RUN_DISTCHECK - USE_POLYFILL_BOOST - USE_POLYFILL_STD_EXPERIMENTAL - USE_SANITIZER_ASAN - USE_SANITIZER_UBSAN + - USE_STATIC_LIBS env: CC: ${cc_compiler} CXX: ${cxx_compiler} - script: | - set -o errexit - set -o pipefail - export BUILD_TYPE=${build_type} - export COMPILE_MACRO_GUARD_TESTS=${COMPILE_MACRO_GUARD_TESTS} - export RUN_DISTCHECK=${RUN_DISTCHECK} - - # Add MSBuild.exe to path. - if [[ "$OSTYPE" == "cygwin" ]]; then - case "${generator}" in - *2015*) - PATH="/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/MSBuild/14.0/Bin:$PATH" - ;; - *2017*) - PATH="/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin:$PATH" - ;; - esac - fi - export PATH - - ADDL_OPTS="" - - if [[ "${ENABLE_CODE_COVERAGE}" == "ON" ]]; then - ADDL_OPTS+="-DENABLE_CODE_COVERAGE=ON" - fi - - if [ "${USE_STATIC_LIBS}" ]; then - ADDL_OPTS="$ADDL_OPTS -DBUILD_SHARED_LIBS=OFF" - fi - - if [ "${ENABLE_TESTS}" = "OFF" ]; then - ADDL_OPTS="$ADDL_OPTS -DENABLE_TESTS=OFF" - fi - - if [[ -n "${REQUIRED_CXX_STANDARD}" ]]; then - ADDL_OPTS="$ADDL_OPTS -DCMAKE_CXX_STANDARD=${REQUIRED_CXX_STANDARD} -DCMAKE_CXX_STANDARD_REQUIRED=ON" - fi - - MONGOC_PREFIX="$(pwd)/../mongoc" - echo "MONGOC_PREFIX=$MONGOC_PREFIX" - - if [[ "$OSTYPE" =~ cygwin ]]; then - MONGOC_PREFIX=$(cygpath -m "$MONGOC_PREFIX") - fi - - . "$MONGOC_PREFIX/.evergreen/scripts/find-cmake-latest.sh" - export cmake_binary - cmake_binary="$(find_cmake_latest)" - command -v "$cmake_binary" - - if [ ! -d ../drivers-evergreen-tools ]; then - git clone --depth 1 git@github.com:mongodb-labs/drivers-evergreen-tools.git ../drivers-evergreen-tools - fi - . ../drivers-evergreen-tools/.evergreen/find-python3.sh - . ../drivers-evergreen-tools/.evergreen/venv-utils.sh - - venvcreate "$(find_python3)" venv - python -m pip install GitPython - - ADDL_OPTS="$ADDL_OPTS" MONGOC_PREFIX="$MONGOC_PREFIX" .evergreen/compile.sh + script: .evergreen/compile.sh "test": - command: shell.exec From 8d1362316cfdd73d328956d37bee11dd0a7fc70e Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Mon, 30 Oct 2023 12:23:32 -0500 Subject: [PATCH 24/28] Tidy compile.sh --- .evergreen/compile.sh | 245 ++++++++++++++++------------ CMakeLists.txt | 26 ++- cmake/make_dist/MakeDistCheck.cmake | 15 ++ 3 files changed, 178 insertions(+), 108 deletions(-) diff --git a/.evergreen/compile.sh b/.evergreen/compile.sh index 3c21f7f86b..4cf00fbb53 100755 --- a/.evergreen/compile.sh +++ b/.evergreen/compile.sh @@ -11,16 +11,32 @@ set -o errexit set -o pipefail +: "${branch_name:?}" +: "${build_type:?}" +: "${distro_id:?}" + +: "${COMPILE_MACRO_GUARD_TESTS:-}" +: "${ENABLE_CODE_COVERAGE:-}" +: "${ENABLE_TESTS:-}" +: "${generator:-}" +: "${REQUIRED_CXX_STANDARD:-}" +: "${RUN_DISTCHECK:-}" +: "${USE_POLYFILL_BOOST:-}" +: "${USE_POLYFILL_STD_EXPERIMENTAL:-}" +: "${USE_SANITIZER_ASAN:-}" +: "${USE_SANITIZER_UBSAN:-}" +: "${USE_STATIC_LIBS:-}" + # Add MSBuild.exe to path. if [[ "${OSTYPE:?}" == "cygwin" ]]; then - case "${generator:-}" in - *2015*) - PATH="/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/MSBuild/14.0/Bin:$PATH" - ;; - *2017*) - PATH="/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin:$PATH" - ;; - esac + case "${generator:-}" in + *2015*) + PATH="/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/MSBuild/14.0/Bin:$PATH" + ;; + *2017*) + PATH="/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin:$PATH" + ;; + esac fi export PATH @@ -28,172 +44,187 @@ mongoc_prefix="$(pwd)/../mongoc" echo "mongoc_prefix=${mongoc_prefix:?}" if [[ "${OSTYPE:?}" =~ cygwin ]]; then - mongoc_prefix=$(cygpath -m "${mongoc_prefix:?}") + mongoc_prefix=$(cygpath -m "${mongoc_prefix:?}") fi +# shellcheck source=/dev/null . "${mongoc_prefix:?}/.evergreen/scripts/find-cmake-latest.sh" export cmake_binary cmake_binary="$(find_cmake_latest)" command -v "$cmake_binary" if [ ! -d ../drivers-evergreen-tools ]; then - git clone --depth 1 git@github.com:mongodb-labs/drivers-evergreen-tools.git ../drivers-evergreen-tools + git clone --depth 1 git@github.com:mongodb-labs/drivers-evergreen-tools.git ../drivers-evergreen-tools fi +# shellcheck source=/dev/null . ../drivers-evergreen-tools/.evergreen/find-python3.sh +# shellcheck source=/dev/null . ../drivers-evergreen-tools/.evergreen/venv-utils.sh venvcreate "$(find_python3)" venv python -m pip install GitPython -if [ "$build_type" != "Debug" -a "$build_type" != "Release" ]; then - echo "$0: expected build_type environment variable to be set to 'Debug' or 'Release'" >&2 - exit 1 +if [[ "${build_type:?}" != "Debug" && "${build_type:?}" != "Release" ]]; then + echo "$0: expected build_type environment variable to be set to 'Debug' or 'Release'" >&2 + exit 1 fi -OS=$(uname -s | tr '[:upper:]' '[:lower:]') - -if [ -f /proc/cpuinfo ]; then - CMAKE_BUILD_PARALLEL_LEVEL=$(grep -c ^processor /proc/cpuinfo) -elif which sysctl; then - CMAKE_BUILD_PARALLEL_LEVEL=$(sysctl -n hw.logicalcpu) -else - echo "$0: can't figure out what build parallel level to use" >&2 - exit 1 +if [[ "${OSTYPE}" == darwin* ]]; then + # MacOS does not have nproc. + nproc() { + sysctl -n hw.logicalcpu + } fi +CMAKE_BUILD_PARALLEL_LEVEL="$(nproc)" export CMAKE_BUILD_PARALLEL_LEVEL -case "$OS" in - darwin|linux) - CMAKE_EXAMPLES_TARGET=examples - if [ "$RUN_DISTCHECK" ]; then - _RUN_DISTCHECK=$RUN_DISTCHECK - fi - ;; - - cygwin*) - CMAKE_BUILD_OPTS="/verbosity:minimal" - CMAKE_EXAMPLES_TARGET=examples/examples - ;; - - *) - echo "$0: unsupported platform '$OS'" >&2 - exit 2 - ;; +# Use ccache if available. +if command -v ccache >/dev/null; then + echo "Enabling ccache as CMake compiler launcher" + export CMAKE_C_COMPILER_LAUNCHER=ccache + export CMAKE_CXX_COMPILER_LAUNCHER=ccache +fi + +cmake_build_opts=() +case "${OSTYPE:?}" in +cygwin) + cmake_build_opts+=("/verbosity:minimal") + cmake_examples_target="examples/examples" + ;; + +darwin* | linux*) + cmake_examples_target="examples" + ;; + +*) + echo "unrecognized operating system ${OSTYPE:?}" 1>&2 + exit 1 + ;; esac +: "${cmake_examples_target:?}" cd build cmake_flags=( - -DCMAKE_BUILD_TYPE=${build_type} - -DCMAKE_PREFIX_PATH="${mongoc_prefix:?}" - -DBUILD_TESTING=ON - -DMONGOCXX_ENABLE_SLOW_TESTS=ON - -DCMAKE_INSTALL_PREFIX=install - -DENABLE_UNINSTALL=ON + "-DCMAKE_BUILD_TYPE=${build_type:?}" + "-DCMAKE_PREFIX_PATH=${mongoc_prefix:?}" + -DBUILD_TESTING=ON + -DMONGOCXX_ENABLE_SLOW_TESTS=ON + -DCMAKE_INSTALL_PREFIX=install + -DENABLE_UNINSTALL=ON ) +_RUN_DISTCHECK="" case "${OSTYPE:?}" in cygwin) - case "${generator:-}" in - *2015*) cmake_flags+=(-DBOOST_ROOT=C:/local/boost_1_60_0) ;; - *2017*) cmake_flags+=(-DCMAKE_CXX_STANDARD=17) ;; - *) echo "missing CMake Generator on Windows distro" 1>&2; exit 1 ;; - esac - ;; -darwin*|linux*) - : ${generator:="Unix Makefiles"} - ;; + case "${generator:-}" in + *2015*) cmake_flags+=("-DBOOST_ROOT=C:/local/boost_1_60_0") ;; + *2017*) cmake_flags+=("-DCMAKE_CXX_STANDARD=17") ;; + *) + echo "missing CMake Generator on Windows distro" 1>&2 + exit 1 + ;; + esac + ;; +darwin* | linux*) + : "${generator:="Unix Makefiles"}" + + # If enabled, limit distcheck to Unix-like systems only. + _RUN_DISTCHECK="${RUN_DISTCHECK:-}" + ;; *) - echo "unrecognized operating system ${OSTYPE:?}" 1>&2 - exit 1 - ;; + echo "unrecognized operating system ${OSTYPE:?}" 1>&2 + exit 1 + ;; esac export CMAKE_GENERATOR="${generator:?}" if [[ "${USE_POLYFILL_STD_EXPERIMENTAL:-}" == "ON" ]]; then - cmake_flags+=(-DCMAKE_CXX_STANDARD=14 -DBSONCXX_POLY_USE_STD_EXPERIMENTAL=ON) + cmake_flags+=( + "-DCMAKE_CXX_STANDARD=14" + "-DBSONCXX_POLY_USE_STD_EXPERIMENTAL=ON" + ) fi if [[ "${USE_POLYFILL_BOOST:-}" == "ON" ]]; then - cmake_flags+=(-DBSONCXX_POLY_USE_BOOST=ON) + cmake_flags+=("-DBSONCXX_POLY_USE_BOOST=ON") fi - + cc_flags_init=(-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers) cxx_flags_init=(-Wall -Wextra -Wconversion -Wnarrowing -pedantic -Werror) cc_flags=() cxx_flags=() case "${OSTYPE:?}" in -cygwin) - ;; +cygwin) ;; darwin*) - cc_flags+=("${cc_flags_init[@]}") - cxx_flags+=("${cxx_flags_init[@]}" -stdlib=libc++) - ;; + cc_flags+=("${cc_flags_init[@]}") + cxx_flags+=("${cxx_flags_init[@]}" -stdlib=libc++) + ;; linux*) - cc_flags+=("${cc_flags_init[@]}") - cxx_flags+=("${cxx_flags_init[@]}" -Wno-expansion-to-defined -Wno-missing-field-initializers) - ;; + cc_flags+=("${cc_flags_init[@]}") + cxx_flags+=("${cxx_flags_init[@]}" -Wno-expansion-to-defined -Wno-missing-field-initializers) + ;; *) - echo "unrecognized operating system ${OSTYPE:?}" 1>&2 - exit 1 - ;; + echo "unrecognized operating system ${OSTYPE:?}" 1>&2 + exit 1 + ;; esac # Sanitizers overwrite the usual compiler flags. if [[ "${USE_SANITIZER_ASAN:-}" == "ON" ]]; then - cxx_flags=( - "${cxx_flags_init[@]}" - -D_GLIBCXX_USE_CXX11_ABI=0 - -fsanitize=address - -O1 -g -fno-omit-frame-pointer - ) + cxx_flags=( + "${cxx_flags_init[@]}" + -D_GLIBCXX_USE_CXX11_ABI=0 + -fsanitize=address + -O1 -g -fno-omit-frame-pointer + ) fi if [[ "${USE_SANITIZER_UBSAN:-}" == "ON" ]]; then - cxx_flags=( - "${cxx_flags_init[@]}" - -D_GLIBCXX_USE_CXX11_ABI=0 - -fsanitize=undefined - -fsanitize-blacklist="$(pwd)/../etc/ubsan.ignorelist" - -fno-sanitize-recover=undefined - -O1 -g -fno-omit-frame-pointer - ) + cxx_flags=( + "${cxx_flags_init[@]}" + -D_GLIBCXX_USE_CXX11_ABI=0 + -fsanitize=undefined + -fsanitize-blacklist="$(pwd)/../etc/ubsan.ignorelist" + -fno-sanitize-recover=undefined + -O1 -g -fno-omit-frame-pointer + ) fi # Ignore warnings generated by core::optional in mnmlstc/core. -if [[ "${HOSTTYPE:?}" == powerpc64le ]]; then - cxx_flags+=(-Wno-error=maybe-uninitialized) +if [[ "${OSTYPE:?}" == linux* && "${HOSTTYPE:?}" == powerpc64le ]]; then + cxx_flags+=(-Wno-error=maybe-uninitialized) fi # Ignore deprecation warnings when building on a release branch. if [ "$(echo "${branch_name:?}" | cut -f2 -d'/')" != "${branch_name:?}" ]; then - cc_flags+=(-Wno-deprecated-declarations) - cxx_flags+=(-Wno-deprecated-declarations) + cc_flags+=(-Wno-deprecated-declarations) + cxx_flags+=(-Wno-deprecated-declarations) fi -if [[ "${#cc_flags[@]}" > 0 ]]; then - cmake_flags+=("-DCMAKE_C_FLAGS=${cc_flags[*]}") +if [[ "${#cc_flags[@]}" -gt 0 ]]; then + cmake_flags+=("-DCMAKE_C_FLAGS=${cc_flags[*]}") fi -if [[ "${#cxx_flags[@]}" > 0 ]]; then - cmake_flags+=("-DCMAKE_CXX_FLAGS=${cxx_flags[*]}") +if [[ "${#cxx_flags[@]}" -gt 0 ]]; then + cmake_flags+=("-DCMAKE_CXX_FLAGS=${cxx_flags[*]}") fi if [[ "${ENABLE_CODE_COVERAGE:-}" == "ON" ]]; then - cmake_flags+=("-DENABLE_CODE_COVERAGE=ON") + cmake_flags+=("-DENABLE_CODE_COVERAGE=ON") fi if [ "${USE_STATIC_LIBS:-}" ]; then - cmake_flags+=("-DBUILD_SHARED_LIBS=OFF") + cmake_flags+=("-DBUILD_SHARED_LIBS=OFF") fi if [ "${ENABLE_TESTS:-}" = "OFF" ]; then - cmake_flags+=("-DENABLE_TESTS=OFF") + cmake_flags+=("-DENABLE_TESTS=OFF") fi if [[ -n "${REQUIRED_CXX_STANDARD:-}" ]]; then - cmake_flags+=("-DCMAKE_CXX_STANDARD=${REQUIRED_CXX_STANDARD:?}") - cmake_flags+=("-DCMAKE_CXX_STANDARD_REQUIRED=ON") + cmake_flags+=("-DCMAKE_CXX_STANDARD=${REQUIRED_CXX_STANDARD:?}") + cmake_flags+=("-DCMAKE_CXX_STANDARD_REQUIRED=ON") fi echo "Configuring with CMake flags: ${cmake_flags[*]}" @@ -201,17 +232,17 @@ echo "Configuring with CMake flags: ${cmake_flags[*]}" "${cmake_binary}" "${cmake_flags[@]}" .. if [[ "${COMPILE_MACRO_GUARD_TESTS:-"OFF"}" == "ON" ]]; then - # We only need to compile the macro guard tests. - "${cmake_binary}" -DENABLE_MACRO_GUARD_TESTS=ON .. - "${cmake_binary}" --build . --config $build_type --target test_bsoncxx_macro_guards test_mongocxx_macro_guards -- $CMAKE_BUILD_OPTS - exit # Nothing else to be done. + # We only need to compile the macro guard tests. + "${cmake_binary}" -DENABLE_MACRO_GUARD_TESTS=ON .. + "${cmake_binary}" --build . --config "${build_type:?}" --target test_bsoncxx_macro_guards test_mongocxx_macro_guards -- "${cmake_build_opts[@]}" + exit # Nothing else to be done. fi # Regular build and install routine. -"${cmake_binary}" --build . --config $build_type -- $CMAKE_BUILD_OPTS -"${cmake_binary}" --build . --config $build_type --target install -- $CMAKE_BUILD_OPTS -"${cmake_binary}" --build . --config $build_type --target $CMAKE_EXAMPLES_TARGET -- $CMAKE_BUILD_OPTS +"${cmake_binary}" --build . --config "${build_type:?}" -- "${cmake_build_opts[@]}" +"${cmake_binary}" --build . --config "${build_type:?}" --target install -- "${cmake_build_opts[@]}" +"${cmake_binary}" --build . --config "${build_type:?}" --target "${cmake_examples_target:?}" -- "${cmake_build_opts[@]}" -if [ "$_RUN_DISTCHECK" ]; then - "${cmake_binary}" --build . --config $build_type --target distcheck +if [[ "${_RUN_DISTCHECK:-}" ]]; then + "${cmake_binary}" --build . --config "${build_type:?}" --target distcheck fi diff --git a/CMakeLists.txt b/CMakeLists.txt index 57b1b3d80e..7ea45475a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -428,12 +428,36 @@ add_custom_command(OUTPUT ${DIST_FILE} if(NOT(TARGET dist OR TARGET distcheck)) add_custom_target(dist DEPENDS ${DIST_FILE}) + # Ensure distcheck inherits polyfill library selection. + set(polyfill_flags "") + if (NOT "${CMAKE_CXX_STANDARD}" STREQUAL "") + list(APPEND polyfill_flags "-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}") + endif () + if (NOT "${BOOST_ROOT}" STREQUAL "") + list(APPEND polyfill_flags "-DBOOST_ROOT=${BOOST_ROOT}") + endif () + if (NOT "${BSONCXX_POLY_USE_MNMLSTC}" STREQUAL "") + list(APPEND polyfill_flags "-DBSONCXX_POLY_USE_MNMLSTC=${BSONCXX_POLY_USE_MNMLSTC}") + endif() + if (NOT "${BSONCXX_POLY_USE_STD_EXPERIMENTAL}" STREQUAL "") + list(APPEND polyfill_flags "-DBSONCXX_POLY_USE_STD_EXPERIMENTAL=${BSONCXX_POLY_USE_STD_EXPERIMENTAL}") + endif() + if (NOT "${BSONCXX_POLY_USE_SYSTEM_MNMLSTC}" STREQUAL "") + list(APPEND polyfill_flags "-DBSONCXX_POLY_USE_SYSTEM_MNMLSTC=${BSONCXX_POLY_USE_SYSTEM_MNMLSTC}") + endif() + if (NOT "${BSONCXX_POLY_USE_BOOST}" STREQUAL "") + list(APPEND polyfill_flags "-DBSONCXX_POLY_USE_BOOST=${BSONCXX_POLY_USE_BOOST}") + endif() + if (NOT "${BSONCXX_POLY_USE_STD}" STREQUAL "") + list(APPEND polyfill_flags "-DBSONCXX_POLY_USE_STD=${BSONCXX_POLY_USE_STD}") + endif() + add_custom_target(distcheck DEPENDS dist COMMAND ${CMAKE_COMMAND} -D CMAKE_MODULE_PATH=${PROJECT_SOURCE_DIR}/cmake/make_dist -D CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -D PACKAGE_PREFIX=${PACKAGE_PREFIX} - -D CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} + ${polyfill_flags} -P ${PROJECT_SOURCE_DIR}/cmake/make_dist/MakeDistCheck.cmake ) endif() diff --git a/cmake/make_dist/MakeDistCheck.cmake b/cmake/make_dist/MakeDistCheck.cmake index eca454be42..d6576fe3a8 100644 --- a/cmake/make_dist/MakeDistCheck.cmake +++ b/cmake/make_dist/MakeDistCheck.cmake @@ -36,6 +36,21 @@ function (RUN_DIST_CHECK PACKAGE_PREFIX EXT) if (NOT "${BOOST_ROOT}" STREQUAL "") list(APPEND polyfill_flags "-DBOOST_ROOT=${BOOST_ROOT}") endif () + if (NOT "${BSONCXX_POLY_USE_MNMLSTC}" STREQUAL "") + list(APPEND polyfill_flags "-DBSONCXX_POLY_USE_MNMLSTC=${BSONCXX_POLY_USE_MNMLSTC}") + endif() + if (NOT "${BSONCXX_POLY_USE_STD_EXPERIMENTAL}" STREQUAL "") + list(APPEND polyfill_flags "-DBSONCXX_POLY_USE_STD_EXPERIMENTAL=${BSONCXX_POLY_USE_STD_EXPERIMENTAL}") + endif() + if (NOT "${BSONCXX_POLY_USE_SYSTEM_MNMLSTC}" STREQUAL "") + list(APPEND polyfill_flags "-DBSONCXX_POLY_USE_SYSTEM_MNMLSTC=${BSONCXX_POLY_USE_SYSTEM_MNMLSTC}") + endif() + if (NOT "${BSONCXX_POLY_USE_BOOST}" STREQUAL "") + list(APPEND polyfill_flags "-DBSONCXX_POLY_USE_BOOST=${BSONCXX_POLY_USE_BOOST}") + endif() + if (NOT "${BSONCXX_POLY_USE_STD}" STREQUAL "") + list(APPEND polyfill_flags "-DBSONCXX_POLY_USE_STD=${BSONCXX_POLY_USE_STD}") + endif() execute_process_and_check_result ( COMMAND ${CMAKE_COMMAND} -E echo "Configuring distcheck with CMake flags: ${polyfill_flags}" From c65d3dce103a7afa88d165897d43dc282579ac95 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 2 Nov 2023 14:39:28 -0500 Subject: [PATCH 25/28] Remove minimum libmongoc variant --- .mci.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.mci.yml b/.mci.yml index 994d1d787c..4f4f9777f7 100644 --- a/.mci.yml +++ b/.mci.yml @@ -1742,22 +1742,6 @@ buildvariants: - name: compile_and_test_with_static_libs - name: compile_and_test_with_static_libs_extra_alignment - # Test that we actually support building against the minimum required C version claimed. - - name: ubuntu2004-min-libmongoc - display_name: "Ubuntu 20.04 with minimum libmongoc (MongoDB Latest)" - batchtime: 1440 # 1 day - expansions: - build_type: "Debug" - mongodb_version: "latest" - mongoc_version: *mongoc_version_minimum - run_on: - - ubuntu2004-build - tasks: - - name: compile_and_test_with_shared_libs - - name: compile_and_test_with_shared_libs_extra_alignment - - name: compile_and_test_with_static_libs - - name: compile_and_test_with_static_libs_extra_alignment - ####################################### # Mac and Windows # ####################################### From 2c302fb8539879e413fed27dc28ce000f3f5ca6e Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 2 Nov 2023 14:41:37 -0500 Subject: [PATCH 26/28] Add error handling for MSBuild path selection --- .evergreen/compile.sh | 6 +++++- .evergreen/test.sh | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.evergreen/compile.sh b/.evergreen/compile.sh index 4cf00fbb53..ec35759fd1 100755 --- a/.evergreen/compile.sh +++ b/.evergreen/compile.sh @@ -36,6 +36,10 @@ if [[ "${OSTYPE:?}" == "cygwin" ]]; then *2017*) PATH="/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin:$PATH" ;; + *) + echo "missing explicit CMake Generator on Windows distro" 1>&2 + exit 1 + ;; esac fi export PATH @@ -121,7 +125,7 @@ cygwin) *2015*) cmake_flags+=("-DBOOST_ROOT=C:/local/boost_1_60_0") ;; *2017*) cmake_flags+=("-DCMAKE_CXX_STANDARD=17") ;; *) - echo "missing CMake Generator on Windows distro" 1>&2 + echo "missing explicit CMake Generator on Windows distro" 1>&2 exit 1 ;; esac diff --git a/.evergreen/test.sh b/.evergreen/test.sh index 0e939d107e..a5b70390af 100755 --- a/.evergreen/test.sh +++ b/.evergreen/test.sh @@ -49,6 +49,10 @@ if [[ "$OSTYPE" == "cygwin" ]]; then *2017*) PATH="/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin:$PATH" ;; + *) + echo "missing explicit CMake Generator on Windows distro" 1>&2 + exit 1 + ;; esac fi export PATH From 83aa493927b9608af037f6a415f2810e5aa1dfcc Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 2 Nov 2023 14:43:18 -0500 Subject: [PATCH 27/28] Add note for indirect requirement of distro_id env var --- .evergreen/compile.sh | 2 +- .evergreen/test.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.evergreen/compile.sh b/.evergreen/compile.sh index ec35759fd1..2973296a2e 100755 --- a/.evergreen/compile.sh +++ b/.evergreen/compile.sh @@ -13,7 +13,7 @@ set -o pipefail : "${branch_name:?}" : "${build_type:?}" -: "${distro_id:?}" +: "${distro_id:?}" # Required by find-cmake-latest.sh. : "${COMPILE_MACRO_GUARD_TESTS:-}" : "${ENABLE_CODE_COVERAGE:-}" diff --git a/.evergreen/test.sh b/.evergreen/test.sh index a5b70390af..d81dff76c1 100755 --- a/.evergreen/test.sh +++ b/.evergreen/test.sh @@ -11,7 +11,7 @@ set -o pipefail : "${cse_azure_tenant_id:?}" : "${cse_gcp_email:?}" : "${cse_gcp_privatekey:?}" -: "${distro_id:?}" +: "${distro_id:?}" # Required by find-cmake-latest.sh. : "${CRYPT_SHARED_LIB_PATH:-}" : "${disable_slow_tests:-}" From a05641843df2592735eb70f2f11c4fd7328c86e8 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 2 Nov 2023 14:45:29 -0500 Subject: [PATCH 28/28] Merge else branches for CSFLE test setup commands --- .evergreen/test.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.evergreen/test.sh b/.evergreen/test.sh index d81dff76c1..97ae5df168 100755 --- a/.evergreen/test.sh +++ b/.evergreen/test.sh @@ -159,11 +159,7 @@ else export MONGOCXX_TEST_GCP_PRIVATEKEY="${cse_gcp_privatekey:?}" set -o errexit -fi -if [ "$(uname -m)" == "ppc64le" ]; then - echo "Skipping CSFLE test setup (CDRIVER-4246/CXX-2423)" -else # Register CA certificate required by KMS TLS connections. echo "Registering CA certificate for KMS TLS tests..." register_ca_cert() {