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

Coverage of build.rs #374

Closed jayvdb closed 1 week ago

jayvdb commented 1 week ago

We have a code generator project invoked from a bunch of other project build.rs scripts, which are definitely getting invoked when the tests are run, but the code generator has 0% test coverage.

I assume this is because cargo-llvm-cov cant get into the build process of build.rs , and probably there is a bug upstream in the rust project about this.

taiki-e commented 1 week ago

Could you provide a reproduction?

As I said in several issues, it is always difficult to investigate an issue unless I can reproduce it on my end.

See also help messages:

--include-build-script
            Include build script in coverage report
--target <TRIPLE>
            Build for the target triple

            When this option is used, coverage for proc-macro and build script will not be displayed
            because cargo does not pass RUSTFLAGS to them.
jayvdb commented 1 week ago

Sorry I was not aware of --include-build-script . That did the trick. Sorry for the noise.