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

code coverage is broken - details of the error #6857

Open
sylvestre opened this issue Nov 16, 2024 · 2 comments
Open

code coverage is broken - details of the error #6857

sylvestre opened this issue Nov 16, 2024 · 2 comments

Comments

@sylvestre
Copy link
Contributor

sylvestre commented Nov 16, 2024

I am going to collect some finding of my work (@cakebaker probably has other).

  • -Zprofile has been removed from rustc - Remove support for -Zprofile (gcov-style coverage instrumentation) rust-lang/rust#131829
    we should use -Cinstrument-coverage instead

  • we have to switch to a different method described here readme: example uses -Zprofile which has been removed from Rust nightly mozilla/grcov#1240 (cc @marco-c)

  • we need to pass LLVM_PROFILE_FILE as a new env variable, which wasn't passed to some commands by ucmd()
    i fixed it in 0cd58c6
    it was leaving some coverage artifacts in the pwd which was breaking some tests like ls.
    LLVM_PROFILE_FILE: "${{ github.workspace }}/build/coverage-%p-%m.profraw"

  • because of the change of format, files have to be exported into a different directory to make sure they don't pollute the tests

  • the coverage files are HUGE
    56G /Users/runner/work/coreutils/coreutils/build/ on a mac
    it causes the linux machine to fails with
    System.IO.IOException: No space left on device : '/home/runner/runners/2.320.0/_diag/Worker_20241116-105056-utc.log'
    and doesn't show anything in the log

  • it takes 16 minutes for grcov to process everything - it was a few seconds before

  • During one of my numerous experiment, i got <LLVM Profile Warning: Unable to track new values: Running out of static counters. Consider using option -mllvm -vp-counters-per-site=<n> to allocate more value profile counters at compile time. despite passing -Clink-arg=-Wl,-mllvm -Clink-arg=-Wl,-vp-counters-per-site=6, still happened.

  • Using cargo llvm-cov show-env like in https://github.com/foundationdb-rs/foundationdb-rs/blob/c6623a84a7f35597eb7f68357a3c9cb91831501e/.github/workflows/coverage.yml fails the same way

My experimentations: #6850

@chadbrewbaker
Copy link
Contributor

I was able to get reports (with branch coverage) by installing the https://github.com/taiki-e/cargo-llvm-cov tool. Should I add this to the developer docs?

cargo llvm-cov --html -p uu_sort
cargo llvm-cov --html run factor -- 1234567 

@sylvestre
Copy link
Contributor Author

Oh, excellent news. Yes, it would be great :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants