build coverage: make coverage numbers more accurate by using a baseline

The lcov tool offers the functionality to have an initial run over the code base
before the tests are executed to make sure it catches all files, even the ones
that are not loaded during the test run.

This is something we missed so far. The reports have only been in relation to
the files that actually have been loaded during the test. We missed quite a
few files which made our numbers inaccurate. Things like
modules/emotion/gstreamer1 have no tests yet and thus never showed up in the
coverage report. While it has 103 functions and over thousand lines which need
to get covered. With the baseline this is handled now. Thanks goes to the folks
at LibreOffice who described their lcov setup here:
https://wiki.documentfoundation.org/Development/Lcov

New numbers are lower now as we count in all the files never loaded which
decreases our percentages.

Overall coverage rate:
  lines......: 30.2% (65119 of 215841 lines)
  functions..: 34.0% (6361 of 18733 functions)
  branches...: 23.6% (35627 of 151096 branches)
This commit is contained in:
Stefan Schmidt 2016-03-09 23:02:46 +01:00
parent b0c28953b3
commit 3666d14980
1 changed files with 13 additions and 6 deletions

View File

@ -428,13 +428,19 @@ lcov-reset:
@find $(top_builddir) -name "*.gcda" -delete
@lcov --zerocounters --directory $(top_builddir)
lcov-report:
lcov-baseline:
$(MKDIR_P) $(top_builddir)/coverage
lcov --capture --compat-libtool --no-external --output-file $(top_builddir)/coverage/coverage.info --directory $(top_builddir) --config-file .lcov-config --rc lcov_branch_coverage=1
lcov --remove $(top_builddir)/coverage/coverage.info '*.h' --output-file $(top_builddir)/coverage/coverage.cleaned.info --config-file .lcov-config --rc lcov_branch_coverage=1
lcov --remove $(top_builddir)/coverage/coverage.cleaned.info '*/tests/*' --output-file $(top_builddir)/coverage/coverage.cleaned2.info --config-file .lcov-config --rc lcov_branch_coverage=1
lcov --remove $(top_builddir)/coverage/coverage.cleaned2.info '*NONE*' --output-file $(top_builddir)/coverage/coverage.cleaned3.info --config-file .lcov-config --rc lcov_branch_coverage=1
genhtml --config-file .lcov-config --legend -t "$(PACKAGE_STRING)" -o $(top_builddir)/coverage/html $(top_builddir)/coverage/coverage.cleaned3.info
lcov --capture --initial --compat-libtool --no-external --output-file $(top_builddir)/coverage/coverage-baseline.info --directory $(top_builddir) --config-file .lcov-config --rc lcov_branch_coverage=1
lcov-report:
lcov --capture --compat-libtool --no-external --output-file $(top_builddir)/coverage/coverage-check.info --directory $(top_builddir) --config-file .lcov-config --rc lcov_branch_coverage=1
lcov --no-external --compat-libtool --add-tracefile $(top_builddir)/coverage/coverage-baseline.info --add-tracefile $(top_builddir)/coverage/coverage-check.info --output-file $(top_builddir)/coverage/coverage.info --config-file .lcov-config --rc lcov_branch_coverage=1
lcov --no-external --compat-libtool --remove $(top_builddir)/coverage/coverage.info '*.h' --output-file $(top_builddir)/coverage/coverage.cleaned.info --config-file .lcov-config --rc lcov_branch_coverage=1
lcov --no-external --compat-libtool --remove $(top_builddir)/coverage/coverage.cleaned.info '*/tests/*' --output-file $(top_builddir)/coverage/coverage.cleaned2.info --config-file .lcov-config --rc lcov_branch_coverage=1
lcov --no-external --compat-libtool --remove $(top_builddir)/coverage/coverage.cleaned2.info '*NONE*' --output-file $(top_builddir)/coverage/coverage.cleaned3.info --config-file .lcov-config --rc lcov_branch_coverage=1
lcov --no-external --compat-libtool --remove $(top_builddir)/coverage/coverage.cleaned3.info '*/doc/*' --output-file $(top_builddir)/coverage/coverage.cleaned4.info --config-file .lcov-config --rc lcov_branch_coverage=1
lcov --no-external --compat-libtool --remove $(top_builddir)/coverage/coverage.cleaned4.info '*usr/include*' --output-file $(top_builddir)/coverage/coverage.cleaned5.info --config-file .lcov-config --rc lcov_branch_coverage=1
genhtml --config-file .lcov-config --legend -t "$(PACKAGE_STRING)" -o $(top_builddir)/coverage/html $(top_builddir)/coverage/coverage.cleaned5.info
@echo "Coverage Report at $(top_builddir)/coverage/html"
endif
@ -444,6 +450,7 @@ if EFL_ENABLE_TESTS
lcov-check:
if EFL_ENABLE_COVERAGE
@$(MAKE) $(AM_MAKEFLAGS) lcov-reset
@$(MAKE) $(AM_MAKEFLAGS) lcov-baseline
endif
@$(MAKE) $(AM_MAKEFLAGS) check
if EFL_ENABLE_COVERAGE