diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2018-02-28 23:33:26 -0800 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2018-03-01 09:29:37 -0800 |
| commit | eadea4ab1ae1c53e6e015fa12845335e55c62f94 (patch) | |
| tree | 32a7dbda40821f5a85de6712f2363f39dfe32c4c /src/bootstrap | |
| parent | 3eeb5a665e313c5b281820099e04d4c6c8188b46 (diff) | |
| parent | a9f940e320bccc86dc7ab8b6179e918d3c05454d (diff) | |
| download | rust-eadea4ab1ae1c53e6e015fa12845335e55c62f94.tar.gz rust-eadea4ab1ae1c53e6e015fa12845335e55c62f94.zip | |
Rollup merge of #48405 - kennytm:autotoolstate-follow-up, r=Mark-Simulacrum
Auto-toolstate management follow-up. Tracking comment: https://github.com/rust-lang/rust/issues/45861#issuecomment-367302777 * Fixed rust-lang-nursery/rust-toolstate#1, a proper link to the PR will be included. * Fixed rust-lang-nursery/rust-toolstate#2, a comment will be posted to the PR if the toolstate changed * Toolstate regression will be rejected at the last week of the 6-week cycle (currently entirely date-based). * Implemented https://internals.rust-lang.org/t/the-current-submodule-setup-is-not-tenable/6593, moved doc tests of Nomicon, Reference, Rust-by-Example and The Book to the "tools" job and thus allowed to fail like other external tools.
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/builder.rs | 6 | ||||
| -rw-r--r-- | src/bootstrap/compile.rs | 3 | ||||
| -rw-r--r-- | src/bootstrap/test.rs | 87 |
3 files changed, 75 insertions, 21 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index b5946b44e05..1df85323c41 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -231,7 +231,7 @@ pub struct ShouldRun<'a> { paths: BTreeSet<PathSet>, // If this is a default rule, this is an additional constraint placed on - // it's run. Generally something like compiler docs being enabled. + // its run. Generally something like compiler docs being enabled. is_really_default: bool, } @@ -326,7 +326,9 @@ impl<'a> Builder<'a> { test::RunPassPretty, test::RunFailPretty, test::RunPassValgrindPretty, test::RunPassFullDepsPretty, test::RunFailFullDepsPretty, test::RunMake, test::Crate, test::CrateLibrustc, test::Rustdoc, test::Linkcheck, test::Cargotest, - test::Cargo, test::Rls, test::Docs, test::ErrorIndex, test::Distcheck, + test::Cargo, test::Rls, test::ErrorIndex, test::Distcheck, + test::Nomicon, test::Reference, test::RustdocBook, test::RustByExample, + test::TheBook, test::UnstableBook, test::Rustfmt, test::Miri, test::Clippy, test::RustdocJS, test::RustdocTheme), Kind::Bench => describe!(test::Crate, test::CrateLibrustc), Kind::Doc => describe!(doc::UnstableBook, doc::UnstableBookGen, doc::TheBook, diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 2c9f0ddb6c3..408d63be6c6 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -629,6 +629,8 @@ impl Step for CodegenBackend { .arg(build.src.join("src/librustc_trans/Cargo.toml")); rustc_cargo_env(build, &mut cargo); + let _folder = build.fold_output(|| format!("stage{}-rustc_trans", compiler.stage)); + match &*self.backend { "llvm" | "emscripten" => { // Build LLVM for our target. This will implicitly build the @@ -642,7 +644,6 @@ impl Step for CodegenBackend { features.push_str(" emscripten"); } - let _folder = build.fold_output(|| format!("stage{}-rustc_trans", compiler.stage)); println!("Building stage{} codegen artifacts ({} -> {}, {})", compiler.stage, &compiler.host, target, self.backend); diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index bd8c36a296c..b27ddfdbc5e 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -78,15 +78,17 @@ fn try_run(build: &Build, cmd: &mut Command) -> bool { true } -fn try_run_quiet(build: &Build, cmd: &mut Command) { +fn try_run_quiet(build: &Build, cmd: &mut Command) -> bool { if !build.fail_fast { if !build.try_run_quiet(cmd) { let mut failures = build.delayed_failures.borrow_mut(); failures.push(format!("{:?}", cmd)); + return false; } } else { build.run_quiet(cmd); } + true } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] @@ -994,23 +996,19 @@ impl Step for Compiletest { } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub struct Docs { +struct DocTest { compiler: Compiler, + path: &'static str, + name: &'static str, + is_ext_doc: bool, } -impl Step for Docs { +impl Step for DocTest { type Output = (); - const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { - run.path("src/doc") - } - - fn make_run(run: RunConfig) { - run.builder.ensure(Docs { - compiler: run.builder.compiler(run.builder.top_stage, run.host), - }); + run.never() } /// Run `rustdoc --test` for all documentation in `src/doc`. @@ -1026,9 +1024,9 @@ impl Step for Docs { // Do a breadth-first traversal of the `src/doc` directory and just run // tests for all files that end in `*.md` - let mut stack = vec![build.src.join("src/doc")]; + let mut stack = vec![build.src.join(self.path)]; let _time = util::timeit(); - let _folder = build.fold_output(|| "test_docs"); + let _folder = build.fold_output(|| format!("test_{}", self.name)); while let Some(p) = stack.pop() { if p.is_dir() { @@ -1046,11 +1044,64 @@ impl Step for Docs { continue; } - markdown_test(builder, compiler, &p); + let test_result = markdown_test(builder, compiler, &p); + if self.is_ext_doc { + let toolstate = if test_result { + ToolState::TestPass + } else { + ToolState::TestFail + }; + build.save_toolstate(self.name, toolstate); + } } } } +macro_rules! test_book { + ($($name:ident, $path:expr, $book_name:expr, default=$default:expr;)+) => { + $( + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] + pub struct $name { + compiler: Compiler, + } + + impl Step for $name { + type Output = (); + const DEFAULT: bool = $default; + const ONLY_HOSTS: bool = true; + + fn should_run(run: ShouldRun) -> ShouldRun { + run.path($path) + } + + fn make_run(run: RunConfig) { + run.builder.ensure($name { + compiler: run.builder.compiler(run.builder.top_stage, run.host), + }); + } + + fn run(self, builder: &Builder) { + builder.ensure(DocTest { + compiler: self.compiler, + path: $path, + name: $book_name, + is_ext_doc: !$default, + }); + } + } + )+ + } +} + +test_book!( + Nomicon, "src/doc/nomicon", "nomicon", default=false; + Reference, "src/doc/reference", "reference", default=false; + RustdocBook, "src/doc/rustdoc", "rustdoc", default=true; + RustByExample, "src/doc/rust-by-example", "rust-by-example", default=false; + TheBook, "src/doc/book", "book", default=false; + UnstableBook, "src/doc/unstable-book", "unstable-book", default=true; +); + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub struct ErrorIndex { compiler: Compiler, @@ -1101,13 +1152,13 @@ impl Step for ErrorIndex { } } -fn markdown_test(builder: &Builder, compiler: Compiler, markdown: &Path) { +fn markdown_test(builder: &Builder, compiler: Compiler, markdown: &Path) -> bool { let build = builder.build; let mut file = t!(File::open(markdown)); let mut contents = String::new(); t!(file.read_to_string(&mut contents)); if !contents.contains("```") { - return; + return true; } println!("doc tests for: {}", markdown.display()); @@ -1121,9 +1172,9 @@ fn markdown_test(builder: &Builder, compiler: Compiler, markdown: &Path) { cmd.arg("--test-args").arg(test_args); if build.config.quiet_tests { - try_run_quiet(build, &mut cmd); + try_run_quiet(build, &mut cmd) } else { - try_run(build, &mut cmd); + try_run(build, &mut cmd) } } |
