fix: cargo test failed with --release (#3183) (#3184)

Signed-off-by: nibon7 <nibon7@163.com>
This commit is contained in:
nibon7 2021-03-15 11:59:04 +08:00 committed by GitHub
parent b69cda9e07
commit 82b6300dcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -246,10 +246,15 @@ pub fn root() -> PathBuf {
}
pub fn binaries() -> PathBuf {
let mut build_type = "debug";
if !cfg!(debug_assertions) {
build_type = "release"
}
std::env::var("CARGO_TARGET_DIR")
.ok()
.map(|target_dir| PathBuf::from(target_dir).join("debug"))
.unwrap_or_else(|| root().join("target/debug"))
.map(|target_dir| PathBuf::from(target_dir).join(&build_type))
.unwrap_or_else(|| root().join(format!("target/{}", &build_type)))
}
pub fn fixtures() -> PathBuf {