// carried over.
let to_exec = to_exec.into_os_string();
let mut cmd = cx.compilation.host_process(to_exec, unit.pkg)?;
+ let debug = unit.profile.debuginfo.unwrap_or(0) != 0;
cmd.env("OUT_DIR", &build_output)
.env("CARGO_MANIFEST_DIR", unit.pkg.root())
.env("NUM_JOBS", &cx.jobs().to_string())
Kind::Target => cx.build_config.target_triple(),
},
)
- .env("DEBUG", &unit.profile.debuginfo.is_some().to_string())
+ .env("DEBUG", debug.to_string())
.env("OPT_LEVEL", &unit.profile.opt_level.to_string())
.env(
"PROFILE",
assert_that(build.cargo("bench"), execs().with_status(0));
}
+#[test]
+fn profile_debug_0() {
+ let p = project("foo")
+ .file(
+ "Cargo.toml",
+ r#"
+ [package]
+ name = "foo"
+ version = "0.0.1"
+
+ [profile.dev]
+ debug = 0
+ "#,
+ )
+ .file("src/lib.rs", "")
+ .file(
+ "build.rs",
+ r#"
+ use std::env;
+
+ fn main() {
+ assert_eq!(env::var("OPT_LEVEL").unwrap(), "0");
+ assert_eq!(env::var("PROFILE").unwrap(), "debug");
+ assert_eq!(env::var("DEBUG").unwrap(), "false");
+ }
+ "#,
+ )
+ .build();
+ assert_that(p.cargo("build"), execs().with_status(0));
+}
+
#[test]
fn build_script_with_lto() {
let build = project("builder")