GCOV and automated testing

Poul-Henning Kamp phk at phk.freebsd.dk
Thu Jun 26 00:31:27 CEST 2008

I have spent the evening running a gcov'ed varnishd and writing
a couple of test-cases to get more code covered.

Unfortunately GCC's gcov does not support shared libraries,
I'm not sure I understand why that would be hard, but they don't
and I'm not going to spend time on it right now.

The lack of shared library coverage means that we only have the
central bin/varnishd directory covered and not the VCL compiler and
libvarnish libraries.

I have not spent time on the other programs (varnishlog, varnishstat

For bin/varnishd, We have 62.12% coverage right now, which is pretty
decent for just 27 testcases.

I'll add more testcases to get better coverage as we go, but
I need to work a bit on the tester to make it less tedious.

Some bits of code are going to be annoying to test, in particular
expiry and grace: even with very short TTLs, the tests will run on
timescales of a minute, rather than a few seconds.

The plan is to get this stuff running in a crontjob on projects.linpro.no
so that the results and statistics can be accessed via the web, but
various weird things prevent that right now, so I'll just run it
ad-hoc on my laptop.

If interested, I have uploaded a copy of the colorcoded results here:


Red code has not been executed by any test-case.

Testcases are of course welcome :-)

Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.

More information about the varnish-dev mailing list