GNOME Bugzilla – Bug 659610
Support code coverage report generation
Last modified: 2012-01-08 23:40:43 UTC
It would be useful to add build system rules for generating code coverage metrics for Folks. Particularly if we can ensure that those rates steadily improve. Both Vala and telepathy-glib have decent machinery for using lcov, so let's see how they do it.
commit 4acfe29de66deff09e778084dae2d9f39fdbf28e Author: Philip Withnall <philip@tecnocode.co.uk> Date: Sun Jan 8 23:16:14 2012 +0000 build: Add lcov make targets from telepathy-glib Add lcov.mk, copied from telepathy-glib: http://cgit.freedesktop.org/telepathy/telepathy-glib/tree/tools/lcov.am with the tp-glib–specific bits removed. These targets are only useful if folks is compiled with --enable-code-coverage. To run the test suite and generate a report, run `make lcov-check`. To just generate a report without running the test suite, run `make lcov-report`. The .info file and generated report are only deleted by `make maintainer-clean`, since the developer might want to refer to them across other cleans. Closes: https://bugzilla.gnome.org/show_bug.cgi?id=659610 Makefile.am | 15 +++++++++++++++ lcov.mk | 23 +++++++++++++++++++++++ 2 files changed, 38 insertions(+), 0 deletions(-) commit 945cb3d7301b94205ad77fb454482d07679f5037 Author: Philip Withnall <philip@tecnocode.co.uk> Date: Sun Jan 8 15:58:16 2012 +0000 build: Add an --enable-code-coverage configure parameter When building with code coverage enabled, -fprofile-arcs and -ftest-coverage will be passed to gcc during compilation, and -lgcov will be passed during linking. Code coverage is disabled by default for the core of folks, since it has to turn off valac’s ‘-g’ option to output #line directives in the generated C code. This is necessary because lcov gets confused by execution passing between .vala and .c files. More useful results can be obtained by just looking at the code coverage of the .c files and ignoring the boilerplate in them. (More specifically, lcov reports on .vala files aren’t especially useful because they erroneously mark many lines as being executed which actually weren’t. This happens because one Vala line may be compiled into several lines of C, some of which will be executed unconditionally even if the Vala line itself isn’t executed. This will fool lcov into thinking the Vala line was actually executed.) Code coverage is automatically turned off when making a release. backends/eds/Makefile.am | 2 + backends/eds/lib/Makefile.am | 2 + backends/key-file/Makefile.am | 2 + backends/libsocialweb/Makefile.am | 2 + backends/libsocialweb/lib/Makefile.am | 2 + backends/telepathy/Makefile.am | 2 + backends/telepathy/lib/Makefile.am | 4 +++ backends/tracker/Makefile.am | 2 + backends/tracker/lib/Makefile.am | 2 + configure.ac | 34 +++++++++++++++++++++++++++++++- folks/Makefile.am | 4 +++ 11 files changed, 56 insertions(+), 2 deletions(-)