Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] A pre-installed cargo-llvm-cov does not work as expected #392

Open
niebayes opened this issue Oct 23, 2024 · 2 comments
Open

[Bug] A pre-installed cargo-llvm-cov does not work as expected #392

niebayes opened this issue Oct 23, 2024 · 2 comments
Labels
S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress.

Comments

@niebayes
Copy link

niebayes commented Oct 23, 2024

Situation 1:
We embed cargo-llvm-cov into a docker image and use it as the base image for running CI. However, only invoked with cargo llvm-cov, the coverage is correct. If we instead build the binary with cargo build ... and then perform testing with ./target/debug/<binary> ..., the coverage is not correct, specifically almost all lines are missed. Note, we have checked the README and properly set the environment variables with source <(cargo llvm-cov show-env --export-prefix).

Situation 2:
We also use a docker image as the base image for running CI, however, with cargo-llvm-cov not pre-installed. Instead, each CI job installs cargo-llvm-cov on its own. This time, astonishingly, the generated coverage is correct even if some tests are not invoked with cargo llvm-cov.

Additional context:

  • Many profraw files are indeed generated in situation 1.
  • We embed cargo-llvm-cov into the docker image by installing it with cargo install cargo-llvm-cov and by installing llvm-tools-preview with rustup component add llvm-tools-preview.
@taiki-e
Copy link
Owner

taiki-e commented Oct 23, 2024

Hmm, I have a feeling it is something related to the propagation of environment variables, but it doesn't seem to be an obvious problem that I can figure out just by reading the description. Could you provide a reproduction? As always, it is difficult to investigate an issue unless I can reproduce it on my end.

@taiki-e taiki-e added the S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. label Oct 23, 2024
@niebayes
Copy link
Author

@taiki-e Very appreciate for your reply! Since our project is commercial and not open-sourced, I cannot provide a direct reproduction. However, I think I could make a toy project while enough for reproduction. I will come back when the toy project is ready and I can reproduce the issue with the toy project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress.
Projects
None yet
Development

No branches or pull requests

2 participants