cpp-coveralls
cpp-coveralls copied to clipboard
Crashing with "IOError: [Errno 2] No such file or directory: '[..].c'"
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
Any news? I cannot use Coveralls before this is fixed :(
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
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 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
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.
it seems buildconf.sh is inside expat/
Yes, sorry.
$ cd libexpat/expat/
Exactly.
I think I have the exact same problem when I try to add coveralls support in the curl project, visible in this travis build.
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.
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"