Closed
Description
Consider the following minimal project:
Cargo.toml
[package]
name = "tarpotest"
version = "0.1.0"
authors = ["Me <me@me.me>"]
edition = "2018"
[dependencies]
futures-executor = "0.2.1"
src/lib.rs
#[test]
pub fn a() {
futures_executor::ThreadPool::new();
}
#[test]
pub fn b() {
futures_executor::ThreadPool::new();
}
Install tarpaulin from crates.io:
RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo install cargo-tarpaulin
And run it on this small project using either stable (rustc 1.32.0 (9fda7c223 2019-01-16)
) or beta (rustc 1.33.0-beta.5 (1045131c1 2019-01-31)
) rustc:
cargo +stable tarpaulin
: works as expectedcargo +beta tarpaulin
: occasionally, (in roughly 15% of the runs), tarpaulin errors as the test executable segfaulted
Error: Failed to run tests! Error: A segfault occurred while executing tests
I have no idea what is at fault here, but apparently something in the last beta of rustc was changed which broke the way tarpaulin does its instrumentation. For more details, the segfault appears to only occur if at least 2 tests in the same binary involve spawning threads, and seem to be more likely the more threads are spawned.
See xd009642/tarpaulin#190 for full details.