mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-23 13:13:17 +00:00
Merge pull request #2997 from matthiaskrgr/cargo_test_release
fix cargo test --release
This commit is contained in:
commit
6ada5b51cc
@ -944,10 +944,21 @@ fn rustfmt() -> PathBuf {
|
||||
let mut me = env::current_exe().expect("failed to get current executable");
|
||||
me.pop(); // chop of the test name
|
||||
me.pop(); // chop off `deps`
|
||||
|
||||
// if we run `cargo test --release` we might only have a release build
|
||||
if cfg!(release) {
|
||||
// ../release/
|
||||
me.pop();
|
||||
me.push("release");
|
||||
}
|
||||
me.push("rustfmt");
|
||||
assert!(
|
||||
me.is_file() || me.with_extension("exe").is_file(),
|
||||
"no rustfmt bin, try running `cargo build` before testing"
|
||||
if cfg!(release) {
|
||||
"no rustfmt bin, try running `cargo build --release` before testing"
|
||||
} else {
|
||||
"no rustfmt bin, try running `cargo build` before testing"
|
||||
}
|
||||
);
|
||||
me
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user