DGCov: A tool for checking test coverage of a patch

Today I published the DGCov tool on the MySQL Forge.

DGCov is a neat tool that I implemented last year for use internally at MySQL, an old idea of Monty’s.

The idea is to help developers to check that a new patch for the server code has received adequate testing before pushing it to the main tree. The GCC compiler has the gcov tool that can check which lines of the source code were never executed even once. But suppose you change a few 1000 lines across a big source base like MySQL. Then GCov output is not all that useful, since it will report tons of lines as not executed, and it is difficult to manually check which of those lines were touched by your patch.

The DGCov tool takes the GCov output and filters it so that it only shows those lines that were touched by the patch being checked. This output is immediately applicable to the work done by the developer, and very useful to check what the test coverage is, especially when doing patches that make smaller changes across a big part of the source.

Of course, just checking code coverage is not sufficient to ensure that good testing has been done of the code! But it is very good for making sure that one’s changes have at least been run once before releasing them. This way one can avoid embarrasments like publishing infinite loops or uncontitional crashes in the code.

Hopefully, others will be able to use this for MySQL or other development projects (it is not specific to MySQL at all really).

Leave a comment

Your email address will not be published. Required fields are marked *