taiki-e / cargo-llvm-cov

Cargo subcommand to easily use LLVM source-based code coverage (-C instrument-coverage).
Apache License 2.0
858 stars 57 forks source link

`--target` + `nextest-archive` cause llvm-cov to not find files #334

Closed cwfitzgerald closed 5 months ago

cwfitzgerald commented 5 months ago

When I use --target when building the initial archive, trying to run the archive cause llvm-cov to not find the files generated.

Generation command

cargo llvm-cov nextest-archive --all-features  --target aarch64-apple-darwin --archive-file tests.tar.zst

Error

$ cargo llvm-cov nextest --archive-file tests.tar.zst --extract-overwrite --no-fail-fast

<snip> test output </snip>

warning: not found object files (searched directories: /Users/cwfitzgerald/programming/wgpu/target/llvm-cov-target/target/debug); this may occur if show-env subcommand is used incorrectly (see docs or other warnings), or unsupported commands such as nextest archive are used
No filenames specified!
error: failed to generate report: process didn't exit successfully: `/Users/cwfitzgerald/.rustup/toolchains/1.71-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/bin/llvm-cov report -instr-profile=/Users/cwfitzgerald/programming/wgpu/target/llvm-cov-target/wgpu.profdata -ignore-filename-regex '/rustc/([0-9a-f]+|[0-9]+\.[0-9]+\.[0-9]+)/|^/Users/cwfitzgerald/programming/wgpu(/.*)?/(tests|examples|benches)/|^/Users/cwfitzgerald/programming/wgpu/target/llvm\-cov\-target($|/)|^/Users/cwfitzgerald/\.cargo/(registry|git)/|^/Users/cwfitzgerald/\.rustup/toolchains($|/)'` (exit status: 1)

The same problem happens with --no-report on the command, then calling cargo llvm-cov report --lcov --output-path lcov.info

I tried adding --target to the nextest call, but nextest doesn't except that argument with an archive file. Using --no-report and specifying the target when generating the report also doesn't work.

Motivation

Cross compiling from an x86 mac to generate archives used on an ARM mac. See https://github.com/gfx-rs/wgpu/pull/5056

As always, I can PR things if you point me in the right direction.

taiki-e commented 5 months ago

This and #333 have been fixed in 0.6.1. Thanks for reporting these issues @cwfitzgerald!

(This case is now tested in CI)

https://github.com/taiki-e/cargo-llvm-cov/blob/bab773225daf2763eeeed6399f87a651a65f825d/.github/workflows/ci.yml#L90-L92

cwfitzgerald commented 5 months ago

Amazing! Thanks for the super fast response and release!