Trying to run simd-json.rs tests with tarpaulin fails with the error: Failed to compile tests! Error: mismatched types
The tests run otherwise fine, adding --verbose doesn't give any additional information :(
โฏ cargo tarpaulin --verbose
[INFO tarpaulin] Creating config
[INFO tarpaulin] Running Tarpaulin
[INFO tarpaulin] Building project
Compiling simd-json v0.3.16 (/home/heinz/Projects/simd-lite/simd-json)
error: could not compile `simd-json`.
To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
[ERROR tarpaulin] Failed to compile tests! Error: mismatched types
Error: "Failed to compile tests! Error: mismatched types"
--debug might give more information as it also puts cargo on max verbosity, I can have a proper look when I finish work today
Thanks! --debug gives a bit more output :) managed to dig into it and find the issue. the .cargo/config seems to get ignored when run with cargo tarpaulin that lead to simd-json.rs erroring (it enforces AVX2 support).
I am fine with closing this as it's resolved OTOH it might be wroth to document that behaviour, or warn if a .cargo/config is detected?
I'm not sure why it would get ignored given I call off to cargo, maybe the RUSTFLAGS I set? Either way I'd like to try and get tarpaulin to play nicely with .cargo/config, but yeah failing that documentation and a warning will be done :+1:
That might be, the .cargo/config for simd-json.rs sets RUSTFLAGS to use native cpu support :) that would explain it. Interestingly setting RUSTFLAGS in the env works
I've changed the title of this issue, and I'll put some description here for what I plan on being the solution.
So using the documentation here https://doc.rust-lang.org/cargo/reference/config.html merge the rustflags so they'd be the same as if you ran cargo test plus tarpaulins options. This means:
config and config.toml named filesAll the code should be fine in the src/cargo.rs file, around the bottom there's some existing code to work out the rust flags which is what needs to be changed.
Most helpful comment
I've changed the title of this issue, and I'll put some description here for what I plan on being the solution.
So using the documentation here https://doc.rust-lang.org/cargo/reference/config.html merge the rustflags so they'd be the same as if you ran
cargo testplus tarpaulins options. This means:configandconfig.tomlnamed filesAll the code should be fine in the
src/cargo.rsfile, around the bottom there's some existing code to work out the rust flags which is what needs to be changed.