Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit b7b71b3

Browse files
ryoqunsolana-grimes
authored andcommitted
Magically improve coverage (#6345)
automerge
1 parent 83c1831 commit b7b71b3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

ci/test-coverage.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ scripts/coverage.sh
2929
report=coverage-"${CI_COMMIT:0:9}".tar.gz
3030
mv target/cov/report.tar.gz "$report"
3131
upload-ci-artifact "$report"
32+
33+
gzip target/cov/coverage-stderr.log
34+
upload-ci-artifact target/cov/coverage-stderr.log.gz
35+
3236
annotate --style success --context lcov-report \
3337
"lcov report: <a href=\"artifact://$report\">$report</a>"
3438

scripts/coverage.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ reportName="lcov-${CI_COMMIT:0:9}"
1414

1515
if [[ -n $1 ]]; then
1616
crate="--package $1"
17+
shift
1718
else
1819
crate="--all --exclude solana-local-cluster"
1920
fi
2021

2122
coverageFlags=(-Zprofile) # Enable coverage
2223
coverageFlags+=("-Clink-dead-code") # Dead code should appear red in the report
23-
coverageFlags+=("-Ccodegen-units=1") # Disable ThinLTO which corrupts debuginfo (see [rustc issue #45511]).
24+
coverageFlags+=("-Ccodegen-units=1") # Disable code generation parallelism which is unsupported under -Zprofile (see [rustc issue #51705]).
2425
coverageFlags+=("-Cinline-threshold=0") # Disable inlining, which complicates control flow.
2526
coverageFlags+=("-Coverflow-checks=off") # Disable overflow checks, which create unnecessary branches.
2627

@@ -37,7 +38,9 @@ rm -rf target/cov/$reportName
3738

3839
source ci/rust-version.sh nightly
3940
# shellcheck disable=SC2086 #
40-
_ cargo +$rust_nightly test --target-dir target/cov --lib $crate
41+
RUST_LOG=solana=trace _ cargo +$rust_nightly test --target-dir target/cov --lib --no-run $crate "$@"
42+
# shellcheck disable=SC2086 #
43+
RUST_LOG=solana=trace _ cargo +$rust_nightly test --target-dir target/cov --lib $crate "$@" 2> target/cov/coverage-stderr.log
4144

4245
echo "--- grcov"
4346

0 commit comments

Comments
 (0)