1 Here is how to use gcov to test code coverage in ldb.
3 Step 1: enable gcov support
5 Edit Makefile.ldb and uncommend the two GCOV_ lines
9 make -sf Makefile.ldb clean all
11 Step 3: run the test suite
12 make -sf Makefile.ldb test-tdb
14 Step 4: produce the gcov report
15 make -sf Makefile.ldb gcov
17 Step 5: read the summary reports
20 Step 6: examine the per-file reports
21 less ldb_tdb\#ldb_tdb.c.gcov
23 You can also combine steps 2 to 4 like this:
25 make -sf Makefile.ldb clean all test-tdb gcov
27 Note that you should not expect 100% coverage, as some error paths
28 (such as memory allocation failures) are very hard to trigger. There
29 are ways of working around this, but they are quite tricky (they
30 involve allocation wrappers that "fork and fail on malloc").
32 The lines to look for in the per-file reports are the ones starting
33 with "#####". Those are lines that are never executed.