From 9816d61f381ce52d9e72eee4fff834fd1006fd76 Mon Sep 17 00:00:00 2001 From: Damian Jarek Date: Tue, 20 Nov 2018 17:11:22 -0800 Subject: [PATCH] Improve compilation of tests for continuous integration: fix #1293 * Build ASIO's non-template entities into a static library to reduce the compiler's memory usage during test compilation. * Retry as single-threaded build after the first build failure. --- .travis.yml | 2 +- Jamfile | 16 ++++++++++++++++ test/Jamfile | 1 + test/asio.cpp | 1 + tools/build-and-test.sh | 4 +++- tools/retry.sh | 7 +++++++ 6 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 test/asio.cpp create mode 100755 tools/retry.sh diff --git a/.travis.yml b/.travis.yml index e20f79ab..552bcf09 100644 --- a/.travis.yml +++ b/.travis.yml @@ -197,7 +197,7 @@ script: - |- echo "using $TOOLSET : : $COMPILER : -std=$CXXSTD ;" > ~/user-config.jam - cd ../boost-root - - travis_retry libs/beast/tools/build-and-test.sh + - libs/beast/tools/retry.sh libs/beast/tools/build-and-test.sh after_script: - cat nohup.out || echo "nohup.out already deleted" diff --git a/Jamfile b/Jamfile index f48e4fb0..7893775c 100644 --- a/Jamfile +++ b/Jamfile @@ -12,6 +12,7 @@ import feature ; import boost ; import modules ; import testing ; +import ../../config/checks/config : requires ; boost.use-project ; @@ -69,6 +70,20 @@ variant ubasan path-constant TEST_MAIN : include/boost/beast/_experimental/unit_test/main.cpp ; +lib static_asio + : test/asio.cpp + : requirements + [ requires + cxx11_constexpr + cxx11_decltype + cxx11_hdr_tuple + cxx11_template_aliases + cxx11_variadic_templates + ] + BOOST_ASIO_SEPARATE_COMPILATION + static + ; + project /boost/beast : requirements /boost//headers @@ -77,6 +92,7 @@ project /boost/beast /boost/system//boost_system /boost/coroutine//boost_coroutine /boost/filesystem//boost_filesystem + static_asio multi shared on diff --git a/test/Jamfile b/test/Jamfile index 3c7a86e5..b2fb1ff1 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -22,6 +22,7 @@ project /boost/beast/test ] ./extern BOOST_BEAST_ALLOW_DEPRECATED + BOOST_ASIO_SEPARATE_COMPILATION ; path-constant ZLIB_SOURCES : diff --git a/test/asio.cpp b/test/asio.cpp new file mode 100644 index 00000000..bf00c8ff --- /dev/null +++ b/test/asio.cpp @@ -0,0 +1 @@ +#include diff --git a/tools/build-and-test.sh b/tools/build-and-test.sh index 137c7981..dbd8c143 100755 --- a/tools/build-and-test.sh +++ b/tools/build-and-test.sh @@ -17,7 +17,9 @@ if [[ $TRAVIS_BRANCH == "master" || $TRAVIS_BRANCH == "develop" ]]; then MAIN_BRANCH="1" fi -if [[ "${TRAVIS}" == "true" ]]; then +if [[ "${BEAST_RETRY}" == "true" ]]; then + JOBS=1 +elif [[ "${TRAVIS}" == "true" ]]; then JOBS="2" elif [[ $(uname -s) == "Linux" ]]; then # Physical cores diff --git a/tools/retry.sh b/tools/retry.sh new file mode 100755 index 00000000..b17fa7c6 --- /dev/null +++ b/tools/retry.sh @@ -0,0 +1,7 @@ + #!/usr/bin/env bash + +for i in {1..3} +do + $1 "${@:2:99}" && break; + export BEAST_RETRY="true" +done