The Chromium Chronicle #18: Chromium Code Coverage
Episode 18: by Veenita Joshi and Prakhar Asthana in Mountain View, CA (February 2021)
Test coverage measures how much source code is executed when a particular test suite runs. Generating coverage data has three major steps: compiling with instrumentation, gathering data from running instrumented tests, and post-processing the data. The coverage team has tools to automate this process.
Here is a sample usage:
$ gn gen out/coverage \
$ python tools/code_coverage/coverage.py \
crypto_unittests url_unittests \
-b out/coverage -o out/report \
-c 'out/coverage/crypto_unittests' \
-c 'out/coverage/url_unittests --gtest_filter=URLParser.PathURL' \
-f url/ -f crypto/
This builds and runs the
url_unittests targets. For
url_unittests, it only runs the test
URLParser.PathURL. The coverage report is filtered to include only files and sub-directories under
crypto/. Aside from automating the process, this script provides additional features to view code coverage by directories and components.
The Code Coverage tool provides a code coverage breakdown by directory and component for the whole codebase, for Windows, iOS, Android, Linux and Chrome OS.
Share your feedback: Contact
code-coverage @ chromium.org or file a bug on crbug.com.
- See the code coverage for the whole codebase and a breakdown by directories and components.