From 59dedd2d93268a2729b994cc3134b9090b683d22 Mon Sep 17 00:00:00 2001 From: Jeremy Bettis Date: Wed, 27 Jul 2022 11:12:49 -0600 Subject: ec: Add instructions for CQ to code cov doc Add instructions on how to view code coverage without running the tests locally. BRANCH=None BUG=None TEST=None Signed-off-by: Jeremy Bettis Change-Id: I03c82213949aa7916b8c12e6728a9869cd21d184 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3789920 Auto-Submit: Jeremy Bettis Reviewed-by: Yuval Peress Commit-Queue: Yuval Peress Tested-by: Jeremy Bettis --- docs/code_coverage.md | 64 ++++++++++++++++++++++++++++++++++ docs/images/artifacts.png | Bin 0 -> 52896 bytes docs/images/dir_coverage.png | Bin 0 -> 98944 bytes docs/images/download_html.png | Bin 0 -> 51538 bytes docs/images/file_coverage.png | Bin 0 -> 159927 bytes docs/images/gerrit_coverage_links.png | Bin 0 -> 146042 bytes docs/images/postsubmit.png | Bin 0 -> 103906 bytes docs/images/test_firmware.png | Bin 0 -> 43721 bytes 8 files changed, 64 insertions(+) create mode 100644 docs/images/artifacts.png create mode 100644 docs/images/dir_coverage.png create mode 100644 docs/images/download_html.png create mode 100644 docs/images/file_coverage.png create mode 100644 docs/images/gerrit_coverage_links.png create mode 100644 docs/images/postsubmit.png create mode 100644 docs/images/test_firmware.png (limited to 'docs') diff --git a/docs/code_coverage.md b/docs/code_coverage.md index a15c61b358..c5fdd9e0ad 100644 --- a/docs/code_coverage.md +++ b/docs/code_coverage.md @@ -63,3 +63,67 @@ For coverage report for a single test you can run: Example: `zmake test --coverage test-drivers` `genhtml -q -o build/zephyr/test-drivers/output/coverage_rpt/ build/zephyr/test-drivers/output/zephyr.info` + +## Code Coverage in CQ + +There are several ways to see the code coverage without running the tests +locally, depending on what information you want to see. Many of the links +below are only available to Googlers or TVCs with google.com accounts. + +### Code search + +To see the coverage of each directory, visit +http://cs/chromeos_public/src/platform/ec/ and turn on the "Directory Coverage" +layer. The denominator for the percentage covered is not clear, so these +numbers are really only useful if you are looking in very general terms. I.e. +zephyr is covered better than common. Don't get too fixated on the specific +percent shown. The results are also the last 7 days of builds combined, so there +may be some odd results if the code has changed greatly in the last week. + +![Directory coverage screenshot](images/dir_coverage.png) + +The coverage of files is much more useful. If you are about to write a test +and not sure what to focus on, you can look at the uncovered lines in code +search. Visit [a file](http://cs/chromeos_public/src/platform/ec/common/mkbp_event.c) +in code search and make sure the "File Coverage" layer is enabled. Lines that +are not covered by any test are in red, tested lines are in green, and uncolored +lines were not built at all in any board or test. + +![File coverage screenshot](images/file_coverage.png) + +### Presubmit + +Every gerrit cl, if you did a dry-run or full run of the CQ will have coverage +results. They are slightly difficult to get to, but are very useful. + +On the "Checks" tab, find the build "firmware-zephyr-cov-cq" and open it. + +![Gerrit screenshot](images/gerrit_coverage_links.png) + +On the LUCI page, expand the "test firmware" step and click on "response". That +will show you a very basic summary of the coverage. + +![LUCI screenshot test firmware](images/test_firmware.png) + +For a detailed report, you can download the coverage report. Expand "try to +upload artifacts", then "upload artifacts", and click on "gs upload dir". + +![LUCI screenshot artifacts](images/artifacts.png) + +From there, click on the download icon for the html.tbz2 file, and untar it +locally. Open lcov_rpt/index.html to view your results. + +![GCS screenshot](images/download_html.png) + +### Post-submit + +If you are interested in the state of the world, not a specific CL, and the +coverage info in Code Search is not sufficient, you can download the coverage +report from the post-submit CQ build. + +Visit https://ci.chromium.org/p/chromeos/builders/postsubmit/firmware-zephyr-cov-postsubmit +and click on the latest successful build. + +![LUCI post-submit screenshot](images/postsubmit.png) + +From there, it is exactly the same steps as above to get to the artifacts. diff --git a/docs/images/artifacts.png b/docs/images/artifacts.png new file mode 100644 index 0000000000..2981509362 Binary files /dev/null and b/docs/images/artifacts.png differ diff --git a/docs/images/dir_coverage.png b/docs/images/dir_coverage.png new file mode 100644 index 0000000000..152b2711a2 Binary files /dev/null and b/docs/images/dir_coverage.png differ diff --git a/docs/images/download_html.png b/docs/images/download_html.png new file mode 100644 index 0000000000..399d098936 Binary files /dev/null and b/docs/images/download_html.png differ diff --git a/docs/images/file_coverage.png b/docs/images/file_coverage.png new file mode 100644 index 0000000000..f110e44200 Binary files /dev/null and b/docs/images/file_coverage.png differ diff --git a/docs/images/gerrit_coverage_links.png b/docs/images/gerrit_coverage_links.png new file mode 100644 index 0000000000..43afac943e Binary files /dev/null and b/docs/images/gerrit_coverage_links.png differ diff --git a/docs/images/postsubmit.png b/docs/images/postsubmit.png new file mode 100644 index 0000000000..65c630276f Binary files /dev/null and b/docs/images/postsubmit.png differ diff --git a/docs/images/test_firmware.png b/docs/images/test_firmware.png new file mode 100644 index 0000000000..42f707810a Binary files /dev/null and b/docs/images/test_firmware.png differ -- cgit v1.2.1