-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcov.ps1
22 lines (16 loc) · 888 Bytes
/
cov.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
& cargo clean
# install nightly with:
# > rustup toolchain install nightly
& rustup default nightly
$env:CARGO_INCREMENTAL="0"
# local coverage report uses profile; the -Cinstrument-coverage currently fails on Win11 with access violations
$env:RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off"
& cargo build
& cargo test --no-fail-fast --all-targets
$COVERAGE_REPORT_DIR="target/debug"
& grcov . --output-type html --output-path "$COVERAGE_REPORT_DIR" --branch --ignore build.rs --ignore '/*' --ignore '[a-zA-Z]:/*' --ignore '**/tests/' --excl-start '#(\[cfg\(test\)\]|\[test\])' --excl-br-line '^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()'
Remove-Item Env:\RUSTFLAGS
Remove-Item Env:\CARGO_INCREMENTAL
& rustup default stable
Write-Host "report: $COVERAGE_REPORT_DIR/html/index.html"
Start-Process "$COVERAGE_REPORT_DIR/html/index.html"