blob: a9b7f7f0c6a249cb689fb2067906237594eb1162 [file] [log] [blame] [view]
Yuke Liao8bc00852019-01-29 19:22:391# Code Coverage in Gerrit
2
Yuke Liao0e5a20e2019-06-17 19:52:573Tests are critical because they find bugs and regressions, enforce better
4designs and make code easier to maintain. **Code coverage helps you ensure your
5tests are thorough**.
Yuke Liao8bc00852019-01-29 19:22:396
Yuke Liao0e5a20e2019-06-17 19:52:577Chromium CLs can show a line-by-line breakdown of test coverage. **You can use
8the code coverage trybot to ensure you only submit well-tested code**.
9
10To see code coverage for a Chromium CL, trigger the code coverage trybot
11**linux-coverage-rel**:
Yuke Liao8bc00852019-01-29 19:22:3912
13![choose_tryjobs] ![linux_coverage_rel]
14
Yuke Liao0e5a20e2019-06-17 19:52:5715Once the build finishes and code coverage data is processed successfully, **look
16at the right column of the side by side diff view to see coverage information**:
Yuke Liao8bc00852019-01-29 19:22:3917
Yuke Liao0e5a20e2019-06-17 19:52:5718![code_coverage_annotations]
19
20The code coverage tool currently **supports C/C++ code for Chrome on Linux**;
21support for more platforms and more languages is in progress.
22
23The code coverage trybot has been **rolled out to a 10% experiment**, and once
24we're more comfortable in its stability, we plan to enable it by default and
25expand it to more platforms.
Yuke Liao8bc00852019-01-29 19:22:3926
27## Contacts
28
29### Reporting problems
30For any breakage report and feature requests, please [file a bug].
31
32### Mailing list
33For questions and general discussions, please join [code-coverage group].
34
35## FAQ
Yuke Liao8bc00852019-01-29 19:22:3936### Why is coverage not shown even though the try job finished successfully?
37
38There are several possible reasons:
Yuke Liao8bc00852019-01-29 19:22:3939* A particular source file/test may not be available on a particular project or
40platform. As of now, only `chromium/src` project and `Linux` platform is
41supported.
42* There is a bug in the pipeline. Please [file a bug] to report the breakage.
43
44### How does it work?
45
46Please refer to [code_coverage.md] for how code coverage works in Chromium in
47general, and specifically, for per-CL coverage in Gerrit, the
48[clang_code_coverage_wrapper] is used to compile and instrument ONLY the source
Yuke Liao0e5a20e2019-06-17 19:52:5749files 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
51in Gerrit.
Yuke Liao8bc00852019-01-29 19:22:3952
53
54[choose_tryjobs]: images/code_coverage_choose_tryjobs.png
55[linux_coverage_rel]: images/code_coverage_linux_coverage_rel.png
Yuke Liao0e5a20e2019-06-17 19:52:5756[code_coverage_annotations]: images/code_coverage_annotations.png
Yuke Liao03c644072019-07-30 18:33:4057[file a bug]: https://bugs.chromium.org/p/chromium/issues/entry?components=Infra%3ETest%3ECodeCoverage
Yuke Liao8bc00852019-01-29 19:22:3958[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/