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.
parent
f4b46b0c
Please register or sign in to comment