From 86176786c3fd82f8cf87b84ae188a645d30c0f2e Mon Sep 17 00:00:00 2001 From: Damian Jarek Date: Sun, 19 May 2019 19:30:05 +0200 Subject: [PATCH] Expand CI matrix using Azure Pipelines: * Allow setting a seed in websocket prng to workaround a valgrind bug in Xenial. * Coverage collection in Azp. * Fixup blacklists to avoid zlib bugs. * Use native b2 features for sanitizers and valgrind. * Expanded Windows build matrix. * Add additional clang (with libc++) builds. Signed-off-by: Damian Jarek --- CHANGELOG.md | 1 + azure-pipelines.yml | 270 ++++++++++++++++++++++++++ test/beast/ssl/Jamfile | 2 +- test/beast/websocket/Jamfile | 2 +- test/beast/websocket/_detail_prng.cpp | 10 + tools/blacklist.supp | 3 +- tools/coverage.sh | 9 + tools/get-boost.sh | 8 +- tools/valgrind.supp | 7 + 9 files changed, 306 insertions(+), 6 deletions(-) create mode 100644 azure-pipelines.yml create mode 100755 tools/coverage.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index c5a9c5f2..32eac599 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Version 256: * Remove uses of deprecated methods in websocket tests * Remove redundant use of `static_string` * Remove redundant template in service_base +* Expand CI matrix using Azure Pipelines -------------------------------------------------------------------------------- diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000..35780309 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,270 @@ +variables: + GIT_BRANCH: $(Build.SourceBranch) + +jobs: + - job: 'LinuxCoverage' + pool: + vmImage: 'ubuntu-16.04' + container: + image: djarek/boost-beast-ci:latest + options: --privileged + steps: + - bash: | + sudo apt update && sudo apt install -y g++ lcov + displayName: Get dependencies + - bash: | + set -e + export BUILD_DIR=$(pwd) + cd .. + $BUILD_DIR/tools/get-boost.sh $GIT_BRANCH $BUILD_DIR + cd boost-root + export CXX=g++ CC=gcc + ./bootstrap.sh || cat bootstrap.log + displayName: Get Boost + - bash: | + set -e + cd ../boost-root + ./b2 libs/beast/test//run-fat-tests toolset=gcc coverage=all link=static cxxstd=11 -j2 + libs/beast/tools/coverage.sh + env: + CODECOV_TOKEN: $(CODECOV_TOKEN) + displayName: Build & Run tests + - job: 'Linux' + pool: + vmImage: 'ubuntu-16.04' + container: + image: djarek/boost-beast-ci:latest + options: --privileged + strategy: + matrix: + GCC 8 C++17 Release: + TOOLSET: gcc + CXX: g++-8 + PACKAGES: g++-8 + VARIANT: release + B2_FLAGS: BOOST_BEAST_USE_STD_STRING_VIEW + CXXSTD: 17 + B2_TARGETS: libs/beast/test//run-fat-tests libs/beast/example + GCC 8 C++11 UBASAN: + TOOLSET: gcc + CXX: g++-8 + PACKAGES: g++-8 + VARIANT: debug + B2_FLAGS: norecover norecover + # use GOLD to workaround UBSAN linker issue in gcc 7/8 + # https://stackoverflow.com/questions/50024731/ld-unrecognized-option-push-state-no-as-needed + CXX_FLAGS: "-msse4.2 -funsigned-char -fno-omit-frame-pointer" -fuse-ld=gold + CXXSTD: 11 + B2_TARGETS: libs/beast/test//run-fat-tests + GCC 8 C++11 TSAN: + TOOLSET: gcc + CXX: g++-8 + PACKAGES: g++-8 + VARIANT: release + B2_FLAGS: norecover + CXX_FLAGS: "-msse4.2 -funsigned-char -fno-omit-frame-pointer" + CXXSTD: 11 + B2_TARGETS: libs/beast/test//run-fat-tests + GCC 7 C++14 Valgrind: + TOOLSET: gcc + CXX: g++-7 + PACKAGES: g++-7 valgrind + VARIANT: release + B2_FLAGS: BOOST_BEAST_TEST_STATIC_PRNG_SEED on "valgrind --track-origins=yes --error-exitcode=1 --max-stackframe=16000000 --suppressions=libs/beast/tools/valgrind.supp" + CXXSTD: 14 + B2_TARGETS: libs/beast/test//run-fat-tests + GCC Default C++11 Release: + TOOLSET: gcc + CXX: g++ + PACKAGES: g++ + VARIANT: release + CXXSTD: 11 + B2_TARGETS: libs/beast/test//run-fat-tests libs/beast/example + Clang 6.0 C++11 Debug: + TOOLSET: clang + CXX: clang++-6.0 + PACKAGES: clang-6.0 + VARIANT: debug + CXXSTD: 11 + B2_TARGETS: libs/beast/test//run-fat-tests libs/beast/example + Clang 7 libc++ C++14 Valgrind: + TOOLSET: clang + CXX: clang++-7 + PACKAGES: clang-7 libc++-7-dev libc++abi-7-dev valgrind + VARIANT: release + B2_FLAGS: on "valgrind --track-origins=yes --error-exitcode=1 --max-stackframe=16000000 --suppressions=libs/beast/tools/valgrind.supp" + CXXSTD: 14 + CXX_FLAGS: "-stdlib=libc++" "-stdlib=libc++" + B2_TARGETS: libs/beast/test//run-fat-tests + Clang 7 C++11 Debug: + TOOLSET: clang + CXX: clang++-7 + PACKAGES: clang-7 + VARIANT: debug + CXXSTD: 11 + B2_TARGETS: libs/beast/test//run-fat-tests libs/beast/example + Clang 7 C++14 Release: + TOOLSET: clang + CXX: clang++-7 + PACKAGES: clang-7 + VARIANT: release + CXXSTD: 14 + B2_TARGETS: libs/beast/test//run-fat-tests libs/beast/example + Clang Default C++11 Debug: + TOOLSET: clang + CXX: clang++ + PACKAGES: clang + VARIANT: debug + CXXSTD: 11 + B2_TARGETS: libs/beast/test//run-fat-tests libs/beast/example + Clang 8 libc++ C++14 UBASAN: + TOOLSET: clang + CXX: clang++-8 + PACKAGES: clang-8 libc++-8-dev libc++abi-8-dev + VARIANT: release + B2_FLAGS: norecover norecover + UBSAN_OPTIONS: print_stacktrace=1 + CXXSTD: 14 + CXX_FLAGS: "-stdlib=libc++ -msse4.2 -funsigned-char -fno-omit-frame-pointer" -stdlib=libc++ + B2_TARGETS: libs/beast/test//run-fat-tests + Clang 8 libc++ C++14 TSAN: + TOOLSET: clang + CXX: clang++-8 + PACKAGES: clang-8 libc++-8-dev libc++abi-8-dev + VARIANT: release + B2_FLAGS: norecover + CXXSTD: 11 + CXX_FLAGS: "-stdlib=libc++ -msse4.2 -funsigned-char -fno-omit-frame-pointer" -stdlib=libc++ + B2_TARGETS: libs/beast/test//run-fat-tests + steps: + - bash: | + sudo apt update && sudo apt install -y $PACKAGES + displayName: Get dependencies + - bash: | + set -e + export BUILD_DIR=$(pwd) + cd .. + $BUILD_DIR/tools/get-boost.sh $GIT_BRANCH $BUILD_DIR + cd boost-root + ./bootstrap.sh || cat bootstrap.log + cp libs/beast/tools/user-config.jam ~/user-config.jam + echo "using $TOOLSET : : $(which $CXX) : $CXX_FLAGS ;" >> ~/user-config.jam + echo "project : requirements $B2_FLAGS ;" >> ~/user-config.jam + displayName: Get Boost + - bash: | + set -e + cd ../boost-root + echo "B2_FLAGS: $B2_FLAGS" + ./b2 -j2 \ + --debug-configuration \ + cxxstd=$CXXSTD \ + toolset=$TOOLSET \ + variant=$VARIANT \ + $B2_TARGETS + displayName: Build & Run tests + + - job: 'macOS' + pool: + vmImage: 'macOS-10.13' + strategy: + matrix: + Xcode 10.1 C++17 Release: + TOOLSET: clang + VARIANT: release + CXXSTD: 17 + XCODE_APP: /Applications/Xcode_10.1.app + Xcode 9.4.1 C++11 Release: + TOOLSET: clang + VARIANT: release + CXXSTD: 11 + XCODE_APP: /Applications/Xcode_9.4.1.app + steps: + - bash: | + brew install openssl + displayName: Get OpenSSL + - bash: | + set -e + sudo xcode-select -switch ${XCODE_APP} + which clang++ + export BUILD_DIR=$(pwd) + cd .. + $BUILD_DIR/tools/get-boost.sh $GIT_BRANCH $BUILD_DIR + cd boost-root + ./bootstrap.sh || cat bootstrap.log + cp libs/beast/tools/user-config.jam ~/user-config.jam + displayName: Get Boost + - bash: | + set -e + export OPENSSL_ROOT=$(brew --prefix openssl) + cd ../boost-root + ./b2 -j2 \ + --debug-configuration \ + define=BOOST_COROUTINES_NO_DEPRECATION_WARNING=1 \ + cxxstd=$CXXSTD \ + libs/beast/test//run-fat-tests \ + libs/beast/example \ + toolset=$TOOLSET \ + variant=$VARIANT + displayName: Build & Run tests + + - job: 'Windows' + strategy: + matrix: + # MSVC14.2: # FIXME(djarek): windows-2019 doesn't have vcpkg + #MSVC14.2 C++17 x64: + #VM_IMAGE: 'windows-2019' + #TOOLSET: msvc-14.2 + #B2_FLAGS: define=BOOST_BEAST_USE_STD_STRING_VIEW + #CXXSTD: 17 + #ADDRMODEL: 64 + MSVC14.1 C++17 x64: + VM_IMAGE: 'vs2017-win2016' + TOOLSET: msvc-14.1 + B2_FLAGS: define=BOOST_BEAST_USE_STD_STRING_VIEW + CXXSTD: 17 + ADDRMODEL: 64 + MSVC14.0 C++11 x64: + VM_IMAGE: 'vs2017-win2016' + TOOLSET: msvc-14.0 + CXXSTD: 11 + ADDRMODEL: 64 + pool: + vmImage: $(VM_IMAGE) + steps: + - bash: | + vcpkg install openssl --triplet "x$ADDRMODEL""-windows" + displayName: Get OpenSSL + + - bash: | + set -e + export BUILD_DIR=$(pwd) + cd .. + $BUILD_DIR/tools/get-boost.sh $GIT_BRANCH $BUILD_DIR + cd boost-root + ./bootstrap.sh + cp libs/beast/tools/user-config.jam ~/user-config.jam + displayName: Get Boost + + - bash: | + set -e + echo "VCPKG_ROOT: $VCPKG_INSTALLATION_ROOT" + export OPENSSL_ROOT="$VCPKG_INSTALLATION_ROOT""/installed/x$ADDRMODEL""-windows" + cd ../boost-root + ./b2 -j2 \ + --debug-configuration \ + variant=debug \ + cxxstd=$CXXSTD \ + address-model=$ADDRMODEL \ + toolset=$TOOLSET \ + $B2_FLAGS \ + libs/beast/example + ./b2 -j2 \ + --debug-configuration \ + variant=debug,release \ + cxxstd=$CXXSTD \ + address-model=$ADDRMODEL \ + toolset=$TOOLSET \ + $B2_FLAGS \ + --verbose-test \ + libs/beast/test//run-fat-tests + displayName: Build & Run tests diff --git a/test/beast/ssl/Jamfile b/test/beast/ssl/Jamfile index 5a47939b..afb789e6 100644 --- a/test/beast/ssl/Jamfile +++ b/test/beast/ssl/Jamfile @@ -24,7 +24,7 @@ for local f in $(SOURCES) alias run-tests : $(RUN_TESTS) ; exe fat-tests - : + : $(SOURCES) /boost/beast//lib-asio-ssl /boost/beast/test//lib-test diff --git a/test/beast/websocket/Jamfile b/test/beast/websocket/Jamfile index 43ec8aff..1469d861 100644 --- a/test/beast/websocket/Jamfile +++ b/test/beast/websocket/Jamfile @@ -46,7 +46,7 @@ for local f in $(SOURCES) alias run-tests : $(RUN_TESTS) ; exe fat-tests - : + : $(SOURCES) /boost/beast//lib-asio-ssl /boost/beast/test//lib-test diff --git a/test/beast/websocket/_detail_prng.cpp b/test/beast/websocket/_detail_prng.cpp index 6ee9c557..3eb6e002 100644 --- a/test/beast/websocket/_detail_prng.cpp +++ b/test/beast/websocket/_detail_prng.cpp @@ -17,6 +17,16 @@ namespace beast { namespace websocket { namespace detail { +#ifdef BOOST_BEAST_TEST_STATIC_PRNG_SEED +auto prng_init = []() +{ + // Workaround for https://bugs.launchpad.net/ubuntu/+source/valgrind/+bug/1501545 + std::seed_seq seq{{0xDEAD, 0xBEEF}}; + detail::prng_seed(&seq); + return 0; +}(); +#endif // BOOST_BEAST_TEST_STATIC_PRNG_SEED + class prng_test : public beast::unit_test::suite { diff --git a/tools/blacklist.supp b/tools/blacklist.supp index 09bc1abe..669f3eb6 100644 --- a/tools/blacklist.supp +++ b/tools/blacklist.supp @@ -1,3 +1,4 @@ + # Remember that this blacklist file is GLOBAL to all sanitizers # Be therefore extremely careful when considering to add a sanitizer # filter here instead of using a runtime suppression @@ -26,4 +27,4 @@ fun:*shl_input_streamable* # boost/any.hpp:259:16: runtime error: downcast of address 0x000004392e70 which does not point to an object of type 'any::holder' # -#fun:*any_cast* +#fun:*any_cast* \ No newline at end of file diff --git a/tools/coverage.sh b/tools/coverage.sh new file mode 100755 index 00000000..508e83d6 --- /dev/null +++ b/tools/coverage.sh @@ -0,0 +1,9 @@ +#! /bin/bash +set -e +lcov --directory bin.v2 --capture --no-external --directory $(pwd) --output-file coverage.info > /dev/null 2>&1 +lcov --extract coverage.info $(pwd)'/boost/beast/*' --output-file coverage.info > /dev/null +lcov --remove coverage.info $(pwd)'/boost/beast/_experimental/*' --output-file coverage.info > /dev/null +lcov --list coverage.info +# Codecov improperly detects project root in AzP, so we need to upload from beast git repo +cd libs/beast +curl -s https://codecov.io/bash -o codecov && bash ./codecov -X gcov -f ../../coverage.info -t $CODECOV_TOKEN diff --git a/tools/get-boost.sh b/tools/get-boost.sh index 222a76d0..c614a486 100755 --- a/tools/get-boost.sh +++ b/tools/get-boost.sh @@ -5,10 +5,14 @@ set -e build_dir=$2 branch="master" -if [ "$1" != "master" ]; then + +if [ "$1" != "master" -a "$1" != "refs/heads/master" ]; then branch="develop" fi +echo "BUILD_DIR: $build_dir" +echo "BRANCH: $branch" + git clone -b $branch --depth 1 https://github.com/boostorg/boost.git boost-root cd boost-root @@ -81,7 +85,5 @@ git submodule update --init --depth 20 --jobs 4 \ echo Submodule update complete -echo "BUILD_DIR: $build_dir" - rm -rf libs/beast cp -r $build_dir libs/beast diff --git a/tools/valgrind.supp b/tools/valgrind.supp index 7c7c213f..aa699b74 100644 --- a/tools/valgrind.supp +++ b/tools/valgrind.supp @@ -3,6 +3,13 @@ Memcheck:Cond fun:fill_window } + +{ + zlib_deflate_fast + Memcheck:Cond + fun:deflate_fast +} + { Ignore OpenSSL malloc Memcheck:Leak