I am trying to use gcovr on my linux project and have no luck getting .gcda files for the dynamic library after executing binary.
I have a project called projectA which creates a library called libprojectA.so and the unit test project links libprojectA.so. The main goal here is that I want to see the code coverage of projectA functions invoked from the unit test binary UnitTestExecutable.
I have such a directory structure: Project Structure
This is the steps I followed to call gcovr.
Build projectA with its Makefile
- Makefile has "-fprofile-arcs -ftest-coverage -fPIC"
- creates .o and .gcno inside .build directory
- creates dynamic library libprojectA.so
Build unittest
- Makefile links libprojectA.so
- Makefile has "-fprofile-arcs -ftest-coverage -fPIC"
- creates .o and .gcno
- creates binary UnitTestExecutable
Execute UnitTestExecutable
- creates .gcda files inside /unittest/*.gcda
- it doesn't create *.gcda inside /porjectA/ folder <== this is the problem
Call gcovr gcovr -v -r /projectA/ --html --html-details -o test-html-details.html --object-directory=/projectA/.build/
Here it complains that it can't find *.gcda inside /projectA/.build/
Could someone please help ?
Thanks,