Yuke Liao | 8bc0085 | 2019-01-29 19:22:39 | [diff] [blame] | 1 | # Code Coverage in Gerrit |
| 2 | |
Yuke Liao | 0e5a20e | 2019-06-17 19:52:57 | [diff] [blame] | 3 | Tests are critical because they find bugs and regressions, enforce better |
| 4 | designs and make code easier to maintain. **Code coverage helps you ensure your |
| 5 | tests are thorough**. |
Yuke Liao | 8bc0085 | 2019-01-29 19:22:39 | [diff] [blame] | 6 | |
Yuke Liao | 0e5a20e | 2019-06-17 19:52:57 | [diff] [blame] | 7 | Chromium CLs can show a line-by-line breakdown of test coverage. **You can use |
| 8 | the code coverage trybot to ensure you only submit well-tested code**. |
| 9 | |
| 10 | To see code coverage for a Chromium CL, trigger the code coverage trybot |
| 11 | **linux-coverage-rel**: |
Yuke Liao | 8bc0085 | 2019-01-29 19:22:39 | [diff] [blame] | 12 | |
| 13 | ![choose_tryjobs] ![linux_coverage_rel] |
| 14 | |
Yuke Liao | 0e5a20e | 2019-06-17 19:52:57 | [diff] [blame] | 15 | Once the build finishes and code coverage data is processed successfully, **look |
| 16 | at the right column of the side by side diff view to see coverage information**: |
Yuke Liao | 8bc0085 | 2019-01-29 19:22:39 | [diff] [blame] | 17 | |
Yuke Liao | 0e5a20e | 2019-06-17 19:52:57 | [diff] [blame] | 18 | ![code_coverage_annotations] |
| 19 | |
| 20 | The code coverage tool currently **supports C/C++ code for Chrome on Linux**; |
| 21 | support for more platforms and more languages is in progress. |
| 22 | |
| 23 | The code coverage trybot has been **rolled out to a 10% experiment**, and once |
| 24 | we're more comfortable in its stability, we plan to enable it by default and |
| 25 | expand it to more platforms. |
Yuke Liao | 8bc0085 | 2019-01-29 19:22:39 | [diff] [blame] | 26 | |
| 27 | ## Contacts |
| 28 | |
| 29 | ### Reporting problems |
| 30 | For any breakage report and feature requests, please [file a bug]. |
| 31 | |
| 32 | ### Mailing list |
| 33 | For questions and general discussions, please join [code-coverage group]. |
| 34 | |
| 35 | ## FAQ |
Yuke Liao | 8bc0085 | 2019-01-29 19:22:39 | [diff] [blame] | 36 | ### Why is coverage not shown even though the try job finished successfully? |
| 37 | |
| 38 | There are several possible reasons: |
Yuke Liao | 8bc0085 | 2019-01-29 19:22:39 | [diff] [blame] | 39 | * A particular source file/test may not be available on a particular project or |
| 40 | platform. As of now, only `chromium/src` project and `Linux` platform is |
| 41 | supported. |
| 42 | * There is a bug in the pipeline. Please [file a bug] to report the breakage. |
| 43 | |
| 44 | ### How does it work? |
| 45 | |
| 46 | Please refer to [code_coverage.md] for how code coverage works in Chromium in |
| 47 | general, and specifically, for per-CL coverage in Gerrit, the |
| 48 | [clang_code_coverage_wrapper] is used to compile and instrument ONLY the source |
Yuke Liao | 0e5a20e | 2019-06-17 19:52:57 | [diff] [blame] | 49 | files that are affected by the CL for the sake of performance and a |
| 50 | [chromium-coverage Gerrit plugin] is used to display code coverage information |
| 51 | in Gerrit. |
Yuke Liao | 8bc0085 | 2019-01-29 19:22:39 | [diff] [blame] | 52 | |
| 53 | |
| 54 | [choose_tryjobs]: images/code_coverage_choose_tryjobs.png |
| 55 | [linux_coverage_rel]: images/code_coverage_linux_coverage_rel.png |
Yuke Liao | 0e5a20e | 2019-06-17 19:52:57 | [diff] [blame] | 56 | [code_coverage_annotations]: images/code_coverage_annotations.png |
Yuke Liao | 03c64407 | 2019-07-30 18:33:40 | [diff] [blame^] | 57 | [file a bug]: https://bugs.chromium.org/p/chromium/issues/entry?components=Infra%3ETest%3ECodeCoverage |
Yuke Liao | 8bc0085 | 2019-01-29 19:22:39 | [diff] [blame] | 58 | [code-coverage group]: https://groups.google.com/a/chromium.org/forum/#!forum/code-coverage |
| 59 | [code_coverage.md]: code_coverage.md |
| 60 | [clang_code_coverage_wrapper]: clang_code_coverage_wrapper.md |
| 61 | [chromium-coverage Gerrit plugin]: https://chromium.googlesource.com/infra/gerrit-plugins/code-coverage/ |