Skip to content

Commit f0e43fc

Browse files
committed
compiletest: only use make_exe_name for tests that end up being executed.
1 parent 9a2ee0a commit f0e43fc

File tree

5 files changed

+25
-14
lines changed

5 files changed

+25
-14
lines changed

src/test/ui/consts/const-eval/unused-broken-const.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
warning: due to multiple output types requested, the explicitly specified output file name will be adapted for each output type
2-
31
error: any use of this value will cause an error
42
--> $DIR/unused-broken-const.rs:5:18
53
|

src/test/ui/emit-directives.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
// ignore-tidy-linelength
21
// compile-flags:--emit=metadata --error-format=json -Z emit-directives
32
// compile-pass
4-
//
5-
// Normalization is required to eliminated minor path and filename differences
6-
// across platforms.
7-
// normalize-stderr-test: "metadata file written: .*/emit-directives" -> "metadata file written: .../emit-directives"
8-
// normalize-stderr-test: "emit-directives(\.\w*)?/a(\.\w*)?" -> "emit-directives/a"
93

104
// A very basic test for the emission of build directives in JSON output.
115

src/test/ui/emit-directives.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"directive":"metadata file written: .../emit-directives/a"}
1+
{"directive":"metadata file written: $TEST_BUILD_DIR/emit-directives/libemit_directives.rmeta"}

src/test/ui/traits/trait-object-with-self-in-projection-output-repeated-supertrait.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// compile-pass
22

3+
// FIXME(eddyb) shorten the name so windows doesn't choke on it.
4+
#![crate_name = "trait_test"]
5+
36
// Regression test related to #56288. Check that a supertrait projection (of
47
// `Output`) that references `Self` is ok if there is another occurence of
58
// the same supertrait that specifies the projection explicitly, even if

src/tools/compiletest/src/runtest.rs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,10 +1422,21 @@ impl<'test> TestCx<'test> {
14221422
}
14231423

14241424
fn compile_test(&self) -> ProcRes {
1425-
let mut rustc = self.make_compile_args(
1426-
&self.testpaths.file,
1427-
TargetLocation::ThisFile(self.make_exe_name()),
1428-
);
1425+
// Only use `make_exe_name` when the test ends up being executed.
1426+
let will_execute = match self.config.mode {
1427+
RunPass | Ui => self.should_run_successfully(),
1428+
Incremental => self.revision.unwrap().starts_with("r"),
1429+
RunFail | RunPassValgrind | MirOpt |
1430+
DebugInfoBoth | DebugInfoGdb | DebugInfoLldb => true,
1431+
_ => false,
1432+
};
1433+
let output_file = if will_execute {
1434+
TargetLocation::ThisFile(self.make_exe_name())
1435+
} else {
1436+
TargetLocation::ThisDirectory(self.output_base_dir())
1437+
};
1438+
1439+
let mut rustc = self.make_compile_args(&self.testpaths.file, output_file);
14291440

14301441
rustc.arg("-L").arg(&self.aux_output_dir_name());
14311442

@@ -1882,7 +1893,12 @@ impl<'test> TestCx<'test> {
18821893
rustc.arg("-o").arg(path);
18831894
}
18841895
TargetLocation::ThisDirectory(path) => {
1885-
rustc.arg("--out-dir").arg(path);
1896+
if is_rustdoc {
1897+
// `rustdoc` uses `-o` for the output directory.
1898+
rustc.arg("-o").arg(path);
1899+
} else {
1900+
rustc.arg("--out-dir").arg(path);
1901+
}
18861902
}
18871903
}
18881904

0 commit comments

Comments
 (0)