Skip to content

Commit 418e219

Browse files
authored
CXX-2661 Add macos-1100 tasks and move ubuntu1404 -> ubuntu2204 (#974)
* CXX-2661 Add macos-1100 tests * Address -Wrange-loop-analysis warnings * CXX-2657 Move GCC/Clang debug compile tasks from ubuntu1404 to ubuntu2204 * Detect Boost polyfill via CMakeCXXSymbolExists
1 parent 21fa739 commit 418e219

File tree

6 files changed

+87
-41
lines changed

6 files changed

+87
-41
lines changed

.mci.yml

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,29 +1612,29 @@ buildvariants:
16121612
- name: clang-tidy
16131613
- name: compile_without_tests
16141614

1615-
- name: ubuntu1404-debug-gcc
1616-
display_name: "Ubuntu 14.04 Debug (g++ 4.8)"
1615+
- name: ubuntu2204-debug-gcc
1616+
display_name: "Ubuntu 22.04 Debug (GCC)"
16171617
expansions:
16181618
build_type: "Debug"
16191619
tar_options: *linux_tar_options
16201620
cmake_flags: *linux_cmake_flags
16211621
mongodb_version: *version_latest
16221622
compiler: g++
16231623
run_on:
1624-
- ubuntu1404-small
1624+
- ubuntu2204-small
16251625
tasks:
16261626
- name: compile_without_tests
16271627

1628-
- name: ubuntu1404-debug-clang
1629-
display_name: "Ubuntu 14.04 Debug (clang++ 3.4)"
1628+
- name: ubuntu2204-debug-clang
1629+
display_name: "Ubuntu 22.04 Debug (Clang)"
16301630
expansions:
16311631
build_type: "Debug"
16321632
tar_options: *linux_tar_options
16331633
cmake_flags: *linux_cmake_flags
16341634
mongodb_version: *version_latest
16351635
compiler: clang++
16361636
run_on:
1637-
- ubuntu1404-small
1637+
- ubuntu2204-small
16381638
tasks:
16391639
- name: compile_without_tests
16401640

@@ -1797,7 +1797,7 @@ buildvariants:
17971797
#######################################
17981798
# Mac and Windows #
17991799
#######################################
1800-
- name: macos-1014-latest
1800+
- name: macos-1014-latest # CXX-2661: remove in favor of macos-1100.
18011801
display_name: "MacOS 10.14 Release (Boost) (MongoDB Latest)"
18021802
expansions:
18031803
build_type: "Release"
@@ -1813,7 +1813,7 @@ buildvariants:
18131813
- name: compile_and_test_with_static_libs
18141814
- name: compile_and_test_with_static_libs_extra_alignment
18151815

1816-
- name: macos-1014-50
1816+
- name: macos-1014-50 # CXX-2661: remove in favor of macos-1100.
18171817
display_name: "MacOS 10.14 Release (Boost) (MongoDB 5.0)"
18181818
expansions:
18191819
build_type: "Release"
@@ -1829,7 +1829,7 @@ buildvariants:
18291829
- name: compile_and_test_with_static_libs
18301830
- name: compile_and_test_with_static_libs_extra_alignment
18311831

1832-
- name: macos-1014-versioned-api
1832+
- name: macos-1014-versioned-api # CXX-2661: remove in favor of macos-1100.
18331833
display_name: "MacOS 10.14 Release Versioned API"
18341834
expansions:
18351835
build_type: "Release"
@@ -1843,6 +1843,52 @@ buildvariants:
18431843
- name: test_versioned_api
18441844
- name: test_versioned_api_accept_version_two
18451845

1846+
- name: macos-1100-latest
1847+
display_name: "MacOS 11.0 Release (Boost) (MongoDB Latest)"
1848+
expansions:
1849+
build_type: "Release"
1850+
extra_path: *macos_extra_path
1851+
cmake_flags: *macos_cmake_flags
1852+
poly_flags: *poly_boost_flags
1853+
mongodb_version: *version_latest
1854+
run_on:
1855+
- macos-1100
1856+
tasks:
1857+
- name: compile_and_test_with_shared_libs
1858+
- name: compile_and_test_with_shared_libs_extra_alignment
1859+
- name: compile_and_test_with_static_libs
1860+
- name: compile_and_test_with_static_libs_extra_alignment
1861+
1862+
- name: macos-1100-50
1863+
display_name: "MacOS 11.0 Release (Boost) (MongoDB 5.0)"
1864+
expansions:
1865+
build_type: "Release"
1866+
extra_path: *macos_extra_path
1867+
cmake_flags: *macos_cmake_flags
1868+
poly_flags: *poly_boost_flags
1869+
mongodb_version: *version_50
1870+
run_on:
1871+
- macos-1100
1872+
tasks:
1873+
- name: compile_and_test_with_shared_libs
1874+
- name: compile_and_test_with_shared_libs_extra_alignment
1875+
- name: compile_and_test_with_static_libs
1876+
- name: compile_and_test_with_static_libs_extra_alignment
1877+
1878+
- name: macos-1100-versioned-api
1879+
display_name: "MacOS 11.0 Release Versioned API"
1880+
expansions:
1881+
build_type: "Release"
1882+
extra_path: *macos_extra_path
1883+
cmake_flags: *macos_cmake_flags
1884+
poly_flags: *poly_boost_flags
1885+
mongodb_version: *version_latest
1886+
run_on:
1887+
- macos-1100
1888+
tasks:
1889+
- name: test_versioned_api
1890+
- name: test_versioned_api_accept_version_two
1891+
18461892
- name: windows-2k8-release
18471893
display_name: "Windows (VS 2015) Release (MongoDB 4.2)"
18481894
expansions:

examples/projects/bsoncxx/cmake-deprecated/shared/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ find_package(libbsoncxx REQUIRED)
4040

4141
add_executable(hello_bsoncxx ../../hello_bsoncxx.cpp)
4242

43-
# Visual Studio pre 2017 requires boost polyfill.
44-
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
45-
if (CMAKE_CXX_STANDARD LESS 17)
46-
find_package(Boost 1.56.0 REQUIRED)
47-
target_link_libraries(hello_bsoncxx PRIVATE Boost::boost)
48-
target_compile_definitions(hello_bsoncxx PRIVATE BSONCXX_POLY_USE_BOOST=ON)
49-
endif ()
43+
# Deprecated libbsoncxx CMake config does not automatically handle the Boost polyfill dependency.
44+
include(CheckCXXSymbolExists)
45+
set(CMAKE_REQUIRED_INCLUDES ${LIBBSONCXX_INCLUDE_DIRS})
46+
check_cxx_symbol_exists(BSONCXX_POLY_USE_BOOST "bsoncxx/config/config.hpp" NEEDS_BOOST_POLYFILL)
47+
if (NEEDS_BOOST_POLYFILL)
48+
find_package(Boost 1.56.0 REQUIRED)
49+
target_link_libraries(hello_bsoncxx PRIVATE Boost::boost)
5050
endif()
5151

5252
target_include_directories(hello_bsoncxx

examples/projects/bsoncxx/cmake-deprecated/static/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ find_package(libbsoncxx-static REQUIRED)
4040

4141
add_executable(hello_bsoncxx ../../hello_bsoncxx.cpp)
4242

43-
# Visual Studio pre 2017 requires boost polyfill.
44-
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
45-
if (CMAKE_CXX_STANDARD LESS 17)
46-
find_package(Boost 1.56.0 REQUIRED)
47-
target_link_libraries(hello_bsoncxx PRIVATE Boost::boost)
48-
target_compile_definitions(hello_bsoncxx PRIVATE BSONCXX_POLY_USE_BOOST=ON)
49-
endif ()
43+
# Deprecated libbsoncxx CMake config does not automatically handle the Boost polyfill dependency.
44+
include(CheckCXXSymbolExists)
45+
set(CMAKE_REQUIRED_INCLUDES ${LIBBSONCXX_STATIC_INCLUDE_DIRS})
46+
check_cxx_symbol_exists(BSONCXX_POLY_USE_BOOST "bsoncxx/config/config.hpp" NEEDS_BOOST_POLYFILL)
47+
if (NEEDS_BOOST_POLYFILL)
48+
find_package(Boost 1.56.0 REQUIRED)
49+
target_link_libraries(hello_bsoncxx PRIVATE Boost::boost)
5050
endif()
5151

5252
target_include_directories(hello_bsoncxx

examples/projects/mongocxx/cmake-deprecated/shared/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ find_package(libmongocxx REQUIRED)
4040

4141
add_executable(hello_mongocxx ../../hello_mongocxx.cpp)
4242

43-
# Visual Studio pre 2017 requires boost polyfill.
44-
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
45-
if (CMAKE_CXX_STANDARD LESS 17)
46-
find_package(Boost 1.56.0 REQUIRED)
47-
target_link_libraries(hello_mongocxx PRIVATE Boost::boost)
48-
target_compile_definitions(hello_mongocxx PRIVATE BSONCXX_POLY_USE_BOOST=ON)
49-
endif ()
43+
# Deprecated libbsoncxx CMake config does not automatically handle the Boost polyfill dependency.
44+
include(CheckCXXSymbolExists)
45+
set(CMAKE_REQUIRED_INCLUDES ${LIBMONGOCXX_INCLUDE_DIRS})
46+
check_cxx_symbol_exists(BSONCXX_POLY_USE_BOOST "bsoncxx/config/config.hpp" NEEDS_BOOST_POLYFILL)
47+
if (NEEDS_BOOST_POLYFILL)
48+
find_package(Boost 1.56.0 REQUIRED)
49+
target_link_libraries(hello_mongocxx PRIVATE Boost::boost)
5050
endif()
5151

5252
target_include_directories(hello_mongocxx

examples/projects/mongocxx/cmake-deprecated/static/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ find_package(libmongocxx-static REQUIRED)
4040

4141
add_executable(hello_mongocxx ../../hello_mongocxx.cpp)
4242

43-
# Visual Studio pre 2017 requires boost polyfill.
44-
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
45-
if (CMAKE_CXX_STANDARD LESS 17)
46-
find_package(Boost 1.56.0 REQUIRED)
47-
target_link_libraries(hello_mongocxx PRIVATE Boost::boost)
48-
target_compile_definitions(hello_mongocxx PRIVATE BSONCXX_POLY_USE_BOOST=ON)
49-
endif ()
43+
# Deprecated libbsoncxx CMake config does not automatically handle the Boost polyfill dependency.
44+
include(CheckCXXSymbolExists)
45+
set(CMAKE_REQUIRED_INCLUDES ${LIBMONGOCXX_STATIC_INCLUDE_DIRS})
46+
check_cxx_symbol_exists(BSONCXX_POLY_USE_BOOST "bsoncxx/config/config.hpp" NEEDS_BOOST_POLYFILL)
47+
if (NEEDS_BOOST_POLYFILL)
48+
find_package(Boost 1.56.0 REQUIRED)
49+
target_link_libraries(hello_mongocxx PRIVATE Boost::boost)
5050
endif()
5151

5252
target_include_directories(hello_mongocxx

src/mongocxx/test/spec/unified_tests/runner.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ bool compatible_with_server(const bsoncxx::array::element& requirement) {
263263
throw e;
264264
}
265265

266-
for (const auto kvp : server_params.get_document().view()) {
266+
for (const auto& kvp : server_params.get_document().view()) {
267267
const auto param = kvp.key();
268268
const auto value = kvp.get_value();
269269
// If actual parameter is unset or unequal to requirement, skip test.
@@ -954,7 +954,7 @@ void assert_outcome(const array::element& test) {
954954
if (!test["outcome"])
955955
return;
956956

957-
for (const auto outcome : test["outcome"].get_array().value) {
957+
for (const auto& outcome : test["outcome"].get_array().value) {
958958
CAPTURE(to_json(outcome.get_document()));
959959

960960
const auto db_name = outcome["databaseName"].get_string().value;
@@ -1033,7 +1033,7 @@ const std::map<std::pair<mongocxx::stdx::string_view, mongocxx::stdx::string_vie
10331033
void run_tests(mongocxx::stdx::string_view test_description, document::view test) {
10341034
REQUIRE(test["tests"]);
10351035

1036-
for (const auto ele : test["tests"].get_array().value) {
1036+
for (const auto& ele : test["tests"].get_array().value) {
10371037
const auto description = string::to_string(ele["description"].get_string().value);
10381038
SECTION(description) {
10391039
{
@@ -1066,7 +1066,7 @@ void run_tests(mongocxx::stdx::string_view test_description, document::view test
10661066

10671067
operations::state state;
10681068

1069-
for (const auto ops : ele["operations"].get_array().value) {
1069+
for (const auto& ops : ele["operations"].get_array().value) {
10701070
const auto ignore_result_and_error = [&]() -> bool {
10711071
const auto elem = ops["ignoreResultAndError"];
10721072
return elem && elem.get_bool().value;

0 commit comments

Comments
 (0)