I am using gcov for coverage test in macosx platform. I finish the configuration for xcode by set:
1. Build Settings ==> Generate Test Coverage Files == Yes
2. Build Settings ==> Instrument Progaram Flow == Yes
3. Build Phases ==> Link Binary with library ==> add "libprofile_rt.dylib"
Then generate the files "Test.d, Test.dia, Test.gcno, Test.gcda, Test.o
"
Then i use gcov-4.2 -b Test.gcno
command to generate the Test.m.gcov
file (this is what i want), but next time when i run test cases again, the files "Test.d, Test.dia, Test.gcno, Test.gcda, Test.o
" will be generated again, and the data will be reset.
So I have two questions:
If the #1 is hopeless, could you tell me how to merge two Test.gcno
files (generated by two times' running) into one. I try gcov in terminal, below are the options for gcov command:
gcov-4.2 -help
Usage: gcov [OPTION]... SOURCEFILE
Print code coverage information.
-h, --help Print this help, then exit
-v, --version Print version number, then exit
-a, --all-blocks Show information for every basic block
-b, --branch-probabilities Include branch probabilities in output
-c, --branch-counts Given counts of branches taken
rather than percentages
-n, --no-output Do not create an output file
-l, --long-file-names Use long output file names for included
source files
-f, --function-summaries Output summaries for each function
-o, --object-directory DIR|FILE Search for object files in DIR or called FILE
-p, --preserve-paths Preserve all pathname components
-u, --unconditional-branches Show unconditional branch counts too
For bug reporting instructions, please see:
<URL:http://developer.apple.com/bugreporter>.
Thanks for all your help in advance
The usual workflow for gcov
is
-fprofile-arcs -ftest-coverage
).gcda
filesgcov
to get coverage statistics in a human-readable format (.gcov
)So basically, successive runs of the application will result in accumulated coverage statistics. It's just that these accumulations will take place in the .gcda
files, not the .gcov
files, so you have to re-run gcov
each time you want to see updated statistics.