Skip to content

Commit cbca426

Browse files
committed
Auto merge of #13816 - rukai:bindep_cargo_tree_panic_test, r=weihanglo
Add failing test: artifact_dep_target_specified This PR pulls the failing test out of #13207 [During review](#13207 (comment)), it was requested there be a previous commit with a failing test. It will be a while before I have the time to address the other issues with the PR, so I figured for now we should land this failing test first.
2 parents eee4ea2 + 4079305 commit cbca426

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

Diff for: tests/testsuite/artifact_dep.rs

+49
Original file line numberDiff line numberDiff line change
@@ -1497,6 +1497,55 @@ foo v0.0.0 ([CWD])
14971497
)
14981498
.run();
14991499
}
1500+
1501+
#[cargo_test]
1502+
fn artifact_dep_target_specified() {
1503+
if cross_compile::disabled() {
1504+
return;
1505+
}
1506+
let target = cross_compile::alternate();
1507+
1508+
let p = project()
1509+
.file(
1510+
"Cargo.toml",
1511+
&r#"
1512+
[package]
1513+
name = "foo"
1514+
version = "0.0.0"
1515+
authors = []
1516+
resolver = "2"
1517+
1518+
[dependencies]
1519+
bindep = { path = "bindep", artifact = "bin", target = "$TARGET" }
1520+
"#
1521+
.replace("$TARGET", target),
1522+
)
1523+
.file("src/lib.rs", "")
1524+
.file("bindep/Cargo.toml", &basic_manifest("bindep", "0.0.0"))
1525+
.file("bindep/src/main.rs", "fn main() {}")
1526+
.build();
1527+
1528+
p.cargo("check -Z bindeps")
1529+
.masquerade_as_nightly_cargo(&["bindeps"])
1530+
.with_stderr_contains(
1531+
r#"[COMPILING] bindep v0.0.0 ([CWD]/bindep)
1532+
[CHECKING] foo v0.0.0 ([CWD])
1533+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]"#,
1534+
)
1535+
.with_status(0)
1536+
.run();
1537+
1538+
// TODO: This command currently fails due to a bug in cargo but it should be fixed so that it succeeds in the future.
1539+
p.cargo("tree -Z bindeps")
1540+
.masquerade_as_nightly_cargo(&["bindeps"])
1541+
.with_stdout("")
1542+
.with_stderr_contains(
1543+
r#"activated_features for invalid package: features did not find PackageId { name: "bindep", version: "0.0.0", source: "[..]" } NormalOrDev"#
1544+
)
1545+
.with_status(101)
1546+
.run();
1547+
}
1548+
15001549
#[cargo_test]
15011550
fn targets_are_picked_up_from_non_workspace_artifact_deps() {
15021551
if cross_compile::disabled() {

0 commit comments

Comments
 (0)