andybons | 6eaa0c0d | 2015-08-26 20:12:52 | [diff] [blame] | 1 | # Code Coverage |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 2 | |
andybons | 6eaa0c0d | 2015-08-26 20:12:52 | [diff] [blame] | 3 | ## Categories of coverage |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 4 | |
andybons | 6eaa0c0d | 2015-08-26 20:12:52 | [diff] [blame] | 5 | * executed - this line of code was hit during execution |
| 6 | * instrumented - this line of code was part of the compilation unit, but not |
| 7 | executed |
| 8 | * missing - in a source file, but not compiled. |
| 9 | * ignored - not an executable line, or a line we don't care about |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 10 | |
andybons | 6eaa0c0d | 2015-08-26 20:12:52 | [diff] [blame] | 11 | Coverage is calculated as `exe / (inst + miss)`. In general, lines that are in |
| 12 | `miss` should be ignored, but our exclusion rules are not good enough. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 13 | |
andybons | 6eaa0c0d | 2015-08-26 20:12:52 | [diff] [blame] | 14 | ## Buildbots |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 15 | |
andybons | 6eaa0c0d | 2015-08-26 20:12:52 | [diff] [blame] | 16 | Buildbots are currently on the |
| 17 | [experimental waterfall](http://build.chromium.org/buildbot/waterfall.fyi/waterfall). |
| 18 | The coverage figures they calculate come from running some subset of the |
| 19 | chromium testing suite. |
| 20 | |
| 21 | * [Linux](http://build.chromium.org/buildbot/waterfall.fyi/builders/Linux%20Coverage%20(dbg)) |
| 22 | - uses `gcov` |
| 23 | * [Windows](http://build.chromium.org/buildbot/waterfall.fyi/builders/Win%20Coverage%20%28dbg%29) |
| 24 | * [Mac](http://build.chromium.org/buildbot/waterfall.fyi/builders/Mac%20Coverage%20%28dbg%29) |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 25 | |
| 26 | Also, |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 27 | |
andybons | 6eaa0c0d | 2015-08-26 20:12:52 | [diff] [blame] | 28 | * [Coverage dashboard](http://build.chromium.org/buildbot/coverage/) |
| 29 | * [Example coverage summary](http://build.chromium.org/buildbot/coverage/linux-debug/49936/) |
| 30 | - the coverage is calculated at directory and file level, and the directory |
| 31 | structure is navigable via the **Subdirectories** table. |
| 32 | |
| 33 | ## Calculating coverage locally |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 34 | |
| 35 | TODO |
| 36 | |
andybons | 6eaa0c0d | 2015-08-26 20:12:52 | [diff] [blame] | 37 | ## Advanced Tips |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 38 | |
andybons | 6eaa0c0d | 2015-08-26 20:12:52 | [diff] [blame] | 39 | Sometimes a line of code should never be reached (e.g., `NOTREACHED()`). These |
| 40 | can be marked in the source with `// COV_NF_LINE`. Note that this syntax is |
| 41 | exact. |