diff options
author | Jeremy Bettis <jbettis@google.com> | 2022-02-24 14:09:26 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-02-26 01:23:50 +0000 |
commit | 8bb4a0bc78d02c88f90236c4f5ebb9ee2485af62 (patch) | |
tree | 5ef76291ec17e4da8d4b1fe03ed8a0ab2e1abba6 | |
parent | fdff2da9817e6bc319e0efeaa6ae58ff18ecd546 (diff) | |
download | chrome-ec-8bb4a0bc78d02c88f90236c4f5ebb9ee2485af62.tar.gz |
zmake: document how to generate coverage report
Add instructions for running zmake unit tests outside the chroot and
generating coverage data.
BRANCH=None
BUG=b:219062927
TEST=Ran the commands
Signed-off-by: Jeremy Bettis <jbettis@google.com>
Change-Id: Ib1e9a2ddba95d64c2a20973be444edff0e22c30a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3491404
Tested-by: Jeremy Bettis <jbettis@chromium.org>
Auto-Submit: Jeremy Bettis <jbettis@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | zephyr/README.md | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore index aacb38ac3a..db195ffc98 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ cscope.* __pycache__ *.egg-info .hypothesis/ +zephyr/zmake/.coverage # Clangd language server .cache/clangd/index/* diff --git a/zephyr/README.md b/zephyr/README.md index 07645fa177..e23aa15a82 100644 --- a/zephyr/README.md +++ b/zephyr/README.md @@ -59,3 +59,17 @@ report, but not in the chroot, as some pip modules are missing there. The [latest coverage report](https://gitlab.com/zephyr-ec/ec/-/jobs/artifacts/main/file/zephyr/zmake/htmlcov/index.html?job=zmake_coverage ) is on gitlab. + +You can run the coverage report outside of the chroot easily: + +``` +# Install test dependencies +cd ~/chromiumos/src/platform/ec +python3 -m pip install 'zephyr/zmake[tests]' --user +# Run tests with coverage +cd ~/chromiumos/src/platform/ec/zephyr/zmake +coverage run --source=zmake -m pytest . +coverage report +coverage html +xdg-open htmlcov/index.html +``` |