diff options
author | Jean-Philippe DUFRAIGNE <j.dufraigne@gmail.com> | 2016-10-29 20:36:19 +0100 |
---|---|---|
committer | Jean-Philippe DUFRAIGNE <j.dufraigne@gmail.com> | 2016-10-29 20:36:19 +0100 |
commit | c82cb6d9df1ff44ab05b18a062f849a9026bb4ec (patch) | |
tree | b9b2080c3fcf93d86c2147c2806c77f4aa015a30 | |
parent | f7b5fae91b212345bc8ce462cc700f4619e2a708 (diff) |
Run test in serial to not take all memory
When running all the test in parallel, all the memory on my laptop
is consumed by rustc processes, my machine become unusable and the
tests do not make progress.
It seems to make sense to have serial by default, as the number of
process depends on the number of test files.
-rw-r--r-- | tests/tests.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/tests/tests.rs b/tests/tests.rs index 66e70859..1f8864e0 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -85,16 +85,15 @@ fn run_bindgen_tests() { } }); - // First spawn all child processes and collect them, then wait on each - // one. This runs the tests in parallel rather than serially. + // Spawn one child at a time and wait on it as number of process + // is the number of test files. - let children: Vec<_> = tests.map(|entry| { - let child = spawn_run_bindgen(run_bindgen.clone(), bindgen.clone(), entry.path()); - (entry.path(), child) - }) - .collect(); + let children = tests.map(|entry| { + let child = spawn_run_bindgen(run_bindgen.clone(), bindgen.clone(), entry.path()); + (entry.path(), child) + }); - let failures: Vec<_> = children.into_iter() + let failures: Vec<_> = children .filter_map(|(path, mut child)| { let passed = child.wait() .expect("Should wait on child process") |