Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a592611

Browse files
authoredJun 16, 2017
Rollup merge of #42651 - infinity0:master, r=alexcrichton
Only run check-linkchecker when actually building docs Otherwise the build fails, when running tests but not building docs, e.g.: https://buildd.debian.org/status/fetch.php?pkg=rustc&arch=ppc64el&ver=1.17.0%2Bdfsg2-3&stamp=1497403375&raw=0
2 parents f784e5f + 13b1a80 commit a592611

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed
 

‎src/bootstrap/step.rs

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
463463
rules.test("check-linkchecker", "src/tools/linkchecker")
464464
.dep(|s| s.name("tool-linkchecker").stage(0))
465465
.dep(|s| s.name("default:doc"))
466-
.default(true)
466+
.default(build.config.docs)
467467
.host(true)
468468
.run(move |s| check::linkcheck(build, s.target));
469469
rules.test("check-cargotest", "src/tools/cargotest")
@@ -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)
Please sign in to comment.