Skip to content

Commit

Permalink
Rollup merge of rust-lang#42651 - infinity0:master, r=alexcrichton
Browse files Browse the repository at this point in the history
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
  • Loading branch information
frewsxcv authored Jun 16, 2017
2 parents f784e5f + 13b1a80 commit a592611
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions src/bootstrap/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
rules.test("check-linkchecker", "src/tools/linkchecker")
.dep(|s| s.name("tool-linkchecker").stage(0))
.dep(|s| s.name("default:doc"))
.default(true)
.default(build.config.docs)
.host(true)
.run(move |s| check::linkcheck(build, s.target));
rules.test("check-cargotest", "src/tools/cargotest")
Expand Down Expand Up @@ -1407,13 +1407,20 @@ mod tests {
fn build(args: &[&str],
extra_host: &[&str],
extra_target: &[&str]) -> Build {
build_(args, extra_host, extra_target, true)
}

fn build_(args: &[&str],
extra_host: &[&str],
extra_target: &[&str],
docs: bool) -> Build {
let mut args = args.iter().map(|s| s.to_string()).collect::<Vec<_>>();
args.push("--build".to_string());
args.push("A".to_string());
let flags = Flags::parse(&args);

let mut config = Config::default();
config.docs = true;
config.docs = docs;
config.build = "A".to_string();
config.host = vec![config.build.clone()];
config.host.extend(extra_host.iter().map(|s| s.to_string()));
Expand Down Expand Up @@ -1768,4 +1775,22 @@ mod tests {
assert!(!plan.iter().any(|s| s.name.contains("tidy")));
assert!(plan.iter().any(|s| s.name.contains("valgrind")));
}

#[test]
fn test_disable_docs() {
let build = build_(&["test"], &[], &[], false);
let rules = super::build_rules(&build);
let plan = rules.plan();
println!("rules: {:#?}", plan);
assert!(!plan.iter().any(|s| {
s.name.contains("doc-") || s.name.contains("default:doc")
}));
// none of the dependencies should be a doc rule either
assert!(!plan.iter().any(|s| {
rules.rules[s.name].deps.iter().any(|dep| {
let dep = dep(&rules.sbuild.name(s.name));
dep.name.contains("doc-") || dep.name.contains("default:doc")
})
}));
}
}

0 comments on commit a592611

Please sign in to comment.