I am trying to generate coverage report for my project and running into a problem.
I understand that to get the coverage info, I need .gcno, .gcda and source files. My current project dir structure is
/root/proj/src --> top level Makefile and main.c
/root/proj/src/module1
/root/proj/src/module2
..... -> contains all .c/.h ,makefile
/root/proj/build/obj -> contains all .o,.gcno,.gcda files after compilation
/root/proj/build/exe -> contains the executable
(copying minimal lines below to show the problem)
cd /root/proj/build/obj
when I run
lcov -b ../../src/ --directory . --capture --output-file app.info
Processing module1.gcda
module1.c:cannot open source file
......
Finished .info-file creation
Then :
genhtml --legend -o ./latest_code_cov/ app.info
Reading data file app.info
Found 5 entries.
Found common filename prefix "/root/proj/src"
Writing .css and .png files.
Generating output.
Processing file src/module1.c
genhtml: ERROR: cannot read /root/proj/src/module1.c
bash-4.1$
1) Do I need to change my makefile to dump .gcno/.gcda
files in the same folders as the source?
2) Is there a way(some flag) to set the source file path in .gcno/.gcda
files?
Any suggestions?
gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
lcov: LCOV version 1.13