[systemd-devel] [PATCH] Add test coverage and generate report with lcov

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Fri Mar 29 07:37:13 PDT 2013


On Thu, Mar 28, 2013 at 02:54:06PM +0100, Thomas H.P. Andersen wrote:
> On Wed, Feb 13, 2013 at 4:16 AM, Lennart Poettering
> <lennart at poettering.net> wrote:
> > On Tue, 05.02.13 23:56, Thomas H.P. Andersen (phomes at gmail.com) wrote:
> >
> >> Adds test coverage and generates html reports. Configure with
> >> --enable-coverage and run make lcov.
> >>
> >> make lcov-upload exists but it currently just rsyncs the report to
> >> ~/coverage. Perhaps we can set up a host for it and automate it later?
> >
> > We could probably upload that to fdo...
> >
> >> I have temporarily uploaded an example to look at here:
> >> http://people.gnome.org/~thomashpa/coverage/
> >
> > Neat!
> >
> >> Assuming that this is only useful for the core developers/buildbots I
> >> have not cluttered the code with workarounds for old versions for
> >> libtool, checks for non-gcc compilers, etc. I can add it you find it
> >> worth the extra lines in configure (or split it out to a m4 like
> >> gstreamer).
> >>
> >> Note that this requires lcov 1.10. (rawhide is still at 1.9). The
> >> older versions have bugs that we hit with systemd. 1.10 also has the
> >> --no-external option that avoids including things from /usr in the
> >> report.
> >
> > Hmm, given that this isn't even in rawhide, it might make sense to at
> > least check for lcov version in autoconf, as only test?
> 
> I forgot about this. lcov 1.10 is now in rawhide, but here is an
> updated patch with the version check anyway.
It would be nice to start making use of this.
I gave it a spin today:

% make -C build lcov-run
make: Entering directory `/home/zbyszek/systemd/build'
lcov --directory . --zerocounters
Deleting all .da files in . and subdirectories
Done.
make check
make[1]: Entering directory `/home/zbyszek/systemd/build'
make --no-print-directory check-recursive
Making check in .
make --no-print-directory  test/sys
make[4]: `test/sys' is up to date.
make --no-print-directory check-TESTS
PASS: test-job-type
...

% make -C build lcov-report
make: Entering directory `/home/zbyszek/systemd/build'
mkdir lcov
lcov --compat-libtool --base-directory . --directory . --no-external --capture --output-file lcov/lcov.info
Capturing coverage data from .
Found gcov version: 4.7.2
Scanning . for .gcda files ...
geninfo: ERROR: no .gcda files found in .!
make: *** [lcov-report] Error 255
make: Leaving directory `/home/zbyszek/systemd/build'

No support for separate build dir?

Zbyszek


More information about the systemd-devel mailing list