From 3d17afc229251382e1d0a7322d6397b41a2fdb33 Mon Sep 17 00:00:00 2001 From: Dmitry Arkhipov Date: Wed, 25 Oct 2023 15:07:11 +0300 Subject: [PATCH] increase testing of CMake build files --- .drone.star | 1 + .drone/drone.bat | 61 +++++++++++++++++++++++++ .drone/drone.sh | 22 +++++---- .github/workflows/run_analyze-bloat.yml | 1 + test/CMakeLists.txt | 5 +- 5 files changed, 79 insertions(+), 11 deletions(-) diff --git a/.drone.star b/.drone.star index f59cc9665..71b1905b8 100644 --- a/.drone.star +++ b/.drone.star @@ -60,6 +60,7 @@ def main(ctx): windows_cxx("msvc-14.1", "", image="cppalliance/dronevs2017", buildtype="boost", buildscript="drone", environment={"B2_TOOLSET": "msvc-14.1", "B2_CXXSTD": "11,14,17"}, globalenv=globalenv), windows_cxx("msvc-14.2", "", image="cppalliance/dronevs2019:2", buildtype="boost", buildscript="drone", environment={"B2_TOOLSET": "msvc-14.2", "B2_CXXSTD": "17,latest"}, globalenv=globalenv), windows_cxx("msvc-14.3", "", image="cppalliance/dronevs2022:1", buildtype="boost", buildscript="drone", environment={"B2_TOOLSET": "msvc-14.3", "B2_CXXSTD": "17,20"}, globalenv=globalenv), + windows_cxx("msvc-14.3 cmake-superproject", "", image="cppalliance/dronevs2022:1", buildtype="cmake-superproject", buildscript="drone", environment={"B2_TOOLSET": "msvc-14.3", "B2_CXXSTD": "17,20"}, globalenv=globalenv), osx_cxx("macOS: Clang", "clang++", packages="", buildscript="drone", buildtype="boost", xcode_version="13.4.1", environment={'B2_TOOLSET': 'clang', 'B2_CXXSTD': '17'}, globalenv=globalenv) # osx_cxx("macOS: gcc-12", "g++-12", packages="", buildscript="drone", buildtype="boost", xcode_version="13.4.1", environment={'B2_TOOLSET': 'gcc-12', 'B2_CXXSTD': '17'}, globalenv=globalenv) ] diff --git a/.drone/drone.bat b/.drone/drone.bat index 1c80cb5ec..c69a14064 100755 --- a/.drone/drone.bat +++ b/.drone/drone.bat @@ -35,4 +35,65 @@ echo '==================================> COMPILE' set B2_TARGETS=libs/!SELF!/test libs/!SELF!/example call !BOOST_ROOT!\libs\!SELF!\ci\build.bat +) else ( if "%DRONE_JOB_BUILDTYPE%" == "cmake-superproject" ( + +echo "Running cmake superproject job" +echo '==================================> INSTALL' +REM there seems to be some problem with b2 bootstrap on Windows +REM when CXX env variable is set +SET "CXX=" + +git clone https://github.com/boostorg/boost-ci.git boost-ci-cloned --depth 1 +cp -prf boost-ci-cloned/ci . +rm -rf boost-ci-cloned +REM source ci/travis/install.sh +REM The contents of install.sh below: + +for /F %%i in ("%DRONE_REPO%") do @set SELF=%%~nxi +SET BOOST_CI_TARGET_BRANCH=!TRAVIS_BRANCH! +SET BOOST_CI_SRC_FOLDER=%cd% + +call ci\common_install.bat + +echo '==================================> COMPILE' + +if "!CMAKE_NO_TESTS!" == "" ( + SET CMAKE_NO_TESTS=error +) +if "!CMAKE_NO_TESTS!" == "error" ( + SET CMAKE_BUILD_TESTING=-DBUILD_TESTING=ON +) + + +cd ../../ + +mkdir __build_static && cd __build_static +cmake -DBoost_VERBOSE=1 !CMAKE_BUILD_TESTING! -DCMAKE_INSTALL_PREFIX=iprefix ^ +-DBOOST_INCLUDE_LIBRARIES=!SELF! !CMAKE_OPTIONS! .. +cmake --build . --target install --config Debug +ctest --output-on-failure --no-tests=error -R boost_!SELF! -C Debug + +cmake --build . --target install --config Release +ctest --output-on-failure --no-tests=error -R boost_!SELF! -C Release +cd .. + + +if "!CMAKE_SHARED_LIBS!" == "" ( + SET CMAKE_SHARED_LIBS=1 +) +if "!CMAKE_SHARED_LIBS!" == "1" ( + +mkdir __build_shared && cd __build_shared +cmake -DBoost_VERBOSE=1 !CMAKE_BUILD_TESTING! -DCMAKE_INSTALL_PREFIX=iprefix ^ +-DBOOST_INCLUDE_LIBRARIES=!SELF! -DBUILD_SHARED_LIBS=ON !CMAKE_OPTIONS! .. +cmake --build . --config Debug +cmake --build . --target install --config Debug +ctest --output-on-failure --no-tests=error -R boost_!SELF! -C Debug + +cmake --build . --config Release +cmake --build . --target install --config Release +ctest --output-on-failure --no-tests=error -R boost_!SELF! -C Release + ) + +)) diff --git a/.drone/drone.sh b/.drone/drone.sh index b5b86045b..6b8eb2380 100755 --- a/.drone/drone.sh +++ b/.drone/drone.sh @@ -129,26 +129,28 @@ common_install echo '==================================> COMPILE' export CXXFLAGS="-Wall -Wextra -Werror" -export CMAKE_OPTIONS=${CMAKE_OPTIONS:--DBUILD_TESTING=ON} export CMAKE_SHARED_LIBS=${CMAKE_SHARED_LIBS:-1} +export CMAKE_NO_TESTS=${CMAKE_NO_TESTS:-error} +if [ $CMAKE_NO_TESTS = "error" ]; then + CMAKE_BUILD_TESTING="-DBUILD_TESTING=ON" +fi mkdir __build_static cd __build_static -cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 ${CMAKE_OPTIONS} \ - -DBOOST_INCLUDE_LIBRARIES=$SELF .. -cmake --build . -ctest --output-on-failure -R boost_$SELF - +cmake -DBoost_VERBOSE=1 ${CMAKE_BUILD_TESTING} -DCMAKE_INSTALL_PREFIX=iprefix \ + -DBOOST_INCLUDE_LIBRARIES=$SELF ${CMAKE_OPTIONS} .. +cmake --build . --target install +ctest --output-on-failure --no-tests=$CMAKE_NO_TESTS -R boost_$SELF cd .. if [ "$CMAKE_SHARED_LIBS" = 1 ]; then mkdir __build_shared cd __build_shared -cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 ${CMAKE_OPTIONS} \ - -DBOOST_INCLUDE_LIBRARIES=$SELF -DBUILD_SHARED_LIBS=ON .. -cmake --build . -ctest --output-on-failure -R boost_$SELF +cmake -DBoost_VERBOSE=1 ${CMAKE_BUILD_TESTING} -DCMAKE_INSTALL_PREFIX=iprefix \ + -DBOOST_INCLUDE_LIBRARIES=$SELF -DBUILD_SHARED_LIBS=ON ${CMAKE_OPTIONS} .. +cmake --build . --target install +ctest --output-on-failure --no-tests=$CMAKE_NO_TESTS -R boost_$SELF fi diff --git a/.github/workflows/run_analyze-bloat.yml b/.github/workflows/run_analyze-bloat.yml index 7d12a4d62..dc73b7870 100644 --- a/.github/workflows/run_analyze-bloat.yml +++ b/.github/workflows/run_analyze-bloat.yml @@ -4,6 +4,7 @@ on: [push, pull_request] env: CMAKE_SHARED_LIBS: '0' + CMAKE_NO_TESTS: ignore CMAKE_OPTIONS: > -DBOOST_JSON_BUILD_TESTS=OFF -DBOOST_JSON_BUILD_FUZZERS=OFF diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b14495758..f749d2d8c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -17,6 +17,9 @@ endif() file(GLOB_RECURSE BOOST_JSON_TESTS_FILES CONFIGURE_DEPENDS Jamfile *.cpp *.hpp) list(FILTER BOOST_JSON_TESTS_FILES EXCLUDE REGEX cmake_install_test/.*$) +list(FILTER BOOST_JSON_TESTS_FILES EXCLUDE REGEX intrusive_macros\.cpp$) +list(FILTER BOOST_JSON_TESTS_FILES EXCLUDE REGEX limits\.cpp$) +list(FILTER BOOST_JSON_TESTS_FILES EXCLUDE REGEX no_exceptions\.cpp$) source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "" FILES ${BOOST_JSON_TESTS_FILES}) add_executable(boost_json-tests ${BOOST_JSON_TESTS_FILES}) @@ -29,7 +32,7 @@ add_test(NAME boost_json-tests COMMAND boost_json-tests) add_dependencies(tests boost_json-tests) -source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "" FILES limits.cpp main.cpp unhygenic_macros.cpp) +source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "" FILES limits.cpp main.cpp intrusive_macros.cpp) source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/../src PREFIX "" FILES ../src/src.cpp) add_executable(boost_json-limits limits.cpp main.cpp ../src/src.cpp Jamfile) boost_json_setup_properties(boost_json-limits)