Tarpaulin: Tarpaulin fails when binaries have required features

Created on 12 Nov 2017  路  9Comments  路  Source: xd009642/tarpaulin

In many libraries, binaries are included to allow additional testing or benchmarking of the library. However, since these binaries introduce extra dependencies, those dependencies are often hidden under a feature, and the feature is set as required for the binary using required-featues. This is, for example, the case in faktory-rs.

Unfortunately, these required dependencies seem to confuse tarpaulin:

$ cd faktory-rs
$ git checkout e78e7627858d60dd613b46f61ae6baf31ea0145a
$ cargo tarpaulin
Error during run
$ cargo tarpaulin -v
Running Tarpaulin
Cleaning project
Error: failed to compile: target `loadtest` requires the features: `binaries`
Consider enabling them by passing e.g. `--features="binaries"`
Error during run

The first error is pretty unhelpful, but with -v it's clear that tarpaulin is trying to compile the binary without including the required feature flag, which obviously doesn't work. There also doesn't seem to be a command-line flag I can use to have it not compile the binary. I could make it always use the feature (which I did as a workaround in jonhoo/faktory-rs@37b9d8904a4c6f203e88bcb1103ebaf625ec4871), but that's still not ideal.

bug

Most helpful comment

I'll have a look into this and will let you know if I have any questions or when I make some progress :+1:

All 9 comments

I'll have a look into this and will let you know if I have any questions or when I make some progress :+1:

For that particular crate, tarpaulin also seems to cause some tests to time out. It seems to be related to the fact that these tests sleep for a while: https://travis-ci.org/jonhoo/faktory-rs/jobs/301014855#L811

That might be due to tarpaulin stealing the signals as it relies on ptrace. If the signal isn't one I expect the --forward option may solve the issue

@xd009642 hmm, no, --forward didn't seem to help :/

Sorted the initial issue you reported and once the CI passes I'll release a patch so you can make use of it. Regarding the sleep issue if you want to open a new issue just cause it might be trickier so I'd prefer it in it's own issue :smile:

Also noticed in your .travis.yml you set link dead code in RUSTFLAGS in your travis environment, if you're doing that for code coverage reasons there's no need tarpaulin sorts that out. But if you're doing it for other parts of your CI runs ignore me

I'll try 0.5.5 once you push it out (CI passed btw), and then open an issue for the sleep issue.

Hmm, 0.5.5 seems to solve the problem for me somehow:
https://travis-ci.org/jonhoo/faktory-rs/jobs/302178003#L776

My guess is that tarpaulin was trying to execute the binary, which then hangs because no server it could run against was available. Or something...

Well that explains why I couldn't recreate it. I'm going to put it down to me subtly misusing a cargo API previously or some nuance of rustc-test which is normally hidden. Glad it works :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xd009642 picture xd009642  路  9Comments

breeswish picture breeswish  路  4Comments

paulvt picture paulvt  路  5Comments

JP-Ellis picture JP-Ellis  路  9Comments

breeswish picture breeswish  路  3Comments