eddyxu / cpp-coveralls

Upload gcov results to coveralls.io
Apache License 2.0
282 stars 74 forks source link

No data? (Probably problems with excludes) #33

Open 02JanDal opened 10 years ago

02JanDal commented 10 years ago

Hello,

after trying around with getting cpp-coveralls to work together with Travis CI I got to a point where I at least don't have any files I don't want, problem is, I don't have any I want either...

Coveralls: https://coveralls.io/builds/624888 Travis build: https://travis-ci.org/02JanDal/MultiMC5/builds/21541969 .travis.yml: https://github.com/02JanDal/MultiMC5/blob/develop/.travis.yml

As can be seen I use --exclude CMakeFiles --exclude mmc_updater --exclude include/config.h --exclude tests/test_config.h --exclude-pattern ".*automoc\.cpp" --exclude-pattern ".*\.moc" --exclude-pattern "/opt/.*" --exclude-pattern "/usr/.*" --exclude-pattern ".*moc_.*" --exclude-pattern ".*ui_.*" --exclude-pattern ".*qrc_.*", CMakeFiles gets rid of CMake test stuff (testing compilers etc.), then a third party dependency, two generated files, automoc, .moc, moc, ui and qrc_ are also generated, /opt and /usr are more dependencies. Now for some reason this also gets rid of all of the REAL files that are in logic/ and gui/, any idea why?

pcolby commented 10 years ago

This info may help you... from reading the src, it seems that the excludes are applied at two very different places:

  1. they're used to exclude *.gcov files processed for aggregating the coverage data; and
  2. they're used to exclude source files (depends on the extension options) from the list of files to send to coveralls.io

So, for example, in my case, if I were to do -e test to exclude the test source from the output (step 2 above), then, because my build system also generates the .gcno (and thus .gcov) files in the test directory, they're excluded also (step 1 above), resulting in zero coverage for all files.

Ultimately, we should probably be able to specify those exclude types separately, but in the meantime, something like this works for me: -E '.*/test/*.cpp'

Hope that helps.

eddyxu commented 10 years ago

I really do believe that I need a comprehensive cases to test the combinations of different exclude patterns..

02JanDal commented 10 years ago

@pcolby I can't see which of the excludes could've excluded everything @eddyxu Probably hard to find a good set of excludes.

Is there some way to setup my local computer for testing the output? I tried setting TRAVIS_BRANCH to develop and TRAVIS_JOB_ID to the job id of the latest travis job, but it gave me a "Build processing error".

eddyxu commented 10 years ago

@02JanDal I just released a new version. It supports using --dryrun to avoid actually uploading report to coveralls.io.

You should be able to run coveralls --verbose --dryrun to check output.

02JanDal commented 10 years ago

Nice, this doesn't really tell me a lot though: http://paste.ubuntu.com/7213994/

pcolby commented 10 years ago

@02JanDal in my case, excluding "test" meant that gcov was not executed on the test application's .gcno file and/or the generated .gcna file was skipped. These are the files that record all of the code hits that occurred during the execution of the unit test binary itself, so excluding it meant that no code coverage was counted at all - ie all source code counts were NULL in the generated json.

I hope that made sense.

Cheers.

02JanDal commented 10 years ago

@pcolby I've looked through the exclude options back and forth several times, and I can't see any of them doing something like that. I'll try to remove each of them individually to hopefully find out which one is making problems.

pcolby commented 10 years ago

@02JanDal yeah, may not be an issue for your repo / test layout. Good luck hunting either way :smile:

02JanDal commented 10 years ago

@pcolby Thank you anyway. @eddyxu Found something interesting: https://travis-ci.org/02JanDal/MultiMC5/builds/22449439#L841 Also, --root and --build-root, how should they be used?

EDIT: https://travis-ci.org/02JanDal/MultiMC5/builds/22467859#L445

hbdgr commented 7 years ago

In the project above: After adding second directory -e 'src/special_behaviour/' our code coverage has increased significantly, but only because the first -e 'src/test' start to be ignored.

code change

Is it really not possible to add several directories as excluded? Or maybe we are doing something wrong.