]> git.lizzy.rs Git - rust.git/blob - tests/cargo/mod.rs
Merge remote-tracking branch 'upstream/master' into rustup2
[rust.git] / tests / cargo / mod.rs
1 use lazy_static::lazy_static;
2 use std::env;
3 use std::path::PathBuf;
4
5 lazy_static! {
6     pub static ref CARGO_TARGET_DIR: PathBuf = {
7         match env::var_os("CARGO_TARGET_DIR") {
8             Some(v) => v.into(),
9             None => env::current_dir().unwrap().join("target"),
10         }
11     };
12     pub static ref TARGET_LIB: PathBuf = {
13         if let Some(path) = option_env!("TARGET_LIBS") {
14             path.into()
15         } else {
16             let mut dir = CARGO_TARGET_DIR.clone();
17             if let Some(target) = env::var_os("CARGO_BUILD_TARGET") {
18                 dir.push(target);
19             }
20             dir.push(env!("PROFILE"));
21             dir
22         }
23     };
24 }
25
26 #[must_use]
27 pub fn is_rustc_test_suite() -> bool {
28     option_env!("RUSTC_TEST_SUITE").is_some()
29 }