Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is codecov with lcov not working correctly on Travis but on my local Linux Mint?

I tried to add Codecov to my CI build system for my library. The travis script looks like this:

lcov --directory . --capture --output-file coverage.info --gcov-tool gcov-8 # capture coverage info
lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter out system
lcov --list coverage.info # debug info
# Uploading report to CodeCov
bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"

When I run these commands on my local Linux Mint machine everything works as expected. But on Travis it doesn't. Report looks like this:

Capturing coverage data from .
Found gcov version: 8.1.0
Scanning . for .gcda files ...
geninfo: WARNING: /home/travis/build/AMS21/Andres-Standard-Library/CMakeFiles/unittest.dir/test/src/cstddef/offsetof_test.cpp.gcno: Overlong record at end of file!
Found 132 data files in .
Processing unittest.dir/test/src/cstddef/offsetof_test.cpp.gcda
geninfo: WARNING: cannot find an entry for #home#travis#build#AMS21#Andres-Standard-Library#test#include#doctest.h.gcov in .gcno file, skipping file!
geninfo: WARNING: cannot find an entry for #home#travis#build#AMS21#Andres-Standard-Library#test#src#cstddef#offsetof_test.cpp.gcov in .gcno file, skipping file!
(...)
Finished .info-file creation
lcov: ERROR: no valid records found in tracefile coverage.info
Reading tracefile coverage.info
Reading tracefile coverage.info
lcov: ERROR: no valid records found in tracefile coverage.info

So obviously there is a Problem here, but I do not understand what it is. And I cant replicate it on my local machine and searching online I also couldn't find a solution.
Both travis and my local machine use gcov 8.1.0. And on travis I use lcov 1.13 and on my local machine version 1.12. I compile with the following flags:

-Wall (... various warning flags) -m32 -g -O0 -fprofile-arcs -ftest-coverage --coverage

I would be very thankful for any solutions or ideas.

Edit: Fixed the problem. It seems that gcc 8 is causing some problems. Using gcc 7 works just fine.

like image 565
AMS Avatar asked Jul 21 '18 12:07

AMS


1 Answers

I encountered a similar issue, I solved it by updating LCOV to the 1.13-4 version (on ubuntu 18.04 LTS, the version available with apt is 1.13-3)

like image 138
Jeremad Avatar answered Nov 15 '22 04:11

Jeremad