• 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-2020.
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 #9 (with DIFF)
12
13language: cpp
14os: linux
15dist: bionic
16
17# `--coverage` flags required to generate coverage info for Coveralls
18matrix:
19  include:
20#    - env: B2_ARGS='cxxstd=14,1y toolset=gcc-6 cxxflags="--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD -fno-rtti" linkflags="--coverage -lasan -lubsan"'
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=14,17,2a toolset=gcc-10 cxxflags="--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD" linkflags="--coverage  -lasan -lubsan"'
28      name: "GCC-10"
29      sudo: required # Required by leak sanitizer
30      addons:
31        apt:
32          sources: ubuntu-toolchain-r-test
33          packages: g++-10
34
35    - env: B2_ARGS='cxxstd=14,17,2a toolset=gcc-8 cxxflags="--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD" linkflags="--coverage  -lasan -lubsan"'
36      name: "GCC-8"
37      sudo: required # Required by leak sanitizer
38      addons:
39        apt:
40          sources: ubuntu-toolchain-r-test
41          packages: g++-8
42
43    - env: B2_ARGS='cxxstd=1y toolset=gcc-5 cxxflags="--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD" linkflags="--coverage  -lasan -lubsan"'
44      name: "GCC-5"
45      addons:
46        apt:
47          sources: ubuntu-toolchain-r-test
48          packages: g++-5
49
50#    - env: B2_ARGS='cxxstd=14,1y toolset=gcc-8 cxxflags="--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD -fno-exceptions" linkflags="--coverage -lasan -lubsan"'
51#      name: "GCC-8, no exceptions"
52#      sudo: required # Required by leak sanitizer
53#      addons:
54#        apt:
55#          sources: ubuntu-toolchain-r-test
56#          packages: g++-8
57
58    - env: B2_ARGS='cxxstd=14 toolset=clang-6 cxxflags="--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD" linkflags="--coverage -fsanitize=address,leak,undefined"'
59      name: "Clang-6"
60      sudo: required # Required by leak sanitizer
61      addons:
62        apt:
63          sources: llvm-toolchain-trusty-6
64          packages: clang-6.0
65
66    - env: B2_ARGS='cxxstd=14,17,20 toolset=clang-10 cxxflags="-stdlib=libc++ --coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD" linkflags="-stdlib=libc++ --coverage -fsanitize=address,leak,undefined"'
67      name: "Clang-10, libc++"
68      sudo: required # Required by leak sanitizer
69      addons:
70        apt:
71          sources: llvm-toolchain-bionic-10
72          packages:
73            - clang-10
74            - libc++-10-dev
75            - libc++abi-10-dev
76
77    # Sanitizers disabled for this toolset as they started causing link troubles:
78    # hidden symbol `_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE11__recommendEm' isn't defined
79    - env: B2_ARGS='cxxstd=14 toolset=clang-libc++ cxxflags="--coverage -DBOOST_TRAVISCI_BUILD" linkflags="--coverage"'
80      name: "Clang-3.8, libc++"
81      addons:
82        apt:
83          packages: libc++-dev
84
85###############################################################################################################
86# From this point and below code is same for all the Boost libs
87###############################################################################################################
88
89# Installing additional tools
90addons:
91  apt:
92    sources: git-core
93    packages:
94    - git
95    - python-yaml
96
97before_install:
98  # Autodetect Boost branch by using the following code: - BOOST_BRANCH=$TRAVIS_BRANCH
99  # or just directly specify it
100  - BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
101
102  # Files, which coverage results must be ignored (files from other projects).
103  # Example: - IGNORE_COVERAGE='*/boost/progress.hpp */filesystem/src/*'
104  - IGNORE_COVERAGE=''
105
106  # Explicitly remove the following library from Boost and use the folder for tests. This may be usefull, if you're for example running Travis
107  # from `Boost.DLL` repo, while Boost already has `dll`.
108  #
109  # By default is eaual to - BOOST_LIBS_FOLDER=$(basename $TRAVIS_BUILD_DIR)
110  # This will force to use local repo content, instead of the Boost's default.
111  - BOOST_LIBS_FOLDER=pfr #$(basename $TRAVIS_BUILD_DIR)
112
113  # Global options for sanitizers
114  - UBSAN_OPTIONS=print_stacktrace=1
115  - LSAN_OPTIONS=verbosity=1:log_threads=1
116
117  # Cloning minimal set of Boost libraries
118  - BOOST=$HOME/boost-local
119  - echo "Testing $BOOST_LIBS_FOLDER, to remove $BOOST/libs/$BOOST_LIBS_FOLDER, testing branch $BOOST_BRANCH"
120  - git clone -b $BOOST_BRANCH --depth 10 https://github.com/boostorg/boost.git $BOOST
121  - cd $BOOST
122  - git submodule update --init --depth 10 tools/build tools/boostdep
123
124  # Replacing Boost module with this project and installing Boost dependencies
125  - rm -rf $BOOST/libs/$BOOST_LIBS_FOLDER
126  - mv $TRAVIS_BUILD_DIR $BOOST/libs/$BOOST_LIBS_FOLDER
127  - TRAVIS_BUILD_DIR=$BOOST/libs/$BOOST_LIBS_FOLDER
128  - python tools/boostdep/depinst/depinst.py --git_args "--depth 10 --jobs 2" -I example -I examples $(basename $TRAVIS_BUILD_DIR)
129  - git status
130
131  # Adding missing toolsets and preparing Boost headers
132  - ./bootstrap.sh
133  - ./b2 headers
134  - |-
135    echo "using gcc ;" >> ~/user-config.jam
136    echo "using clang ;" >> ~/user-config.jam
137    echo "using clang : 3.8 : clang++-3.8 ;" >> ~/user-config.jam
138    echo "using clang : 4 : clang++-4.0 ;" >> ~/user-config.jam
139    echo "using clang : 5 : clang++-5.0 ;" >> ~/user-config.jam
140    echo "using clang : 6 : clang++-6.0 ;" >> ~/user-config.jam
141    echo "using clang : 7 : clang++-7.0 ;" >> ~/user-config.jam
142    echo "using clang : 8 : clang++-8 ;" >> ~/user-config.jam
143    echo "using clang : 10 : clang++-10 ;" >> ~/user-config.jam
144    echo "using clang : libc++ : clang++-libc++ ;" >> ~/user-config.jam
145  - cd $BOOST/libs/$BOOST_LIBS_FOLDER/test/
146
147script:
148  - sh -c "../../../b2 -j2 $B2_ARGS"
149
150after_success:
151  # Copying Coveralls data to a separate folder
152  - mkdir -p $TRAVIS_BUILD_DIR/coverals
153  - find ../../../bin.v2/ -name "*.gcda" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
154  - find ../../../bin.v2/ -name "*.gcno" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
155  - find ../../../bin.v2/ -name "*.da" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
156  - find ../../../bin.v2/ -name "*.no" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
157  - wget https://github.com/linux-test-project/lcov/archive/v1.12.zip
158  - unzip v1.12.zip
159  - LCOV="`pwd`/lcov-1.12/bin/lcov"
160
161  # Preparing Coveralls data by changind data format to a readable one
162  - echo "$LCOV --directory $TRAVIS_BUILD_DIR/coverals --base-directory `pwd` --capture --output-file $TRAVIS_BUILD_DIR/coverals/coverage.info"
163  - $LCOV --directory $TRAVIS_BUILD_DIR/coverals --base-directory `pwd` --capture --output-file $TRAVIS_BUILD_DIR/coverals/coverage.info
164
165  # ... erasing /test/ /example/ folder data
166  - cd $BOOST
167  - $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
168
169  # ... erasing data that is not related to this project directly
170  - 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'`
171  - echo $OTHER_LIBS
172  - eval "$LCOV --remove $TRAVIS_BUILD_DIR/coverals/coverage.info $OTHER_LIBS -o $TRAVIS_BUILD_DIR/coverals/coverage.info"
173
174  # Sending data to Coveralls
175  - cd $TRAVIS_BUILD_DIR
176  - gem install coveralls-lcov
177  - coveralls-lcov coverals/coverage.info
178