tests: Allow generating coverage info.
ClosedPublic

Authored by kai on Jun 8 2017, 7:13 PM.

Details

Test Plan
  • install lcov
  • ./configure /*...*/ --enable-gcov
  • make coverage-html
  • xdg-open coveragereport/index.html

Diff Detail

Repository
rK libksba
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
kai created this revision.Jun 8 2017, 7:13 PM
werner added a subscriber: werner.Jun 8 2017, 9:11 PM

Thanks for working on that.

Given that we are preparing final releases, better do real test in private branches (kai/master or km/master) for now.

Makefile.am
84

This looks like a lot of boilerplate code. It is okay to test this in libksba but when we come to the point touse this with more packages I would suggest to do this as a shell script. Our ./autogen.sh is already the common denominator of all configure stuff. Adding a mode there to enable coverage reports and to use it as a helper script for Makefiles (iff needed) will make things much easier to maintain and keep consistend between packages. The generic autogen.sh source is in libgpg-error.

README.GIT
53 ↗(On Diff #1280)

FWIW, Maintaining such files in all packages is a pita. We should either replace that by a link gnupg.org/devel/something or point to the README.GIT in libgpg-error, which is the dependency of all our packages (except for the very special nPth)

configure.ac
131

I'd suggest to that only in maintainer mode.

kai planned changes to this revision.Jun 9 2017, 7:20 PM

I didn't realize that we have a release coming up. Makes sense to postpone putting the changes into master until we're sure it doesn't break the build. Thanks for the review!

Makefile.am
84

I'll try to integrate that into gcov.m4. The problem is that the boilerplate is project specific b/c it's excluding things like tests and utility functions from the coverage.

README.GIT
53 ↗(On Diff #1280)

How about adding it to HACKING in gnupg?

werner added inline comments.Jun 13 2017, 12:57 PM
README.GIT
53 ↗(On Diff #1280)

Actually there is another task. We should move away from the distributed gnupg/doc/HACKING as primary source to the gnupg-doc/web/faq/HACKING.org. (or we even move from faq/ to the new devel/)

We can more easily update the web page so that new hackers get the latest info and not those from some distributed tarball. gnupg would then distribute a copy retrieved using the "make distcheck".

kai updated this revision to Diff 1304.Aug 10 2017, 3:38 PM

Generate coverage information.

  • autogen.sh: add options --coverage and --report to help w/ coverage info collection and reporting.
  • m4/gcov.m4: new file. Boilerplate for locating gcov et.al.
  • Makefile.am: add coverage-html target

GnuPG-Bud-Id: 3050
Test Plan:
./configure --enable-maintainer-mode --enable-gcov

make coverage-html

To measure test coverage gcov and lcov needs to be installed and
./configure called w/ --enable-gcov. The coverage-html make target will
then create a HTML report.

kai marked 3 inline comments as done.Aug 10 2017, 3:39 PM

Most of the boilerplate was moved to autogen.sh

marcus accepted this revision.EditedAug 10 2017, 3:53 PM

Cool. I tested building without and with coverage report enabled.

This revision is now accepted and ready to land.Aug 10 2017, 3:53 PM
This revision was automatically updated to reflect the committed changes.