From 16acfd38c39110fa4bcb48326829387c22ed2a23 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Tue, 28 Aug 2018 17:06:51 -0700 Subject: [PATCH] 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. --- tests/all/main.rs | 2 ++ tests/all/utils/fixture.rs | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/all/main.rs b/tests/all/main.rs index 57f8885..b4480b4 100644 --- a/tests/all/main.rs +++ b/tests/all/main.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; diff --git a/tests/all/utils/fixture.rs b/tests/all/utils/fixture.rs index e40b9c1..3122936 100644 --- a/tests/all/utils/fixture.rs +++ b/tests/all/utils/fixture.rs @@ -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 } }