about summary refs log tree commit diff
path: root/src/tools/compiletest
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2019-05-02 05:06:08 +0300
committerEduard-Mihai Burtescu <edy.burt@gmail.com>2019-05-07 04:49:54 +0300
commitf0e43fc98671f76f7cdcc07cfa17fb2362c132ea (patch)
tree137dace7a1508fa8db1b8bccbaafef6f77cbebf3 /src/tools/compiletest
parent9a2ee0aaef1dfe835c65359b2b07721953ea7040 (diff)
downloadrust-f0e43fc98671f76f7cdcc07cfa17fb2362c132ea.tar.gz
rust-f0e43fc98671f76f7cdcc07cfa17fb2362c132ea.zip
compiletest: only use `make_exe_name` for tests that end up being executed.
Diffstat (limited to 'src/tools/compiletest')
-rw-r--r--src/tools/compiletest/src/runtest.rs26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 42f9cdb7886..649679e9b3c 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1422,10 +1422,21 @@ impl<'test> TestCx<'test> {
     }
 
     fn compile_test(&self) -> ProcRes {
-        let mut rustc = self.make_compile_args(
-            &self.testpaths.file,
-            TargetLocation::ThisFile(self.make_exe_name()),
-        );
+        // Only use `make_exe_name` when the test ends up being executed.
+        let will_execute = match self.config.mode {
+            RunPass | Ui => self.should_run_successfully(),
+            Incremental => self.revision.unwrap().starts_with("r"),
+            RunFail | RunPassValgrind | MirOpt |
+            DebugInfoBoth | DebugInfoGdb | DebugInfoLldb => true,
+            _ => false,
+        };
+        let output_file = if will_execute {
+            TargetLocation::ThisFile(self.make_exe_name())
+        } else {
+            TargetLocation::ThisDirectory(self.output_base_dir())
+        };
+
+        let mut rustc = self.make_compile_args(&self.testpaths.file, output_file);
 
         rustc.arg("-L").arg(&self.aux_output_dir_name());
 
@@ -1882,7 +1893,12 @@ impl<'test> TestCx<'test> {
                 rustc.arg("-o").arg(path);
             }
             TargetLocation::ThisDirectory(path) => {
-                rustc.arg("--out-dir").arg(path);
+                if is_rustdoc {
+                    // `rustdoc` uses `-o` for the output directory.
+                    rustc.arg("-o").arg(path);
+                } else {
+                    rustc.arg("--out-dir").arg(path);
+                }
             }
         }