]> git.lizzy.rs Git - rust.git/commitdiff
create the required directories while gathering tests rather than during
authorNiko Matsakis <niko@alum.mit.edu>
Thu, 25 Feb 2016 17:52:39 +0000 (12:52 -0500)
committerNiko Matsakis <niko@alum.mit.edu>
Thu, 25 Feb 2016 19:40:26 +0000 (14:40 -0500)
parallel execution

src/compiletest/compiletest.rs

index d57ffe1533c0cb70e339200b35b206b7733ecafa..bbace16f05928a5d0fb10c873d90dddeb7e02c5d 100644 (file)
@@ -299,6 +299,15 @@ fn collect_tests_from_dir(config: &Config,
         let file_path = file.path();
         debug!("inspecting file {:?}", file_path.display());
         if is_test(config, &file_path) {
+            // If we find a test foo/bar.rs, we have to build the
+            // output directory `$build/foo` so we can write
+            // `$build/foo/bar` into it. We do this *now* in this
+            // sequential loop because otherwise, if we do it in the
+            // tests themselves, they race for the privilege of
+            // creating the directories and sometimes fail randomly.
+            let build_dir = config.build_base.join(&relative_dir_path);
+            fs::create_dir_all(&build_dir).unwrap();
+
             let paths = TestPaths {
                 file: file_path,
                 base: base.to_path_buf(),