mozilla / mozilla/grcov

uncover reports on `#[cfg_attr]`

Open
#1,012 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.4k
Forks
170
Avg merge
3d 10h
Merged PRs (30d)
4

Description

We are measuring coverage using grcov.

We provide tracing as an optional feature, so we use #[cfg_attr(feature="trace", instrument)] to instrument when the trace feature is enabled.

When we collect coverage information using grcov, the cfg_attr line is reported as unexecuted lines.

Similarly, specifying traced_test for trace using #[cfg_attr(feature = "trace", traced_test)] is also reported as unexecuted.

We want to avoid reporting attribute settings as unexecuted.

Here are the test environment and compile options:

Environment:

kazuk@kazuk-ryzen5800x:~/parse-it$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/kazuk/.rustup

installed toolchains
--------------------

stable-aarch64-unknown-linux-gnu
stable-x86_64-unknown-linux-gnu (default)
nightly-x86_64-unknown-linux-gnu

installed targets for active toolchain
--------------------------------------

aarch64-unknown-linux-gnu
aarch64-unknown-linux-musl
wasm32-unknown-unknown
x86_64-unknown-linux-gnu

active toolchain
----------------

stable-x86_64-unknown-linux-gnu (default)
rustc 1.68.2 (9eb3afe9e 2023-03-27)

kazuk@kazuk-ryzen5800x:~/parse-it$ grcov --version
grcov 0.8.16

Compiler options:

  "RUSTFLAGS"= "-Cinstrument-coverage -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off"

grcov options:

grcov ${COVERAGE_PROF_OUTPUT} \
  -b ${COVERAGE_BINARIES} -s ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY} \
  -t lcov --llvm --branch --ignore-not-existing --ignore "/*" -o ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/lcov.info

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the report with grcov 0.8.16, Rust 1.68.2, the shown RUSTFLAGS, and a minimal #[cfg_attr] example. Inspect how grcov processes LLVM coverage and source lines; done means lcov output no longer marks cfg_attr attribute lines as unexecuted, including the instrument and traced_test cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.