• 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
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" linkflags="--coverage -lasan -lubsan" "testing.launcher=LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.3"' GCOVTOOL='gcov-6'
20      name: "GCC-6"
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" "testing.launcher=LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.5"' 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    # UBSan is disables as one of the tests was causing UB:
50    # boost/numeric/conversion/converter_policies.hpp:188:94: runtime error: 1.79769e+308 is outside the range of representable values of type 'float'
51    - env: B2_ARGS='cxxstd=98,03,11,14,1z toolset=clang-8 cxxflags="--coverage -fsanitize=address,leak -DBOOST_TRAVISCI_BUILD" linkflags="--coverage -fsanitize=address,leak"' GCOVTOOL='gcov_for_clang.sh'
52      name: "Clang-8"
53      sudo: required # Required by leak sanitizer
54      addons:
55        apt:
56          sources: llvm-toolchain-trusty-8
57          packages: clang-8
58
59    # This test is not run because of the floating point conversion issues in old libc++.
60    #
61    # Sanitizers disabled for this toolset as they started causing link troubles:
62    # hidden symbol `_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE11__recommendEm' isn't defined
63    #- env: B2_ARGS='cxxstd=03,11,14 toolset=clang-libc++ cxxflags="--coverage -DBOOST_TRAVISCI_BUILD" linkflags="--coverage"'
64    #  name: "Clang-3.8, libc++"
65    #  addons:
66    #    apt:
67    #      packages: libc++-dev
68
69###############################################################################################################
70# From this point and below code is same for all the Boost libs
71###############################################################################################################
72
73# Installing additional tools
74addons:
75  apt:
76    sources: git-core
77    packages:
78    - git
79    - python-yaml
80
81before_install:
82  # Autodetect Boost branch by using the following code: - BOOST_BRANCH=$TRAVIS_BRANCH
83  # or just directly specify it
84  - BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
85
86  # Files, which coverage results must be ignored (files from other projects).
87  # Example: - IGNORE_COVERAGE='*/boost/progress.hpp */filesystem/src/*'
88  - IGNORE_COVERAGE='*/filesystem/src/*'
89
90  # boost-local/libs/ folder to put this library into. This may be useful, if you're for example running Travis
91  # from `Boost.DLL` repo while Boost already has `dll` and with to replace `dll` with content of`Boost.DLL`.
92  #
93  # Otherwise just leave the default value - BOOST_LIBS_FOLDER=$(basename $TRAVIS_BUILD_DIR)
94  - BOOST_LIBS_FOLDER=$(basename $TRAVIS_BUILD_DIR)
95
96  # Global options for sanitizers
97  - UBSAN_OPTIONS=print_stacktrace=1
98  - LSAN_OPTIONS=verbosity=1:log_threads=1
99  # Cloning minimal set of Boost libraries
100  - BOOST=$HOME/boost-local
101  - git clone -b $BOOST_BRANCH --depth 10 https://github.com/boostorg/boost.git $BOOST
102  - cd $BOOST
103  - git submodule update --init --depth 10 --jobs 2 tools/build tools/boostdep tools/inspect libs/filesystem libs/variant
104  - python tools/boostdep/depinst/depinst.py --git_args "--depth 10 --jobs 2" $BOOST/libs/filesystem
105
106  # Replacing Boost module with this project and installing Boost dependencies
107  - echo "Testing $BOOST/libs/$BOOST_LIBS_FOLDER moved from $TRAVIS_BUILD_DIR, branch $BOOST_BRANCH"
108  - rm -rf $BOOST/libs/$BOOST_LIBS_FOLDER || true
109  - mv $TRAVIS_BUILD_DIR $BOOST/libs/$BOOST_LIBS_FOLDER
110  - python tools/boostdep/depinst/depinst.py --git_args "--depth 10 --jobs 2" $BOOST_LIBS_FOLDER
111  - git status
112
113  # Adding missing toolsets and preparing Boost headers
114  - ./bootstrap.sh
115  - ./b2 headers
116  - ./b2 -j4 variant=debug tools/inspect/build
117  - |-
118    echo "using gcc ;" >> ~/user-config.jam
119    echo "using clang ;" >> ~/user-config.jam
120    echo "using clang : 3.8 : clang++-3.8 ;" >> ~/user-config.jam
121    echo "using clang : 4 : clang++-4.0 ;" >> ~/user-config.jam
122    echo "using clang : 5 : clang++-5.0 ;" >> ~/user-config.jam
123    echo "using clang : 6 : clang++-6.0 ;" >> ~/user-config.jam
124    echo "using clang : 7 : clang++-7.0 ;" >> ~/user-config.jam
125    echo "using clang : 8 : clang++-8 ;" >> ~/user-config.jam
126    echo "using clang : libc++ : clang++-libc++ ;" >> ~/user-config.jam
127  - cd $BOOST/libs/$BOOST_LIBS_FOLDER/test/
128
129script:
130  - sh -c "../../../b2 -j2 $B2_ARGS"
131  - ../../../dist/bin/inspect .. # inspect tool run
132
133after_success:
134  # Copying Coveralls data to a separate folder
135  - mkdir -p $TRAVIS_BUILD_DIR/coverals
136  - find ../../../bin.v2/ -name "*.gcda" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
137  - find ../../../bin.v2/ -name "*.gcno" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
138  - find ../../../bin.v2/ -name "*.da" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
139  - find ../../../bin.v2/ -name "*.no" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
140  - wget https://github.com/linux-test-project/lcov/archive/v1.14.zip
141  - unzip v1.14.zip
142  - LCOV="`pwd`/lcov-1.14/bin/lcov --gcov-tool $GCOVTOOL"
143  - mkdir -p ~/.local/bin
144  - echo -e '#!/bin/bash\nexec llvm-cov gcov "$@"' > ~/.local/bin/gcov_for_clang.sh
145  - chmod 755 ~/.local/bin/gcov_for_clang.sh
146
147  # Preparing Coveralls data by changind data format to a readable one
148  - echo "$LCOV --directory $TRAVIS_BUILD_DIR/coverals --base-directory `pwd` --capture --output-file $TRAVIS_BUILD_DIR/coverals/coverage.info"
149  - $LCOV --directory $TRAVIS_BUILD_DIR/coverals --base-directory `pwd` --capture --output-file $TRAVIS_BUILD_DIR/coverals/coverage.info
150
151  # ... erasing /test/ /example/ folder data
152  - cd $BOOST
153  - $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
154
155  # ... erasing data that is not related to this project directly
156  - OTHER_LIBS=`grep "submodule .*" .gitmodules | sed 's/\[submodule\ "\(.*\)"\]/"\*\/boost\/\1\.hpp" "\*\/boost\/\1\/\*" "\*\/libs\/\1\/src\/\*"/g'| sed "/\"\*\/boost\/$BOOST_LIBS_FOLDER\/\*\"/d" | sed ':a;N;$!ba;s/\n/ /g'`
157  - echo $OTHER_LIBS
158  - eval "$LCOV --remove $TRAVIS_BUILD_DIR/coverals/coverage.info $OTHER_LIBS -o $TRAVIS_BUILD_DIR/coverals/coverage.info"
159
160  # Sending data to Coveralls
161  - cd $TRAVIS_BUILD_DIR
162  - gem install coveralls-lcov
163  - coveralls-lcov coverals/coverage.info
164