diff --git a/.travis.yml b/.travis.yml index 7ede8a65c..40bb9df93 100644 --- a/.travis.yml +++ b/.travis.yml @@ -125,7 +125,28 @@ install: do_codecov_gcov() { echo "== do_codecov_gcov in $PWD: $*: ==" if [ "$DO_COVERAGE" = "codecov" ]; then - travis_retry bash /tmp/codecov-bash -X coveragepy -c -F "$1" || return 1 + # Report coverage for each .gcno file separately. + # gcov will create .gcov files for the same source (e.g. for + # globalconf.h from awesome.c.gcno and event.c.gcno). + i=0 + set -x + ( + cd build + find -path "*/lgi-check.dir" -prune -o \( -name '*.gcno' -print \) | while read -r gcno; do + gcov -pb "$gcno" + + mkdir gcov.$(( ++i )) + mv *.gcov "gcov.$i" + + # Delete any files for /usr. + # They are not relevant and might cause "Invalid path part" errors + # with Code Climate. + find "gcov.$i" -maxdepth 1 -type f -name '#usr#*.gcov' -delete + done + + # Upload to Codecov. + travis_retry bash /tmp/codecov-bash -X gcov -X coveragepy -F "$1,${LUANAME//./}" + ) fi return 0 }