mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 13:45:20 +00:00
docs: improve code coverage document
Fixes: #6507 This patch improves the code coverage use case for integration tests and unit tests. Signed-off-by: Songqian Li <sionli@tencent.com>
This commit is contained in:
parent
7e6326b3c5
commit
cc5e463ee3
@ -65,17 +65,17 @@ the data processing from within the container if you don't want to fight the
|
|||||||
tool chain.
|
tool chain.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# Get a shell
|
# Set env to enable code coverage
|
||||||
./scripts/dev_cli.sh shell
|
export RUSTFLAGS="-Cinstrument-coverage"
|
||||||
|
export LLVM_PROFILE_FILE="ch-%p-%m.profraw"
|
||||||
|
|
||||||
# Install llvm-tools-preview for llvm-profdata
|
# Run unit tests
|
||||||
rustup component add llvm-tools-preview
|
scripts/dev_cli.sh tests --unit --libc gnu
|
||||||
# Merge data files by using the following command
|
|
||||||
find . -name '*.profraw' -exec `rustc --print sysroot`/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata merge -sparse {} -o coverage.profdata \;
|
|
||||||
|
|
||||||
# As of writing, the container has Rust 1.67.1. It is too old for grcov.
|
# Run integration tests
|
||||||
rustup install stable
|
scripts/dev_cli.sh tests --integration --libc gnu
|
||||||
cargo +stable install grcov
|
scripts/dev_cli.sh tests --integration-live-migration --libc gnu
|
||||||
# Run grcov as usual
|
|
||||||
grcov . --binary-path ./target/x86_64-unknown-linux-gnu/release -s . -t html --branch --ignore-not-existing -o coverage-html-output/
|
# Export code coverage report
|
||||||
|
scripts/dev_cli.sh tests --coverage -- -- html
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user