]>
Commit | Line | Data |
---|---|---|
92f5a8d4 TL |
1 | #!/bin/sh |
2 | # must be executed in project root folder | |
3 | ||
4 | # Copyright Hans Dembinski 2018-2019 | |
5 | # Distributed under the Boost Software License, Version 1.0. | |
6 | # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt | |
7 | ||
8 | if [ -z $GCOV ]; then | |
9 | # gcov-9, gcov-7, gcov-6 do not work | |
10 | for i in 8 5; do | |
11 | if test $(which gcov-$i); then | |
12 | GCOV=gcov-$i | |
13 | break; | |
14 | fi; | |
15 | done | |
16 | fi | |
17 | ||
18 | LCOV_VERSION="1.14" | |
19 | LCOV_DIR="tools/lcov-${LCOV_VERSION}" | |
20 | ||
21 | if [ ! -e $LCOV_DIR ]; then | |
22 | cd tools | |
23 | curl -L https://github.com/linux-test-project/lcov/releases/download/v${LCOV_VERSION}/lcov-${LCOV_VERSION}.tar.gz | tar zxf - | |
24 | cd .. | |
25 | fi | |
26 | ||
27 | # --rc lcov_branch_coverage=1 doesn't work on travis | |
28 | # LCOV="${LCOV_DIR}/bin/lcov --gcov-tool=${GCOV} --rc lcov_branch_coverage=1" | |
29 | LCOV="${LCOV_DIR}/bin/lcov --gcov-tool=${GCOV}" | |
30 | ||
31 | # collect raw data | |
32 | $LCOV --base-directory `pwd` \ | |
33 | --directory `pwd`/../../bin.v2/libs/histogram/test \ | |
34 | --capture --output-file coverage.info | |
35 | ||
36 | # remove uninteresting entries | |
37 | $LCOV --extract coverage.info "*/boost/histogram/*" --output-file coverage.info | |
38 | ||
20effc67 | 39 | if [ $1 ]; then |
92f5a8d4 TL |
40 | # upload if on CI or when token is passed as argument |
41 | which cpp-coveralls || echo "Error: you need to install cpp-coveralls" | |
20effc67 TL |
42 | cpp-coveralls -l coverage.info -r ../.. -n -t $1 |
43 | elif [ ! $CI ]; then | |
92f5a8d4 TL |
44 | # otherwise generate html report |
45 | $LCOV_DIR/bin/genhtml coverage.info --demangle-cpp -o coverage-report | |
46 | fi |