Test suite code coverage reports

Havoc Pennington hp at redhat.com
Wed May 10 08:16:36 PDT 2006


Yay you rule!

Daniel P. Berrange wrote:
> Both have pretty impressively high test coverage - great job by all those
> responsible for writing test cases!

These scripts are great to see, to me easy coverage reporting is 
critical to getting test coverage in practice.

For the bulk of dbus's lifetime I used to have a working "make 
coverage-report" that would in one step run the build, run make check, 
and then dump out reports much like these you have here (total and file 
percentages, and then line-by-line annotated source).

Do you think we could put these into the dbus tree instead of my old C 
version that fell behind gcov, and get "make coverage-report" working 
again? Having it in perl is fine, it's not a required dependency of 
anything and about everyone with gcc/gcov is going to have perl too.

One thing I had in the old tool was that it didn't include lines of code 
(and basic blocks) inside #ifdef DBUS_BUILD_TESTS in the statistics, 
without that fix you can't get to 100% coverage due to code like:

  if (!run_test())
    die("test failed"); // test suite does not cover this line!


More information about the dbus mailing list