Skip to content

Commit 15e0802

Browse files
committed
Add a test for build pipelining with a complex build graph.
1 parent 1863aa2 commit 15e0802

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

tests/testsuite/build.rs

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4583,6 +4583,67 @@ fn pipelining_works() {
45834583
.run();
45844584
}
45854585

4586+
#[cargo_test]
4587+
fn pipelining_big_graph() {
4588+
if !crate::support::is_nightly() {
4589+
return;
4590+
}
4591+
4592+
// Create a crate graph of the form {a,b}{0..19}, where {a,b}(n) depend on {a,b}(n+1)
4593+
// Then have `foo`, a binary crate, depend on the whole thing.
4594+
let mut project = project()
4595+
.file(
4596+
"Cargo.toml",
4597+
r#"
4598+
[package]
4599+
name = "foo"
4600+
version = "0.1.0"
4601+
[dependencies]
4602+
a1 = { path = "a1" }
4603+
b1 = { path = "b1" }
4604+
"#,
4605+
)
4606+
.file("src/main.rs", "fn main(){}");
4607+
4608+
for n in 0..30 {
4609+
for x in &["a", "b"] {
4610+
project = project
4611+
.file(
4612+
&format!("{x}{n}/Cargo.toml", x = x, n = n),
4613+
&format!(
4614+
r#"
4615+
[package]
4616+
name = "{x}{n}"
4617+
version = "0.1.0"
4618+
[dependencies]
4619+
a{np1} = {{ path = "../a{np1}" }}
4620+
b{np1} = {{ path = "../b{np1}" }}
4621+
"#,
4622+
x = x,
4623+
n = n,
4624+
np1 = n + 1
4625+
),
4626+
)
4627+
.file(&format!("{x}{n}/src/lib.rs", x = x, n = n), "");
4628+
}
4629+
}
4630+
4631+
let foo = project
4632+
.file("a30/Cargo.toml", &basic_lib_manifest("a30"))
4633+
.file(
4634+
"a30/src/lib.rs",
4635+
r#"compile_error!("don't actually build me");"#,
4636+
)
4637+
.file("b30/Cargo.toml", &basic_lib_manifest("b30"))
4638+
.file("b30/src/lib.rs", "")
4639+
.build();
4640+
foo.cargo("build -p foo")
4641+
.env("CARGO_BUILD_PIPELINING", "true")
4642+
.with_status(101)
4643+
.with_stderr_contains("[ERROR] Could not compile `a30`[..]")
4644+
.run();
4645+
}
4646+
45864647
#[cargo_test]
45874648
fn forward_rustc_output() {
45884649
let foo = project()

0 commit comments

Comments
 (0)