eddyxu / cpp-coveralls

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

Trouble handling generated code #115

Open nicowilliams opened 7 years ago

nicowilliams commented 7 years ago

I'm trying to add coveralls CI with Travis to Heimdal (see also my fork).

cpp-coveralls ends up using the wrong path to generated code files. Eventually I concluded that out-of-source builds are not well supported and modified the .travis.yml (in my fork) accordingly, but still, there's always some file cpp-coveralls cannot find, as you can see in the logs (scroll to the bottom):

Traceback (most recent call last):
  File "/home/travis/.local/bin/coveralls", line 11, in <module>
    load_entry_point('cpp-coveralls==0.3.12', 'console_scripts', 'coveralls')()
  File "/home/travis/.local/lib/python2.7/site-packages/cpp_coveralls/__init__.py", line 96, in run
    cov_report = coverage.collect(args)
  File "/home/travis/.local/lib/python2.7/site-packages/cpp_coveralls/coverage.py", line 447, in collect
    with io.open(source_file_path, mode='rb') as src_file:
IOError: [Errno 2] No such file or directory: '/home/travis/build/nicowilliams/heimdal/intr.c'

EDIT: intr.c is not generated, it is normally actually tests/bin/intr.c. I don't know why or how the dirname of that got lost.

I'm running cpp-coveralls like this:

      coveralls --gcov-options '\-lp'       \
                -x c                        \
                -r `dirname "$PWD"`         \
                -b "$PWD"

I've tried a variety of... variations. I've tried using -e with various forms of the troublesome filenames.

nicowilliams commented 7 years ago

If I use in-tree builds and drop the -r and -b and -x options I still get this:

Traceback (most recent call last):
  File "/home/travis/.local/bin/coveralls", line 11, in <module>
    load_entry_point('cpp-coveralls==0.3.12', 'console_scripts', 'coveralls')()
  File "/home/travis/.local/lib/python2.7/site-packages/cpp_coveralls/__init__.py", line 96, in run
    cov_report = coverage.collect(args)
  File "/home/travis/.local/lib/python2.7/site-packages/cpp_coveralls/coverage.py", line 447, in collect
    with io.open(source_file_path, mode='rb') as src_file:
IOError: [Errno 2] No such file or directory: '/home/travis/build/nicowilliams/heimdal/libtommath/bn_mp_reduce_2k_l.c'