Skip to content

Commit 62c2452

Browse files
committed
Ensure that disable-doc builds don't depend on doc targets
1 parent e40ef96 commit 62c2452

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

src/bootstrap/step.rs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1407,13 +1407,20 @@ mod tests {
14071407
fn build(args: &[&str],
14081408
extra_host: &[&str],
14091409
extra_target: &[&str]) -> Build {
1410+
build_(args, extra_host, extra_target, true)
1411+
}
1412+
1413+
fn build_(args: &[&str],
1414+
extra_host: &[&str],
1415+
extra_target: &[&str],
1416+
docs: bool) -> Build {
14101417
let mut args = args.iter().map(|s| s.to_string()).collect::<Vec<_>>();
14111418
args.push("--build".to_string());
14121419
args.push("A".to_string());
14131420
let flags = Flags::parse(&args);
14141421

14151422
let mut config = Config::default();
1416-
config.docs = true;
1423+
config.docs = docs;
14171424
config.build = "A".to_string();
14181425
config.host = vec![config.build.clone()];
14191426
config.host.extend(extra_host.iter().map(|s| s.to_string()));
@@ -1768,4 +1775,22 @@ mod tests {
17681775
assert!(!plan.iter().any(|s| s.name.contains("tidy")));
17691776
assert!(plan.iter().any(|s| s.name.contains("valgrind")));
17701777
}
1778+
1779+
#[test]
1780+
fn test_disable_docs() {
1781+
let build = build_(&["test"], &[], &[], false);
1782+
let rules = super::build_rules(&build);
1783+
let plan = rules.plan();
1784+
println!("rules: {:#?}", plan);
1785+
assert!(!plan.iter().any(|s| {
1786+
s.name.contains("doc-") || s.name.contains("default:doc")
1787+
}));
1788+
// none of the dependencies should be a doc rule either
1789+
assert!(!plan.iter().any(|s| {
1790+
rules.rules[s.name].deps.iter().any(|dep| {
1791+
let dep = dep(&rules.sbuild.name(s.name));
1792+
dep.name.contains("doc-") || dep.name.contains("default:doc")
1793+
})
1794+
}));
1795+
}
17711796
}

0 commit comments

Comments
 (0)