tests: Only invoke `copy_dir` once at a time

I don't understand why at all, but doing many `copy_dir`s at once makes my whole
machine freeze up.
master
Nick Fitzgerald 7 years ago
parent d5bf5a3ecd
commit 16acfd38c3
  1. 2
      tests/all/main.rs
  2. 15
      tests/all/utils/fixture.rs

@ -6,6 +6,8 @@ extern crate serde_json;
extern crate structopt;
extern crate tempfile;
extern crate wasm_pack;
#[macro_use]
extern crate lazy_static;
mod build;
mod manifest;

@ -28,6 +28,19 @@ where
fixture.display(),
path.display()
);
copy_dir(fixture, &path).expect("should copy fixture directory into temporary directory OK");
{
// Copying too many things in parallel totally kills my machine(??!!?!),
// so make sure we are only doing one `copy_dir` at a time...
use std::sync::Mutex;
lazy_static! {
static ref ONE_AT_A_TIME: Mutex<()> = Mutex::new(());
}
let _locked = ONE_AT_A_TIME.lock();
copy_dir(fixture, &path)
.expect("should copy fixture directory into temporary directory OK");
}
Fixture { dir, path }
}

Loading…
Cancel
Save