Skip to content

Commit c8cc8e6

Browse files
committed
Try something
1 parent a7278f1 commit c8cc8e6

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.github/workflows/coverage.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ jobs:
3535
with:
3636
cache-targets: true # cache build artifacts
3737
cache-bin: true # cache the ~/.cargo/bin directory
38+
- name: Verify bin_tests contribution to coverage
39+
run: |
40+
cargo llvm-cov nextest --no-report --package bin_tests
41+
echo "=== Profraw files created ==="
42+
find target/llvm-cov-target -name "*.profraw" -ls
43+
cargo llvm-cov report --package bin_tests --summary-only
44+
cargo clean
3845
- name: Generate code coverage (including doc tests)
3946
run: |
4047
cargo llvm-cov --all-features --workspace --no-report nextest

bin_tests/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ fn inner_build_artifact(c: &ArtifactsBuild) -> anyhow::Result<PathBuf> {
6666
build_cmd.env("RUSTFLAGS", rustflags);
6767
}
6868

69+
// Pass CARGO_TARGET_DIR to ensure we build in the same target directory
70+
// that cargo-llvm-cov is using (e.g., target/llvm-cov-target/)
71+
// Without this, cargo build would use target/debug/ and miss instrumentation
72+
if let Ok(target_dir) = env::var("CARGO_TARGET_DIR") {
73+
build_cmd.env("CARGO_TARGET_DIR", target_dir);
74+
}
75+
6976
let output = build_cmd.output().unwrap();
7077
if !output.status.success() {
7178
anyhow::bail!(

0 commit comments

Comments
 (0)