use anyhow::{Result, ensure};
use elaborate::std::process::CommandContext;
use std::{process::Command, thread};
const N_ATTEMPTS: usize = 10;
#[test]
fn stress() {
for i_attempt in 0..N_ATTEMPTS {
dbg!(i_attempt);
let handles = [false, true].map(|nightly| {
thread::spawn(move || {
check(nightly).unwrap();
})
});
for handle in handles {
handle.join().unwrap();
}
}
}
fn check(nightly: bool) -> Result<()> {
let mut command = Command::new("cargo");
if nightly {
command.arg("+nightly");
}
command.args([
"check",
"-vv",
"--features=nested_workspace/__disable_offline_check",
]);
command.arg("--offline");
command.current_dir("example");
let status = command.status_wc().unwrap();
ensure!(status.success());
Ok(())
}