Skip to content

Commit

Permalink
Remove likely brittle test.
Browse files Browse the repository at this point in the history
This is too dependent on the particulars of libstd.
  • Loading branch information
ehuss committed Feb 4, 2020
1 parent ebba7a3 commit acfb89a
Showing 1 changed file with 0 additions and 56 deletions.
56 changes: 0 additions & 56 deletions tests/build-std/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,59 +211,3 @@ fn custom_test_framework() {
.build_std_arg("core")
.run();
}

#[cargo_test(build_std)]
fn common_crate_collision() {
// Check for collision with `cc` crate in build dependencies.
// This needs to be a full test since we need to use the real `cc` crate.
// This is a bit fragile, since it assumes `cc` is used in libstd,
// and that we are selecting the same features.

// Determine the version of CC used in the real std so that we use the
// exact same version.
let sysroot = paths::sysroot();
let sysroot = Path::new(&sysroot);
let contents =
std::fs::read_to_string(sysroot.join("lib/rustlib/src/rust/Cargo.lock")).unwrap();
let lock: toml::Value = toml::from_str(&contents).unwrap();
let mut packages = lock["package"].as_array().unwrap().iter();
let cc = packages
.find(|p| p["name"].as_str().unwrap() == "cc")
.unwrap();
// Make sure there is only one `cc`.
assert!(packages
.find(|p| p["name"].as_str().unwrap() == "cc")
.is_none());
let cc_version = cc["version"].as_str().unwrap();

let p = project()
.file(
"Cargo.toml",
&format!(
r#"
[package]
name = "foo"
version = "0.1.0"
[build-dependencies]
cc = "={}"
"#,
cc_version
),
)
.file("build.rs", "extern crate cc; fn main() {}")
.file("src/main.rs", "fn main() {}")
.build();

p.cargo("build -v")
.build_std()
.target_host()
.with_stderr_contains(
"[RUNNING] `rustc --crate-name cc [..]-Zforce-unstable-if-unmarked[..]",
)
.with_stderr_line_without(
&["[RUNNING] `rustc --crate-name cc"],
&["-Zforce-unstable-if-unmarked"],
)
.run();
}

0 comments on commit acfb89a

Please sign in to comment.