Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporary fix for errors in testing #1011

Merged
merged 1 commit into from Dec 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions build.rs
Expand Up @@ -4,6 +4,10 @@ use std::io::Write;
use std::path::Path;

pub fn main() {
if let Ok(profile) = env::var("PROFILE") {
println!("cargo:rustc-cfg=build={:?}", profile);
}

let feature_prefix = "CARGO_FEATURE_";
let out_dir = env::var("OUT_DIR").unwrap();

Expand Down
10 changes: 9 additions & 1 deletion tests/common/util.rs
Expand Up @@ -374,7 +374,15 @@ impl TestScenario {
// Instead of hardcoding the path relative to the current
// directory, use Cargo's OUT_DIR to find path to executable.
// This allows tests to be run using profiles other than debug.
let target_dir = path_concat!(env::var("OUT_DIR").unwrap(), "..", "..", "..", PROGNAME);
// let target_dir = path_concat!(env::var("OUT_DIR").unwrap(), "..", "..", "..", PROGNAME);
let target_dir;
// FIXME: $OUT_DIR is not set by nightly cargo
// See also: https://github.com/rust-lang/cargo/issues/3368
if cfg!(build = "release") {
target_dir = path_concat!(env!("CARGO_MANIFEST_DIR"), "target", "release", PROGNAME);
} else {
target_dir = path_concat!(env!("CARGO_MANIFEST_DIR"), "target", "debug", PROGNAME);
}
PathBuf::from(AtPath::new(Path::new(&target_dir)).root_dir_resolved())
},
util_name: String::from(util_name),
Expand Down