Skip to content

Commit

Permalink
reproduce #10431
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Feb 28, 2022
1 parent f75d4ea commit ac6427f
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions tests/testsuite/artifact_dep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,84 @@ fn features_are_not_unified_among_lib_and_bin_dep_of_different_target() {
.run();
}

#[cargo_test]
#[ignore]
fn feature_resolution_works_for_cfg_target_specification() {
if cross_compile::disabled() {
return;
}
let target = cross_compile::alternate();
let target_arch = cross_compile::alternate_arch();
let p = project()
.file(
"Cargo.toml",
&r#"
[project]
name = "foo"
version = "0.0.1"
authors = []
resolver = "2"
[dependencies.d1]
path = "d1"
artifact = "bin"
target = "$TARGET"
"#
.replace("$TARGET", target),
)
.file(
"src/main.rs",
r#"
fn main() {
let _b = include_bytes!(env!("CARGO_BIN_FILE_D1"));
}
"#,
)
.file(
"d1/Cargo.toml",
&r#"
[package]
name = "d1"
version = "0.0.1"
authors = []
[target.'cfg(target_arch = "$ARCH")'.dependencies.d2]
path = "../d2"
"#
.replace("$ARCH", target_arch),
)
.file(
"d1/src/main.rs",
r#"fn main() {
d1::f();
}"#,
)
.file(
"d1/src/lib.rs",
&r#"pub fn f() {
#[cfg(target_arch = "$ARCH")]
d2::f();
}
"#
.replace("$ARCH", target_arch),
)
.file(
"d2/Cargo.toml",
r#"
[package]
name = "d2"
version = "0.0.1"
authors = []
"#,
)
.file("d2/src/lib.rs", "pub fn f() {}")
.build();

p.cargo("build -Z bindeps")
.masquerade_as_nightly_cargo()
.run();
}

#[cargo_test]
fn build_script_with_bin_artifacts() {
let p = project()
Expand Down

0 comments on commit ac6427f

Please sign in to comment.