// just here for rustbuild. We need a more principled method
// doing this eventually.
let __cargo_default_lib_metadata = env::var("__CARGO_DEFAULT_LIB_METADATA");
- if !unit.profile.test &&
+ if !(unit.profile.test || unit.profile.check) &&
(unit.target.is_dylib() || unit.target.is_cdylib() ||
(unit.target.is_bin() && self.target_triple().starts_with("wasm32-"))) &&
unit.pkg.package_id().source_id().is_path() &&
+#[macro_use]
extern crate cargotest;
extern crate hamcrest;
extern crate glob;
execs().with_status(0));
}
+// Check on a dylib should have a different metadata hash than build.
+#[test]
+fn check_dylib() {
+ let p = project("foo")
+ .file("Cargo.toml", r#"
+ [package]
+ name = "foo"
+ version = "0.1.0"
+ authors = []
+
+ [lib]
+ crate-type = ["dylib"]
+
+ [dependencies]
+ "#)
+ .file("src/lib.rs", "")
+ .build();
+
+ let build_output = t!(String::from_utf8(
+ t!(p.cargo("build").arg("-v").exec_with_output())
+ .stderr,
+ ));
+ let build_metadata = build_output
+ .split_whitespace()
+ .find(|arg| arg.starts_with("metadata="))
+ .unwrap();
+
+ let check_output = t!(String::from_utf8(
+ t!(p.cargo("check").arg("-v").exec_with_output())
+ .stderr,
+ ));
+ let check_metadata = check_output
+ .split_whitespace()
+ .find(|arg| arg.starts_with("metadata="))
+ .unwrap();
+
+ assert_ne!(build_metadata, check_metadata);
+}
+
// test `cargo rustc --profile check`
#[test]
fn rustc_check() {