Test code coverage

5 views
Skip to first unread message

Victor Kirkebo

unread,
Sep 4, 2008, 7:34:06 AM9/4/08
to memc...@googlegroups.com
This patch adds test coverage to the 'make test' target.
gcov is used for gcc and tcov is used for Sun studio compiler.

Victor

test_codecoverage.diff

dormando

unread,
Sep 6, 2008, 5:24:54 AM9/6/08
to memc...@googlegroups.com
Hey,

Think this could be modified to not spit coverage on files not in the
source tree?

File '/usr/include/gentoo-multilib/amd64/sys/stat.h'
Lines executed:0.00% of 1
/usr/include/gentoo-multilib/amd64/sys/stat.h:creating 'stat.h.gcov'

File '/usr/include/gentoo-multilib/amd64/stdlib.h'
Lines executed:27.27% of 11
/usr/include/gentoo-multilib/amd64/stdlib.h:creating 'stdlib.h.gcov'

File 'slabs.c'
Lines executed:16.39% of 122
slabs.c:creating 'slabs.c.gcov'

File '/usr/include/gentoo-multilib/amd64/stdlib.h'
Lines executed:0.00% of 3
/usr/include/gentoo-multilib/amd64/stdlib.h:creating 'stdlib.h.gcov'

Anyone else have comments?
-Dormando

Victor Kirkebo

unread,
Sep 9, 2008, 6:02:55 AM9/9/08
to memc...@googlegroups.com
Hi,
I've attached a new version of this patch that excludes printing of
coverage on non-source-tree files.
The printout looks like this:

with gcov:
File `assoc.c' Lines executed:1.66% of 181
File `items.c' Lines executed:2.82% of 248
File `memcached.c' Lines executed:9.40% of 1554
File `slabs.c' Lines executed:14.84% of 128
File `stats.c' Lines executed:2.60% of 77

with tcov:
assoc.c : 1.02 Percent of the file executed
items.c : 2.39 Percent of the file executed
memcached.c : 8.15 Percent of the file executed
slabs.c : 15.65 Percent of the file executed
stats.c : 1.72 Percent of the file executed

-Victor


--
Victor Kirkebo
Database Technology Group
TRO01, x43408/(+47)73842108

test_codecoverage.diff

dormando

unread,
Sep 9, 2008, 1:23:08 PM9/9/08
to memc...@googlegroups.com
The test coverage is exceptionally low.

Is this only accounting the coverage of the last executed test?

Victor Kirkebo

unread,
Sep 11, 2008, 6:41:21 AM9/11/08
to memc...@googlegroups.com
You're right - something is very wrong with the numbers.
It only seems to report coverage for the tests in 00-startup.t. If I try
to run only the tests in any of the other *.t files there's no output.
I'm not sure why this happens but will look into it.

-Victor

Victor Kirkebo

unread,
Sep 19, 2008, 2:25:31 PM9/19/08
to memc...@googlegroups.com
Memcached::Handle::DESTROY needs to kill the memcached process with
SIGINT (instead of SIGKILL).
Now the numbers look better:
File 'assoc.c' Lines executed:49.13% of 173
File 'items.c' Lines executed:70.61% of 228
File 'memcached.c' Lines executed:65.32% of 1485
File 'slabs.c' Lines executed:84.43% of 122
File 'stats.c' Lines executed:90.00% of 70

-Victor

test_codecoverage.diff
Reply all
Reply to author
Forward
0 new messages