-
Notifications
You must be signed in to change notification settings - Fork 285
Description
I'm trying to use gcovr with a cmake project, and it's failing to report code coverage on a fairly basic setup. I've created a sample repository to demonstrate the issue:
https://github.com/freesurfer-rge/gcovr-learn
For reference, if the sources are compiled using the manualbuild.sh
script in the repo root, then after running the binary, gcovr -r .
produces a sensible report.
However, if I go to /tmp/bld
and run
cmake ~/gcovr-learn/
make
./tst/SimpleTest
then gcovr -r .
finds no source files and reports no usage. The .gcno
and .gcda
files are definitely produced. In particular:
./tst/CMakeFiles/SimpleTest.dir:
CXX.includecache cmake_clean.cmake flags.make simpletests.cpp.gcda test.cpp.gcda
DependInfo.cmake depend.internal link.txt simpletests.cpp.gcno test.cpp.gcno
build.make depend.make progress.make simpletests.cpp.o test.cpp.o
but they don't seem to be found. Running with --verbose
I see output such as:
Pool started with 1 threads
Processing file: /tmp/bld/src/CMakeFiles/simple.dir/simple.cpp.gcda
Running gcov: 'gcov /tmp/bld/src/CMakeFiles/simple.dir/simple.cpp.gcda --branch-counts --branch-probabilities --preserve-paths --object-directory /tmp/bld/src/CMakeFiles/simple.dir' in '/tmp/tmps35c5cdp'
Finding source file corresponding to a gcov data file
currdir /tmp/bld
gcov_fname /tmp/tmps35c5cdp/#home#freesurferrge#gcovr-learn#src#simple.cpp.gcov
[' -', ' 0', 'Source', '/home/freesurferrge/gcovr-learn/src/simple.cpp\n']
source_fname /tmp/bld/src/CMakeFiles/simple.dir/simple.cpp.gcda
root /tmp/bld
fname /home/freesurferrge/gcovr-learn/src/simple.cpp
Parsing coverage data for file /home/freesurferrge/gcovr-learn/src/simple.cpp
Filtering coverage data for file /home/freesurferrge/gcovr-learn/src/simple.cpp
which implies that files are being found OK.
The machine is a stock Azure ubuntu 18.04 VM, with the modifications detailed in the setup-commands.txt
file in the repo root.