From 3804040dbe56de80c003bba962c30bf719253300 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 10 Jan 2019 23:06:54 +0100 Subject: [PATCH] Travis: coverage: gcov: process .gnco separately (#2574) Also uses consistent flags with codecov, i.e. lua53 also with gcov / `#c_code`. --- .travis.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) 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 }