xd009642 / tarpaulin

A code coverage tool for Rust projects
https://crates.io/crates/cargo-tarpaulin
Apache License 2.0
2.5k stars 180 forks source link

ERROR cargo_tarpaulin: Failed to compile tests! #905

Open gkorland opened 2 years ago

gkorland commented 2 years ago

Describe the bug Error while building:

Dec 19 12:50:49.869 ERROR cargo_tarpaulin: Failed to compile tests! Error: redis-module: cannot find value `ptr` in this scope

To Reproduce

> git clone git@github.com:RedisJSON/RedisJSON.git
> cd RedisJSON
> cargo tarpaulin

Expected behavior Successful build

gkorland commented 2 years ago

When trying to build

> git clone git@github.com:RedisLabsModules/redismodule-rs.git
> cd redismodule-rs
> cargo tarpaulin

Got the following error:

0 ERROR cargo_tarpaulin: Failed to compile tests! Error: bitvec: cannot find attribute `skip` in this scope
Error: "Failed to compile tests! Error: bitvec: cannot find attribute `skip` in this scope"
gkorland commented 2 years ago

ref https://github.com/xd009642/tarpaulin/issues/756

xd009642 commented 2 years ago

So for RedisJSON, I got the SIGILL instruction, so I checked the readme and did cargo tarpaulin --features test and it works. Maybe you're missing the feature?

Well when I cloned redismodule-rs fresh it's using nom 7 and bitvec isn't in the dependency tree, I'd recommend upgrading whatever package is bringing it in cargo tree -i bitvec, but I can't see what is doing it... In the meantime --avoid-cfg-tarpaulin is a flag to go back to the legacy tarpaulin attribute behaviour.

I then ran tarpaulin using cargo tarpaulin --features test,experimental-api as this matched the features tested under in CI, and it compiled and was running fine until this error which I imagine is just due to my system setup - I'm not sure if I have redis installed on this machine:


running 2 tests
test test_keys_pos ... FAILED
test test_hello ... FAILED

failures:

---- test_keys_pos stdout ----
Error: failed to start redis server

Is there any more information that could help me recreate this? Compiler versions, any configuration etc? From what I see currently it all seems to work as expected

gkorland commented 2 years ago

So for RedisJSON, I got the SIGILL instruction, so I checked the readme and did cargo tarpaulin --features test and it works. Maybe you're missing the feature?

I just ran it with cargo tarpaulin --features test and got the same error:

$ cargo tarpaulin --features test
...

...
   Compiling chrono v0.4.19
   Compiling rand v0.7.3
   Compiling env_logger v0.9.0
   Compiling strum_macros v0.23.1
   Compiling redis-module v0.25.0
error: Broken pipe (os error 32)
warning: build failed, waiting for other jobs to finish...
error: Broken pipe (os error 32)
error: build failed
Dec 19 14:39:13.835 ERROR cargo_tarpaulin: Failed to compile tests! Error: redis-module: cannot find value `ptr` in this scope
Error: "Failed to compile tests! Error: redis-module: cannot find value `ptr` in this scope"

Running on:

xd009642 commented 2 years ago

Strange, I just tried it with tarpaulin 0.18.5, with rustc 1.57.0 on ubuntu 18.04 and it worked fine. Can you do a cargo clean before you run tarpaulin?

gkorland commented 2 years ago

cargo clean didn't help