I would like to use gcov with my unit test written using QTestLib. I have managed to generate some .gcno files along my object files by adding this to my .pro file :
QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage -O0
But, when I run :
gcov main.cpp.gcno
I got a bunch of .gcov files generated with non-useful content (nothing like what I see in the tutorials on the web) :
-: 0:Source:main.cpp
-: 0:Graph:main.gcno
-: 0:Data:-
-: 0:Runs:0
-: 0:Programs:0
-: 1:/*EOF*/
-: 2:/*EOF*/
-: 3:/*EOF*/
-: 4:/*EOF*/
-: 5:/*EOF*/
-: 6:/*EOF*/
-: 7:/*EOF*/
-: 8:/*EOF*/
-: 9:/*EOF*/
-: 10:/*EOF*/
-: 11:/*EOF*/
-: 12:/*EOF*/
-: 13:/*EOF*/
-: 14:/*EOF*/
#####: 15:/*EOF*/
-: 16:/*EOF*/
#####: 17:/*EOF*/
-: 18:/*EOF*/
-: 19:/*EOF*/
#####: 20:/*EOF*/
-: 21:/*EOF*/
-: 22:/*EOF*/
-: 23:/*EOF*/
-: 24:/*EOF*/
#####: 25:/*EOF*/
#####: 26:/*EOF*/
-: 27:/*EOF*/
-: 28:/*EOF*/
-: 29:/*EOF*/
#####: 30:/*EOF*/
My source files are under ./MyProject/test/src directory and all my object files are in a .obj directory underneath src (ie: .MyProject/test/src/.obj). All binaries are created in ./MyProject/build directory.
What am I missing?
Thanks!
You can use gcov as a profiling tool to help discover where your optimization efforts will best affect your code. You can also use gcov along with the other profiling tool, gprof, to assess which parts of your code use the greatest amount of computing time. Profiling tools help you analyze your code's performance.
Have you run your QT program? Until then there's no coverage data. Also, have a look at lcov, which you can use to get a nice html-based report of everything
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With