1
Here is how to use gcov to test code coverage in ldb.
3
Step 1: build ldb with gcov enabled
5
make clean all WITH_GCOV=1
7
Step 3: run the test suite
10
Step 4: produce the gcov report
13
Step 5: read the summary reports
16
Step 6: examine the per-file reports
17
less ldb_tdb\#ldb_tdb.c.gcov
19
You can also combine steps 2 to 4 like this:
21
make clean all test-tdb gcov WITH_GCOV=1
23
Note that you should not expect 100% coverage, as some error paths
24
(such as memory allocation failures) are very hard to trigger. There
25
are ways of working around this, but they are quite tricky (they
26
involve allocation wrappers that "fork and fail on malloc").
28
The lines to look for in the per-file reports are the ones starting
29
with "#####". Those are lines that are never executed.