about summary refs log tree commit diff
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
parent9a2ee0aaef1dfe835c65359b2b07721953ea7040 (diff)
downloadrust-f0e43fc98671f76f7cdcc07cfa17fb2362c132ea.tar.gz
rust-f0e43fc98671f76f7cdcc07cfa17fb2362c132ea.zip
compiletest: only use `make_exe_name` for tests that end up being executed.
-rw-r--r--src/test/ui/consts/const-eval/unused-broken-const.stderr2
-rw-r--r--src/test/ui/emit-directives.rs6
-rw-r--r--src/test/ui/emit-directives.stderr2
-rw-r--r--src/test/ui/traits/trait-object-with-self-in-projection-output-repeated-supertrait.rs3
-rw-r--r--src/tools/compiletest/src/runtest.rs26
5 files changed, 25 insertions, 14 deletions
diff --git a/src/test/ui/consts/const-eval/unused-broken-const.stderr b/src/test/ui/consts/const-eval/unused-broken-const.stderr
index 603efe449f1..e45ce65d8bb 100644
--- a/src/test/ui/consts/const-eval/unused-broken-const.stderr
+++ b/src/test/ui/consts/const-eval/unused-broken-const.stderr
@@ -1,5 +1,3 @@
-warning: due to multiple output types requested, the explicitly specified output file name will be adapted for each output type
-
 error: any use of this value will cause an error
   --> $DIR/unused-broken-const.rs:5:18
    |
diff --git a/src/test/ui/emit-directives.rs b/src/test/ui/emit-directives.rs
index 088280e358a..924569d3e23 100644
--- a/src/test/ui/emit-directives.rs
+++ b/src/test/ui/emit-directives.rs
@@ -1,11 +1,5 @@
-// ignore-tidy-linelength
 // compile-flags:--emit=metadata --error-format=json -Z emit-directives
 // compile-pass
-//
-// Normalization is required to eliminated minor path and filename differences
-// across platforms.
-// normalize-stderr-test: "metadata file written: .*/emit-directives" -> "metadata file written: .../emit-directives"
-// normalize-stderr-test: "emit-directives(\.\w*)?/a(\.\w*)?" -> "emit-directives/a"
 
 // A very basic test for the emission of build directives in JSON output.
 
diff --git a/src/test/ui/emit-directives.stderr b/src/test/ui/emit-directives.stderr
index b8a4b96f4bf..068745edb8d 100644
--- a/src/test/ui/emit-directives.stderr
+++ b/src/test/ui/emit-directives.stderr
@@ -1 +1 @@
-{"directive":"metadata file written: .../emit-directives/a"}
+{"directive":"metadata file written: $TEST_BUILD_DIR/emit-directives/libemit_directives.rmeta"}
diff --git a/src/test/ui/traits/trait-object-with-self-in-projection-output-repeated-supertrait.rs b/src/test/ui/traits/trait-object-with-self-in-projection-output-repeated-supertrait.rs
index 46c083f9305..3e9f612a2af 100644
--- a/src/test/ui/traits/trait-object-with-self-in-projection-output-repeated-supertrait.rs
+++ b/src/test/ui/traits/trait-object-with-self-in-projection-output-repeated-supertrait.rs
@@ -1,5 +1,8 @@
 // compile-pass
 
+// FIXME(eddyb) shorten the name so windows doesn't choke on it.
+#![crate_name = "trait_test"]
+
 // Regression test related to #56288. Check that a supertrait projection (of
 // `Output`) that references `Self` is ok if there is another occurence of
 // the same supertrait that specifies the projection explicitly, even if
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);
+                }
             }
         }