1# Use, modification, and distribution are 2# subject to the Boost Software License, Version 1.0. (See accompanying 3# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4# 5# Copyright Antony Polukhin 2014-2021. 6 7# 8# See https://svn.boost.org/trac/boost/wiki/TravisCoverals for description of this file 9# and how it can be used with Boost libraries. 10# 11# File revision #10 12 13language: cpp 14os: linux 15 16# `--coverage` flags required to generate coverage info for Coveralls 17matrix: 18 include: 19 - env: B2_ARGS='cxxstd=98,03,11,14,1y toolset=gcc-6 cxxflags="--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD -fno-rtti" linkflags="--coverage -lasan -lubsan"' GCOVTOOL='gcov-6' 20 name: "GCC-6, no RTTI" 21 addons: 22 apt: 23 sources: ubuntu-toolchain-r-test 24 packages: g++-6 25 26 - env: B2_ARGS='cxxstd=98,03,11,14,1z toolset=gcc-8 cxxflags="--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD" linkflags="--coverage -lasan -lubsan"' GCOVTOOL='gcov-8' 27 name: "GCC-8" 28 sudo: required # Required by leak sanitizer 29 addons: 30 apt: 31 sources: ubuntu-toolchain-r-test 32 packages: g++-8 33 34 - env: B2_ARGS='cxxstd=98,0x toolset=gcc-4.6 cxxflags="--coverage -DBOOST_TRAVISCI_BUILD" linkflags="--coverage"' GCOVTOOL='gcov-4.6' 35 name: "GCC-4.6" 36 addons: 37 apt: 38 sources: ubuntu-toolchain-r-test 39 packages: g++-4.6 40 41# - env: B2_ARGS='cxxstd=98,03,11,14,1y toolset=gcc-8 cxxflags="--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD -fno-exceptions" linkflags="--coverage -lasan -lubsan"' 42# name: "GCC-8, no exceptions" 43# sudo: required # Required by leak sanitizer 44# addons: 45# apt: 46# sources: ubuntu-toolchain-r-test 47# packages: g++-8 48 49 - env: B2_ARGS='cxxstd=98,03,11,14,1z toolset=clang-8 cxxflags="--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD" linkflags="--coverage -fsanitize=address,leak,undefined"' GCOVTOOL='gcov_for_clang.sh' 50 name: "Clang-8" 51 sudo: required # Required by leak sanitizer 52 addons: 53 apt: 54 sources: llvm-toolchain-trusty-8 55 packages: clang-8 56 57 # Sanitizers disabled for this toolset as they started causing link troubles: 58 # hidden symbol `_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE11__recommendEm' isn't defined 59 - env: B2_ARGS='cxxstd=03,11,14 toolset=clang-libc++ cxxflags="--coverage -DBOOST_TRAVISCI_BUILD" linkflags="--coverage"' GCOVTOOL='gcov_for_clang.sh' 60 name: "Clang-3.8, libc++" 61 addons: 62 apt: 63 packages: libc++-dev 64 65############################################################################################################### 66# From this point and below code is same for all the Boost libs 67############################################################################################################### 68 69# Installing additional tools 70addons: 71 apt: 72 sources: git-core 73 packages: 74 - git 75 - python-yaml 76 77before_install: 78 # Autodetect Boost branch by using the following code: - BOOST_BRANCH=$TRAVIS_BRANCH 79 # or just directly specify it 80 - BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true 81 82 # Files, which coverage results must be ignored (files from other projects). 83 # Example: - IGNORE_COVERAGE='*/boost/progress.hpp */filesystem/src/*' 84 - IGNORE_COVERAGE='' 85 86 # boost-local/libs/ folder to put this library into. This may be useful, if you're for example running Travis 87 # from `Boost.DLL` repo while Boost already has `dll` and with to replace `dll` with content of`Boost.DLL`. 88 # 89 # Otherwise just leave the default value - BOOST_LIBS_FOLDER=$(basename $TRAVIS_BUILD_DIR) 90 - BOOST_LIBS_FOLDER=$(basename $TRAVIS_BUILD_DIR) 91 92 # Global options for sanitizers 93 - UBSAN_OPTIONS=print_stacktrace=1 94 - LSAN_OPTIONS=verbosity=1:log_threads=1 95 # Cloning minimal set of Boost libraries 96 - BOOST=$HOME/boost-local 97 - git clone -b $BOOST_BRANCH --depth 10 https://github.com/boostorg/boost.git $BOOST 98 - cd $BOOST 99 - git submodule update --init --depth 10 --jobs 2 tools/build tools/boostdep tools/inspect libs/filesystem 100 - python tools/boostdep/depinst/depinst.py --git_args "--depth 10 --jobs 2" $BOOST/libs/filesystem 101 102 # Replacing Boost module with this project and installing Boost dependencies 103 - echo "Testing $BOOST/libs/$BOOST_LIBS_FOLDER moved from $TRAVIS_BUILD_DIR, branch $BOOST_BRANCH" 104 - rm -rf $BOOST/libs/$BOOST_LIBS_FOLDER || true 105 - mv $TRAVIS_BUILD_DIR $BOOST/libs/$BOOST_LIBS_FOLDER 106 - python tools/boostdep/depinst/depinst.py --git_args "--depth 10 --jobs 2" $BOOST_LIBS_FOLDER 107 - git status 108 109 # Adding missing toolsets and preparing Boost headers 110 - ./bootstrap.sh 111 - ./b2 headers 112 - ./b2 -j4 variant=debug tools/inspect/build 113 - |- 114 echo "using gcc ;" >> ~/user-config.jam 115 echo "using clang ;" >> ~/user-config.jam 116 echo "using clang : 3.8 : clang++-3.8 ;" >> ~/user-config.jam 117 echo "using clang : 4 : clang++-4.0 ;" >> ~/user-config.jam 118 echo "using clang : 5 : clang++-5.0 ;" >> ~/user-config.jam 119 echo "using clang : 6 : clang++-6.0 ;" >> ~/user-config.jam 120 echo "using clang : 7 : clang++-7.0 ;" >> ~/user-config.jam 121 echo "using clang : 8 : clang++-8 ;" >> ~/user-config.jam 122 echo "using clang : libc++ : clang++-libc++ ;" >> ~/user-config.jam 123 - cd $BOOST/libs/$BOOST_LIBS_FOLDER/test/ 124 125script: 126 - sh -c "../../../b2 -j2 $B2_ARGS" 127 - ../../../dist/bin/inspect .. # inspect tool run 128 129after_success: 130 # Copying Coveralls data to a separate folder 131 - mkdir -p $TRAVIS_BUILD_DIR/coverals 132 - find ../../../bin.v2/ -name "*.gcda" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \; 133 - find ../../../bin.v2/ -name "*.gcno" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \; 134 - find ../../../bin.v2/ -name "*.da" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \; 135 - find ../../../bin.v2/ -name "*.no" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \; 136 - wget https://github.com/linux-test-project/lcov/archive/v1.14.zip 137 - unzip v1.14.zip 138 - LCOV="`pwd`/lcov-1.14/bin/lcov --gcov-tool $GCOVTOOL" 139 - mkdir -p ~/.local/bin 140 - echo -e '#!/bin/bash\nexec llvm-cov gcov "$@"' > ~/.local/bin/gcov_for_clang.sh 141 - chmod 755 ~/.local/bin/gcov_for_clang.sh 142 143 # Preparing Coveralls data by changind data format to a readable one 144 - echo "$LCOV --directory $TRAVIS_BUILD_DIR/coverals --base-directory `pwd` --capture --output-file $TRAVIS_BUILD_DIR/coverals/coverage.info" 145 - $LCOV --directory $TRAVIS_BUILD_DIR/coverals --base-directory `pwd` --capture --output-file $TRAVIS_BUILD_DIR/coverals/coverage.info 146 147 # ... erasing /test/ /example/ folder data 148 - cd $BOOST 149 - $LCOV --remove $TRAVIS_BUILD_DIR/coverals/coverage.info "/usr*" "*/$BOOST_LIBS_FOLDER/test/*" $IGNORE_COVERAGE "*/$BOOST_LIBS_FOLDER/tests/*" "*/$BOOST_LIBS_FOLDER/examples/*" "*/$BOOST_LIBS_FOLDER/example/*" -o $TRAVIS_BUILD_DIR/coverals/coverage.info 150 151 # ... erasing data that is not related to this project directly 152 - OTHER_LIBS=`grep "submodule .*" .gitmodules | sed 's/\[submodule\ "\(.*\)"\]/"\*\/boost\/\1\.hpp" "\*\/boost\/\1\/\*"/g'| sed "/\"\*\/boost\/$BOOST_LIBS_FOLDER\/\*\"/d" | sed ':a;N;$!ba;s/\n/ /g'` 153 - echo $OTHER_LIBS 154 - eval "$LCOV --remove $TRAVIS_BUILD_DIR/coverals/coverage.info $OTHER_LIBS -o $TRAVIS_BUILD_DIR/coverals/coverage.info" 155 156 # Sending data to Coveralls 157 - cd $TRAVIS_BUILD_DIR 158 - gem install coveralls-lcov 159 - coveralls-lcov coverals/coverage.info 160