1. Red Hat People
  2. Daniel Berrange
  3. DBus Test Suite Coverage

DBus Test Suite Coverage

DBus has an extensive test suite, but just how extensive is it, and are there any bits which could be improved? The gcov tool can help answer these questions.

Using gcov is pretty straightford - compile and link with the -fprofile-arcs -ftest-coverage GCC flags. Then run the test suite / application, and upon exit you'll notice a bunch of extra binary files have appeared with a file extension .gcda. The gcov tool will read the .o files, the .gcda files and original .c source files and produce source code annotated to show execution coverage.

Unfortunately reading the annotated files is rather slow & tedious, with no provision made to ease visualization of coverage across an entire library or application. Fortunately with a little Perl code, one can easily generate HTML reports giving a clear visualization of results. To see an example of what can be produced here are the reports run against DBus CVS tip of May 9th, 2006:

If people want to generate similar reports for other applications, here are the links to the handful of scripts used to generate the reports:


Last updated on Tuesday, May 9th, 2006