• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
13sudo: false
14language: cpp
15os: linux
16
17# `--coverage` flags required to generate coverage info for Coveralls
18matrix:
19  include:
20    - 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'
21      name: "GCC-6, no RTTI"
22      addons:
23        apt:
24          sources: ubuntu-toolchain-r-test
25          packages: g++-6
26
27    - 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'
28      name: "GCC-8"
29      sudo: required # Required by leak sanitizer
30      addons:
31        apt:
32          sources: ubuntu-toolchain-r-test
33          packages: g++-8
34
35    - env: B2_ARGS='cxxstd=98,0x toolset=gcc-4.6 cxxflags="--coverage -DBOOST_TRAVISCI_BUILD" linkflags="--coverage"' GCOVTOOL='gcov-4.6'
36      name: "GCC-4.6"
37      addons:
38        apt:
39          sources: ubuntu-toolchain-r-test
40          packages: g++-4.6
41
42#    - 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"'
43#      name: "GCC-8, no exceptions"
44#      sudo: required # Required by leak sanitizer
45#      addons:
46#        apt:
47#          sources: ubuntu-toolchain-r-test
48#          packages: g++-8
49
50    - env: B2_ARGS='cxxstd=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'
51      name: "Clang-8"
52      sudo: required # Required by leak sanitizer
53      addons:
54        apt:
55          sources: llvm-toolchain-trusty-8
56          packages: clang-8
57
58    # Sanitizers disabled for this toolset as they started causing link troubles:
59    # hidden symbol `_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE11__recommendEm' isn't defined
60    - env: B2_ARGS='cxxstd=03,11,14 toolset=clang-libc++ cxxflags="--coverage -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD" linkflags="--coverage"' GCOVTOOL='gcov_for_clang.sh'
61      name: "Clang-3.8, libc++"
62      addons:
63        apt:
64          packages: libc++-dev
65
66###############################################################################################################
67# From this point and below code is same for all the Boost libs
68###############################################################################################################
69
70# Installing additional tools
71addons:
72  apt:
73    sources: git-core
74    packages:
75    - git
76    - python-yaml
77
78before_install:
79  # Autodetect Boost branch by using the following code: - BOOST_BRANCH=$TRAVIS_BRANCH
80  # or just directly specify it
81  - BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
82
83  # Files, which coverage results must be ignored (files from other projects).
84  # Example: - IGNORE_COVERAGE='*/boost/progress.hpp */filesystem/src/*'
85  - IGNORE_COVERAGE=''
86
87  # boost-local/libs/ folder to put this library into. This may be useful, if you're for example running Travis
88  # from `Boost.DLL` repo while Boost already has `dll` and with to replace `dll` with content of`Boost.DLL`.
89  #
90  # Otherwise just leave the default value - BOOST_LIBS_FOLDER=$(basename $TRAVIS_BUILD_DIR)
91  - BOOST_LIBS_FOLDER=$(basename $TRAVIS_BUILD_DIR)
92
93  # Global options for sanitizers
94  - UBSAN_OPTIONS=print_stacktrace=1
95  - LSAN_OPTIONS=verbosity=1:log_threads=1
96
97  # Cloning minimal set of Boost libraries
98  - BOOST=$HOME/boost-local
99  - echo "git clone -b $BOOST_BRANCH --depth 10 https://github.com/boostorg/boost.git $BOOST"
100  - git clone -b $BOOST_BRANCH --depth 10 https://github.com/boostorg/boost.git $BOOST
101  - cd $BOOST
102  - git submodule update --init --depth 10 tools/build tools/boostdep
103
104  # Replacing Boost module with this project and installing Boost dependencies
105  - echo "Testing $BOOST/libs/$BOOST_LIBS_FOLDER moved from $TRAVIS_BUILD_DIR, branch $BOOST_BRANCH"
106  - rm -rf $BOOST/libs/$BOOST_LIBS_FOLDER || true
107  - mv $TRAVIS_BUILD_DIR $BOOST/libs/$BOOST_LIBS_FOLDER
108  - python tools/boostdep/depinst/depinst.py --git_args "--depth 10 --jobs 2" $BOOST_LIBS_FOLDER
109  - git status
110
111  # Adding missing toolsets and preparing Boost headers
112  - ./bootstrap.sh
113  - ./b2 headers
114  - |-
115    echo "using gcc ;" >> ~/user-config.jam
116    echo "using clang ;" >> ~/user-config.jam
117    echo "using clang : 3.8 : clang++-3.8 ;" >> ~/user-config.jam
118    echo "using clang : 4 : clang++-4.0 ;" >> ~/user-config.jam
119    echo "using clang : 5 : clang++-5.0 ;" >> ~/user-config.jam
120    echo "using clang : 6 : clang++-6.0 ;" >> ~/user-config.jam
121    echo "using clang : 7 : clang++-7.0 ;" >> ~/user-config.jam
122    echo "using clang : 8 : clang++-8 ;" >> ~/user-config.jam
123    echo "using clang : libc++ : clang++-libc++ ;" >> ~/user-config.jam
124  - cd $BOOST/libs/$BOOST_LIBS_FOLDER/test/
125
126script:
127  - sh -c "../../../b2 -j2 $B2_ARGS"
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