From 67f810caa6227320b3630e8196277e422e6264f8 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Thu, 24 Oct 2019 21:20:50 +0200 Subject: [PATCH 01/16] enable coverage for extra branch --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index eb29022e..d4f8ed6b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,7 +57,7 @@ matrix: - SANITIZER=true - name: "coverage build" - if: branch = master + if: branch =~ /master|coverage/ compiler: g++-7 env: - ARCH=amd64 From c7aeb251675776b22318c72c0cd0a36c25aeb380 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Thu, 24 Oct 2019 21:24:59 +0200 Subject: [PATCH 02/16] try to use gcc-8 instead of gcc-7 --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index d4f8ed6b..c181f054 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,13 +58,13 @@ matrix: - name: "coverage build" if: branch =~ /master|coverage/ - compiler: g++-7 + compiler: g++-8 env: - ARCH=amd64 #compiler - - COMPILER=g++-7 - - OCXX=g++-7 - - OCC=gcc-7 + - COMPILER=g++-8 + - OCXX=g++-8 + - OCC=gcc-8 #build settings - build_type=Debug - tests=ON @@ -76,7 +76,7 @@ matrix: sources: - ['ubuntu-toolchain-r-test'] - packages: ['gcc-7', 'g++-7', 'lcov'] + packages: ['gcc-8', 'g++-8', 'lcov'] after_success: - $project_root/support/coverage From c8f1e12ff3b1ea2f3d45a0caf77c79be0901dc3f Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Thu, 24 Oct 2019 21:33:33 +0200 Subject: [PATCH 03/16] remove branch check from coverage script --- support/coverage | 6 ------ 1 file changed, 6 deletions(-) diff --git a/support/coverage b/support/coverage index e6617907..725f2dbb 100755 --- a/support/coverage +++ b/support/coverage @@ -26,12 +26,6 @@ done project_root="${project_root:-$(realpath . )}" build_root="${build_root:-$(realpath ../libobi-build/current)}" -## skip coverage when not on branch master -if $EXT_CI && [[ $TRAVIS_BRANCH != master ]] ; then - cd $build_root; ctest --output-on-failure - exit $? -fi - ## build with coverage information if $build; then e="" From ab0e141904b5453a023e663f6da0fb58ba7590e6 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Thu, 24 Oct 2019 22:04:01 +0200 Subject: [PATCH 04/16] try to use different gcov and lcov --- support/coverage | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/support/coverage b/support/coverage index 725f2dbb..d7c927f5 100755 --- a/support/coverage +++ b/support/coverage @@ -6,6 +6,10 @@ debug=false examples=false EXT_CI=${EXT_CI:-false} +GCOV=gcov-8 +GCOV_TOOL=gcov-tool-8 +LCOV_CMD=("$LCOV" '--gcov-tool' "$GCOV_TOOL") + while [[ -n "$1" ]]; do case $1 in --build) @@ -40,11 +44,11 @@ fi cd "$build_root" echo "############## extract base coverage ##############" -lcov --capture --initial --directory "$build_root" \ +"${LCOV_CMD[@]}" --capture --initial --directory "$build_root" \ --output-file base_coverage.info || exit $? echo "############## zero counters ##############" -lcov --directory "$build_root" --zerocounters +"${LCOV_CMD[@]}" --directory "$build_root" --zerocounters echo "############## run tests ##############" ( cd $build_root; ctest ) || exit $? @@ -66,38 +70,38 @@ if $debug; then fi echo "############## extract test coverage ##############" -lcov --directory "$build_root" \ - --capture --output-file test_coverage.info || exit $? +"${LCOV_CMD[@]}" --directory "$build_root" \ + --capture --output-file test_coverage.info || exit $? echo "############## combine base and test coverage ##############" -lcov --add-tracefile base_coverage.info --add-tracefile test_coverage.info \ - --output-file coverage.info || exit $? +"${LCOV_CMD[@]}" --add-tracefile base_coverage.info --add-tracefile test_coverage.info \ + --output-file coverage.info || exit $? if $debug; then echo "############## list info ##############" - lcov --list coverage.info || exit $? + "${LCOV_CMD[@]}" --list coverage.info || exit $? fi echo "############## remove info ##############" -lcov --remove coverage.info \ - '/usr/*' \ - "$project_root"'/examples*' \ - "$project_root"'/tests*' \ - "$project_root"'/external_libs/*' \ - --output-file coverage.info \ - || exit $? +"${LCOV_CMD[@]}" --remove coverage.info \ + '/usr/*' \ + "$project_root"'/examples*' \ + "$project_root"'/tests*' \ + "$project_root"'/external_libs/*' \ + --output-file coverage.info \ + || exit $? if $debug; then echo "############## list info ##############" - lcov --list coverage.info || exit $? + "${LCOV_CMD[@]}" --list coverage.info || exit $? fi ## upload coverage information if $EXT_CI; then cd $project_root - bash <(curl -s https://codecov.io/bash) -f $build_root/coverage.info || \ + bash <(curl -s https://codecov.io/bash) -x "$GCOV" -f $build_root/coverage.info || \ echo "Codecov did not collect coverage reports" gem install coveralls-lcov From 13fd9c02f0a76a40ddc4c68a3b15f0f08bb6abd1 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Thu, 24 Oct 2019 22:13:19 +0200 Subject: [PATCH 05/16] clean up travis file --- .travis.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index c181f054..8a081e7d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,7 +38,6 @@ matrix: - SANITIZER=false addons: apt: - sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-8'] packages: ['gcc-8', 'g++-8'] - name: "address sanitizer build" @@ -72,10 +71,6 @@ matrix: - CXXFLAGS="-O0 --coverage" addons: apt: - #we need gcc7 for lcov to work - sources: - - ['ubuntu-toolchain-r-test'] - packages: ['gcc-8', 'g++-8', 'lcov'] after_success: - $project_root/support/coverage @@ -97,7 +92,6 @@ matrix: addons: apt: sources: - - ['ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-8'] - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main' key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" @@ -130,8 +124,7 @@ matrix: - examples=OFF addons: apt: - #we need gcc7 for lcov to work - sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-7'] + #sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-7'] packages: ['gcc-7', 'g++-7', 'lcov'] coverity_scan: From 06bf2527202c134cb2bafd22b5e18cf2d218c475 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Thu, 24 Oct 2019 22:25:14 +0200 Subject: [PATCH 06/16] fix coverage script --- support/coverage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/coverage b/support/coverage index d7c927f5..6fca8845 100755 --- a/support/coverage +++ b/support/coverage @@ -8,7 +8,7 @@ EXT_CI=${EXT_CI:-false} GCOV=gcov-8 GCOV_TOOL=gcov-tool-8 -LCOV_CMD=("$LCOV" '--gcov-tool' "$GCOV_TOOL") +LCOV_CMD=(lcov '--gcov-tool' "$GCOV_TOOL") while [[ -n "$1" ]]; do case $1 in From bc16b1d051f3863e16b29920b6a152258cd63cc5 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Thu, 24 Oct 2019 23:18:22 +0200 Subject: [PATCH 07/16] improve coverage script --- support/coverage | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/support/coverage b/support/coverage index 6fca8845..1cdb7cab 100755 --- a/support/coverage +++ b/support/coverage @@ -10,6 +10,11 @@ GCOV=gcov-8 GCOV_TOOL=gcov-tool-8 LCOV_CMD=(lcov '--gcov-tool' "$GCOV_TOOL") +ferr() { + echo "$@" + exit 1 +} + while [[ -n "$1" ]]; do case $1 in --build) @@ -28,7 +33,12 @@ while [[ -n "$1" ]]; do done project_root="${project_root:-$(realpath . )}" -build_root="${build_root:-$(realpath ../libobi-build/current)}" +echo "project_root: ${project_root}" +build_root="${build_root:-$(realpath ../libext-build/current)}" +(( $? == 0 )) || ferr "faild to set build_root" +echo "build_root: ${build_root}" + +[[ -L "$build_root" ]] || echo "invalid build root" ## build with coverage information if $build; then @@ -37,21 +47,21 @@ if $build; then e="-e" fi - CXXFLAGS="--coverage -O0 " ./build -v -c -d -t $e || exit $? + CXXFLAGS="--coverage -O0 " ./build -v -c -d -bt $e || ferr "failed to build" fi ## collect coverage information cd "$build_root" echo "############## extract base coverage ##############" -"${LCOV_CMD[@]}" --capture --initial --directory "$build_root" \ - --output-file base_coverage.info || exit $? +"${LCOV_CMD[@]}" --capture --directory "$build_root" --initial \ + --output-file base_coverage.info || ferr "failed to collect basebase coverage" echo "############## zero counters ##############" "${LCOV_CMD[@]}" --directory "$build_root" --zerocounters echo "############## run tests ##############" -( cd $build_root; ctest ) || exit $? +( cd $build_root; ctest ) || ferr "failed to run ctest" if $examples; then echo "############## run examples ##############" @@ -66,21 +76,21 @@ fi if $debug; then echo "############## gcdas ##############" - find -L "$build_root" -iname "*.gcda" || exit $? + find -L "$build_root" -iname "*.gcda" || ferr "failed to find .gcda files" fi echo "############## extract test coverage ##############" -"${LCOV_CMD[@]}" --directory "$build_root" \ - --capture --output-file test_coverage.info || exit $? +"${LCOV_CMD[@]}" --capture --directory "$build_root" \ + --output-file test_coverage.info || ferr "failed to extract coverage" echo "############## combine base and test coverage ##############" "${LCOV_CMD[@]}" --add-tracefile base_coverage.info --add-tracefile test_coverage.info \ - --output-file coverage.info || exit $? + --output-file coverage.info || ferr "failed to combine coverage" if $debug; then echo "############## list info ##############" - "${LCOV_CMD[@]}" --list coverage.info || exit $? + "${LCOV_CMD[@]}" --list coverage.info || ferr "failed to list coverage" fi echo "############## remove info ##############" @@ -94,16 +104,17 @@ echo "############## remove info ##############" if $debug; then echo "############## list info ##############" - "${LCOV_CMD[@]}" --list coverage.info || exit $? + "${LCOV_CMD[@]}" --list coverage.info || ferr "failed to list coverage" fi ## upload coverage information if $EXT_CI; then cd $project_root - bash <(curl -s https://codecov.io/bash) -x "$GCOV" -f $build_root/coverage.info || \ - echo "Codecov did not collect coverage reports" + bash -x <(curl -s https://codecov.io/bash) \ + -x $GCOV -f $build_root/coverage.info \ + || ferr "Codecov did not collect coverage reports" - gem install coveralls-lcov - coveralls-lcov $build_root/coverage.info + gem install coveralls-lcov || ferr "could not install coveralls-lcov gem" + coveralls-lcov $build_root/coverage.info || ferr "coveralls-lcov failed" fi From f099546f8a50269f1cadebbf26ba13d089b03397 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Thu, 24 Oct 2019 23:41:23 +0200 Subject: [PATCH 08/16] print lcov version --- support/coverage | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/support/coverage b/support/coverage index 1cdb7cab..0a6a41d0 100755 --- a/support/coverage +++ b/support/coverage @@ -10,6 +10,9 @@ GCOV=gcov-8 GCOV_TOOL=gcov-tool-8 LCOV_CMD=(lcov '--gcov-tool' "$GCOV_TOOL") +apt-cache show lcov +lcov --version + ferr() { echo "$@" exit 1 @@ -37,7 +40,6 @@ echo "project_root: ${project_root}" build_root="${build_root:-$(realpath ../libext-build/current)}" (( $? == 0 )) || ferr "faild to set build_root" echo "build_root: ${build_root}" - [[ -L "$build_root" ]] || echo "invalid build root" ## build with coverage information From be158e42ac338f70661f94375251ec3181671176 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Thu, 24 Oct 2019 23:52:51 +0200 Subject: [PATCH 09/16] get newer lcov --- support/coverage | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/support/coverage b/support/coverage index 0a6a41d0..069712e3 100755 --- a/support/coverage +++ b/support/coverage @@ -10,8 +10,12 @@ GCOV=gcov-8 GCOV_TOOL=gcov-tool-8 LCOV_CMD=(lcov '--gcov-tool' "$GCOV_TOOL") -apt-cache show lcov -lcov --version +if $EXT_CI; then + wget http://mirrors.kernel.org/ubuntu/pool/universe/l/lcov/lcov_1.13-4_all.deb + dpkg -i lcov_1.13-4_all.deb + apt-cache show lcov + lcov --version +fi ferr() { echo "$@" From d414c085e6894f1c9421cf7b4850581a33ff639b Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Thu, 24 Oct 2019 23:58:57 +0200 Subject: [PATCH 10/16] add missing sudo --- support/coverage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/coverage b/support/coverage index 069712e3..4e1b9a02 100755 --- a/support/coverage +++ b/support/coverage @@ -12,7 +12,7 @@ LCOV_CMD=(lcov '--gcov-tool' "$GCOV_TOOL") if $EXT_CI; then wget http://mirrors.kernel.org/ubuntu/pool/universe/l/lcov/lcov_1.13-4_all.deb - dpkg -i lcov_1.13-4_all.deb + sudo dpkg -i lcov_1.13-4_all.deb apt-cache show lcov lcov --version fi From a4e8970f1ac14f115242b7cdd5bd0542fe48644d Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 25 Oct 2019 00:08:23 +0200 Subject: [PATCH 11/16] show commands in coverage script --- support/coverage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/coverage b/support/coverage index 4e1b9a02..f22df2b3 100755 --- a/support/coverage +++ b/support/coverage @@ -1,4 +1,5 @@ #!/bin/bash +set -x ## setup vars build=false @@ -13,7 +14,6 @@ LCOV_CMD=(lcov '--gcov-tool' "$GCOV_TOOL") if $EXT_CI; then wget http://mirrors.kernel.org/ubuntu/pool/universe/l/lcov/lcov_1.13-4_all.deb sudo dpkg -i lcov_1.13-4_all.deb - apt-cache show lcov lcov --version fi From 0792d61263001c020618a1ff6618ac81276036c1 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Sat, 26 Oct 2019 09:35:56 +0200 Subject: [PATCH 12/16] decrease verbosity --- support/coverage | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/support/coverage b/support/coverage index 94d8bf3d..e69e8ab6 100755 --- a/support/coverage +++ b/support/coverage @@ -1,15 +1,14 @@ #!/bin/bash -set -x +EXT_CI=${EXT_CI:-false} ## setup vars build=false debug=false examples=false -EXT_CI=${EXT_CI:-false} + GCOV=gcov-8 GCOV_TOOL=gcov-tool-8 -LCOV_CMD=(lcov '--gcov-tool' "$GCOV_TOOL") if $EXT_CI; then wget http://mirrors.kernel.org/ubuntu/pool/universe/l/lcov/lcov_1.13-4_all.deb @@ -64,13 +63,18 @@ fi ## collect coverage information cd "$build_root" +LCOV_CMD=( + 'lcov' + '--gcov-tool' "$GCOV_TOOL" + '--directory' "$build_root" +) echo "############## extract base coverage ##############" -"${LCOV_CMD[@]}" --capture --directory "$build_root" --initial \ +"${LCOV_CMD[@]}" --capture --initial \ --output-file base_coverage.info || ferr "failed to collect basebase coverage" echo "############## zero counters ##############" -"${LCOV_CMD[@]}" --directory "$build_root" --zerocounters +"${LCOV_CMD[@]}" --zerocounters echo "############## run tests ##############" ( cd $build_root; ctest ) || ferr "failed to run ctest" @@ -92,7 +96,8 @@ if $debug; then fi echo "############## extract test coverage ##############" -"${LCOV_CMD[@]}" --capture --directory "$build_root" \ +set -x +"${LCOV_CMD[@]}" --capture \ --output-file test_coverage.info || ferr "failed to extract coverage" echo "############## combine base and test coverage ##############" From 8464cc56d92ceb151be6e940620f7835c0c943ee Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Sat, 26 Oct 2019 09:45:30 +0200 Subject: [PATCH 13/16] detect required gcov version --- support/coverage | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/support/coverage b/support/coverage index e69e8ab6..8b8b0426 100755 --- a/support/coverage +++ b/support/coverage @@ -1,14 +1,31 @@ #!/bin/bash -EXT_CI=${EXT_CI:-false} +set -u ## setup vars -build=false -debug=false -examples=false - +build=${build:-false} +debug=${debug:-false} +examples=${examples:-false} + +##internal setup +if [[ -z ${project_root:-""} ]]; then + project_root="${project_root:-$(realpath . )}" + build_root="${build_root:-$(realpath ../libext-build/current)}" + (( $? == 0 )) || ferr "faild to set build_root" + [[ -e "$build_root" ]] || ferr "invalid build root: $build_root" +fi +echo "project_root: ${project_root}" +echo "build_root: ${build_root}" -GCOV=gcov-8 -GCOV_TOOL=gcov-tool-8 +EXT_CI=${EXT_CI:-false} +CXX=${CXX:=''} +version=${CXX#*-} +if [[ -n $version ]]; then + version="-$version" +fi +GCOV=gcov${version} +GCOV_TOOL=gcov-tool${version} +echo "gcov: $GCOV" +echo "gcov-tool: $GCOV_TOOL" if $EXT_CI; then wget http://mirrors.kernel.org/ubuntu/pool/universe/l/lcov/lcov_1.13-4_all.deb @@ -21,7 +38,7 @@ ferr() { exit 1 } -while [[ -n "$1" ]]; do +while [[ -n "${1:-""}" ]]; do case $1 in --build) build=true @@ -38,15 +55,8 @@ while [[ -n "$1" ]]; do shift done -project_root="${project_root:-$(realpath . )}" -echo "project_root: ${project_root}" -build_root="${build_root:-$(realpath ../libext-build/current)}" -(( $? == 0 )) || ferr "faild to set build_root" -[[ -L "$build_root" ]] || echo "invalid build root" -echo "build_root: ${build_root}" - ## skip coverage when not on branch master -if $EXT_CI && [[ $EXT_CI_BRANCH != master ]] ; then +if $EXT_CI && [[ $EXT_CI_BRANCH != master && $EXT_CI_BRANCH != coverage ]] ; then cd $build_root; ctest --output-on-failure exit $? fi From 9af3493fa19d2b40728330079b26a25f6b7603fe Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Sat, 26 Oct 2019 11:05:58 +0200 Subject: [PATCH 14/16] revert to gcc-7 to test infrastructure --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1a0d94f0..7faaedc4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,8 +47,8 @@ matrix: - name: "coverage" if: branch =~ /master|coverage/ env: - - CXX=g++-8 - - CC=gcc-8 + - CXX=g++-7 + - CC=gcc-7 - CXXFLAGS="-O0 --coverage" #build settings - build_type=Debug @@ -57,7 +57,7 @@ matrix: addons: apt: #we need gcc7 for lcov to work - packages: ['gcc-8', 'g++-8', 'lcov'] + packages: ['gcc-7', 'g++-7', 'gcc-8', 'g++-8', 'lcov'] - name: "clang" if: branch = master From f88c629d82ea3bf91548dfffc5b5bf7f4d2a18e0 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Sat, 26 Oct 2019 11:53:22 +0200 Subject: [PATCH 15/16] fix use of example variable --- support/coverage | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/support/coverage b/support/coverage index 8b8b0426..b29cc5f5 100755 --- a/support/coverage +++ b/support/coverage @@ -4,7 +4,7 @@ set -u ## setup vars build=${build:-false} debug=${debug:-false} -examples=${examples:-false} +examples=${examples:-"OFF"} ##internal setup if [[ -z ${project_root:-""} ]]; then @@ -64,7 +64,7 @@ fi ## build with coverage information if $build; then e="" - if $examples; then + if [[ examples != OFF ]]; then e="-e" fi @@ -89,7 +89,7 @@ echo "############## zero counters ##############" echo "############## run tests ##############" ( cd $build_root; ctest ) || ferr "failed to run ctest" -if $examples; then +if [[ $examples != "OFF" ]]; then echo "############## run examples ##############" ( cd $build_root/examples From 07fc4fdaa9e50cbfee306a75926eb25d35c953ff Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Sat, 26 Oct 2019 11:59:44 +0200 Subject: [PATCH 16/16] play with lcov --capture --- support/coverage | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/support/coverage b/support/coverage index b29cc5f5..baad1991 100755 --- a/support/coverage +++ b/support/coverage @@ -17,15 +17,13 @@ echo "project_root: ${project_root}" echo "build_root: ${build_root}" EXT_CI=${EXT_CI:-false} -CXX=${CXX:=''} +CXX=${CXX:='gcc'} version=${CXX#*-} if [[ -n $version ]]; then version="-$version" fi GCOV=gcov${version} -GCOV_TOOL=gcov-tool${version} echo "gcov: $GCOV" -echo "gcov-tool: $GCOV_TOOL" if $EXT_CI; then wget http://mirrors.kernel.org/ubuntu/pool/universe/l/lcov/lcov_1.13-4_all.deb @@ -68,14 +66,14 @@ if $build; then e="-e" fi - CXXFLAGS="--coverage -O0 " ./build -v -c -d -bt $e || ferr "failed to build" + CXXFLAGS="--coverage -O0 " ./build -v -d -bt $e || ferr "failed to build" fi ## collect coverage information cd "$build_root" LCOV_CMD=( 'lcov' - '--gcov-tool' "$GCOV_TOOL" + '--gcov-tool' "$GCOV" '--directory' "$build_root" ) @@ -106,13 +104,17 @@ if $debug; then fi echo "############## extract test coverage ##############" -set -x +$CXX --version +$GCOV --version "${LCOV_CMD[@]}" --capture \ - --output-file test_coverage.info || ferr "failed to extract coverage" + --output-file test_coverage.info \ + || ferr "failed to extract coverage" echo "############## combine base and test coverage ##############" -"${LCOV_CMD[@]}" --add-tracefile base_coverage.info --add-tracefile test_coverage.info \ - --output-file coverage.info || ferr "failed to combine coverage" +"${LCOV_CMD[@]}" --add-tracefile base_coverage.info \ + --add-tracefile test_coverage.info \ + --output-file coverage.info \ + || ferr "failed to combine coverage" if $debug; then @@ -127,7 +129,7 @@ echo "############## remove info ##############" "$project_root"'/tests*' \ "$project_root"'/external_libs/*' \ --output-file coverage.info \ - || exit $? + || ferr "failed to remove info" if $debug; then echo "############## list info ##############" @@ -138,10 +140,11 @@ fi if $EXT_CI; then cd $project_root - bash -x <(curl -s https://codecov.io/bash) \ - -x $GCOV -f $build_root/coverage.info \ - || ferr "Codecov did not collect coverage reports" + bash <(curl -s https://codecov.io/bash) \ + -f $build_root/coverage.info \ + -x $GCOV \ + || ferr "codecov upload failed" gem install coveralls-lcov || ferr "could not install coveralls-lcov gem" - coveralls-lcov $build_root/coverage.info || ferr "coveralls-lcov failed" + coveralls-lcov $build_root/coverage.info || ferr "coveralls upload failed" fi