I am getting code coverage statistics with for one of my small library's that I'm currently testing. However, I'm getting a few odd results, lines that I know are being covered are not being counted, Other lines are being missed, until I cover them.
For lines being covered but missed see lines 63, 83, 96 & 113
For lines being missed see line 342
My library of routines is written in C++ and uses many QT routines.
I have compiled with and without optimisation and of course I include the flags -fprofile-arcs -ftest-coverage when both compiling and linking.
my commands to lcov are as follows:
lcov -z -d object/ -q
# generate a blank coverage file
lcov -c -i -d object/ -o lcov_tmp/qgetopt_base.info -q
lcov -e lcov_tmp/qgetopt_base.info "*optionManager/opt*" -o lcov_tmp/qgetopt_base.info -q
# Run the tests
# generate the coverage data from the unit tests
lcov -c -d object/ -o lcov_tmp/qgetopt_utest.info -t unitTests -q
lcov -e lcov_tmp/qgetopt_utest.info "*optionManager/opt*" -o lcov_tmp/qgetopt_utest.info -q
lcov -a lcov_tmp/qgetopt_base.info -a lcov_tmp/qgetopt_utest.info -a lcov_tmp/qgetopt_test.info -o lcov_tmp/qgetopt_total_coverage.info -q
# Generate the html report from the tests
genhtml -o ./coverage lcov_tmp/qgetopt_total_coverage.info -t "qgetopt test coverage" -s
Note: The coverage details in lcov_tmp/qgetopt_test.info are generated by the test2 program itself
My question: Is this something that I have to live with or is there a work around?