tarpaulin icon indicating copy to clipboard operation
tarpaulin copied to clipboard

Failed to get test coverage! Error: missing section: CoverageFunctions

Open robatipoor opened this issue 1 year ago • 1 comments

Cargo tarpaulin failed during the execution of the "check coverage" command line tests. You can review the error details in the GitHub Actions link below:

GitHub Actions - Test Coverage Job

The Cargo tarpaulin configuration can be found at the following link:

Cargo Tarpaulin Configuration

For your reference, an example of the command line test is available here:

Command Line Test Example

Thank you for your attention.

robatipoor avatar Jan 29 '24 10:01 robatipoor

I got this too in Sargon: https://github.com/radixdlt/sargon Never had an issue until some days ago, hmm...

Sajjon avatar Feb 17 '24 13:02 Sajjon

So this may have been fixed in the latest release, can you confirm if it's still an issue or not?

xd009642 avatar Apr 27 '24 09:04 xd009642

After cleaning the GitHub Action caches and rerunning the pipeline, I received the same error message: "Error: missing section: CoverageFunctions."

robatipoor avatar Apr 28 '24 06:04 robatipoor

Okay I've realised what the issue is (particularly for pf but sargon is likely the same thing). In pf pf-api and pf-cli are built separately and lack the llvm coverage instrumentation. I'm going to look into how they're built for the tests as maybe tarpaulin should be propagation some rustflags etc in a way that could solve this

xd009642 avatar Apr 28 '24 12:04 xd009642

Okay I have a PR, you can install it and try it out like:

cargo install cargo-tarpaulin --git https://github.com/xd009642/tarpaulin --branch fix/missing-coverage-functions

I've tested it on pf and it works as expected (and now we also get coverage for the spawned CLI app!) I'll run it through a few more tests probably tomorrow and make sure it doesn't break anything existing.

xd009642 avatar Apr 28 '24 14:04 xd009642

Yes, the problem is solved. Thank you.

robatipoor avatar Apr 28 '24 17:04 robatipoor

Nice merged in, this'll be in the next release (should be later this week just looking at one other issue beforehand)

xd009642 avatar Apr 29 '24 08:04 xd009642