cpp-coveralls icon indicating copy to clipboard operation
cpp-coveralls copied to clipboard

Crashing with "IOError: [Errno 2] No such file or directory: '[..].c'"

Open hartwork opened this issue 7 years ago • 9 comments

Hi!

This looks related to libtool (#23) and similar to #11 but since these are long closed and I am running the latest version, it may not be the same thing:

$ pip list 2>/dev/null | fgrep cpp-coveralls
cpp-coveralls (0.3.12)

$ cpp-coveralls --dryrun
[..]
Traceback (most recent call last):
  File "/usr/local/bin/cpp-coveralls", line 11, in <module>
    sys.exit(run())
  File "/usr/local/lib/python2.7/dist-packages/cpp_coveralls/__init__.py", line 96, in run
    cov_report = coverage.collect(args)
  File "/usr/local/lib/python2.7/dist-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: 'PROJECT_ROOT/SUB_FOLDER/lib/lib/SOME.c'

Related files are located at:

  • PROJECT_ROOT/SUB_FOLDER/lib/.libs/SOME.gcda
  • PROJECT_ROOT/SUB_FOLDER/lib/.libs/SOME.gcno
  • PROJECT_ROOT/SUB_FOLDER/lib/.libs/SOME.o
  • PROJECT_ROOT/SUB_FOLDER/lib/SOME.c
  • PROJECT_ROOT/SUB_FOLDER/lib/SOME.gcno
  • PROJECT_ROOT/SUB_FOLDER/lib/SOME.lo
  • PROJECT_ROOT/SUB_FOLDER/lib/SOME.o
  • PROJECT_ROOT/SUB_FOLDER/SOME.c.gcov

Best, Sebastian

hartwork avatar Mar 13 '17 15:03 hartwork

Any news? I cannot use Coveralls before this is fixed :(

hartwork avatar Mar 29 '17 20:03 hartwork

Could you tell me what is the content in *.gcno and *.gcov? cpp-coveralls uses .gcov to find the files. So we needs to know how these files are generated.

Thanks

eddyxu avatar Mar 29 '17 21:03 eddyxu

Hi!

This is what I do precisely:

git clone https://github.com/libexpat/libexpat.git
cd libexpat
./buildconf.sh
./qa.sh coverage
cpp-coveralls --dryrun --dump FOO.json

The ./qa.sh coverage can be replace by ..

CFLAGS='--coverage --no-inline' CXXFLAGS='--coverage --no-inline' ./configure
make all check
find lib -name '*.gcda' | sort | xargs gcov

.. if you want to keep it minimal. .gcno files seem to be created during make check.

Does that help?

hartwork avatar Mar 29 '17 21:03 hartwork

@hartwork I can't reproduce this.

$ git clone https://github.com/libexpat/libexpat.git
Cloning into 'libexpat'...
$ cd libexpat
$ ./buildconf.sh
-bash: ./buildconf.sh: No such file or directory

myint avatar Apr 09 '17 22:04 myint

it seems buildconf.sh is inside expat/

Here are the updated instructions:

$ git clone https://github.com/libexpat/libexpat.git
Cloning into 'libexpat'...
[...]
$ cd libexpat/expat/
$ ./buildconf.sh
[...]
$ ./qa.sh coverage
[...]
$ cpp-coveralls --dryrun --dump FOO.json

I'm not able to test cpp-coveralls yet, but the other steps WFM.

chrisosaurus avatar Apr 10 '17 02:04 chrisosaurus

it seems buildconf.sh is inside expat/

Yes, sorry.

$ cd libexpat/expat/

Exactly.

hartwork avatar Apr 10 '17 20:04 hartwork

I think I have the exact same problem when I try to add coveralls support in the curl project, visible in this travis build.

bagder avatar Jun 02 '17 22:06 bagder

I found a work-around. By specifying each source directory with -i, it seems this error can be avoided. I still consider it a bug, but this way I think I can still use it.

bagder avatar Jun 03 '17 21:06 bagder

Seeing this also (https://travis-ci.org/awesomeWM/awesome/jobs/255010729):

luacov reports:

CMakeCCompilerId.gcda:cannot open data file, assuming not executed
File 'CMakeCCompilerId.c'
Lines executed:0.00% of 8
Creating 'CMakeCCompilerId.c.gcov'

Then cpp-coveralls crashed on it:

Traceback (most recent call last):
  File "/usr/bin/coveralls", line 11, in <module>
    load_entry_point('cpp-coveralls==0.3.12', 'console_scripts', 'coveralls')()
  File "/usr/lib/python2.7/site-packages/cpp_coveralls/__init__.py", line 96, in run
    cov_report = coverage.collect(args)
  File "/usr/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: '/src/awesome/build/CMakeCCompilerId.c'

It think in this case the file gets created/considered by specifying/using coverage already before cmake builds the project, via:

  export CFLAGS="-fprofile-arcs -ftest-coverage"
  export LDFLAFS="-fprofile-arcs -ftest-coverage"

blueyed avatar Jul 18 '17 20:07 blueyed