From f18c52b2233b8d1142fea29551e140fd15d3ae70 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 12 Dec 2017 23:53:24 +0100 Subject: Start adding js tests --- src/bootstrap/check.rs | 35 +++++++++++++++++++++++++++++++++++ src/bootstrap/tool.rs | 1 + 2 files changed, 36 insertions(+) (limited to 'src/bootstrap') diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index cc9be3cec34..d4be0de6a1e 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -424,6 +424,40 @@ fn path_for_cargo(builder: &Builder, compiler: Compiler) -> OsString { env::join_paths(iter::once(path).chain(env::split_paths(&old_path))).expect("") } +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct RustdocJS { + pub host: Interned, +} + +impl Step for RustdocJS { + type Output = PathBuf; + const DEFAULT: bool = true; + const ONLY_HOSTS: bool = true; + + fn should_run(run: ShouldRun) -> ShouldRun { + run.path("node") + } + + fn make_run(run: RunConfig) { + run.builder.ensure(RustdocJS { + host: run.host, + }); + } + + fn run(self, _: &Builder) { + let cmd = if cfg!(target_os = "windows") { + let command = Command::new("cmd"); + command.args(&["/C", "node src/tools/rustdoc-js/tester.js"]); + command + } else { + let command = Command::new("sh"); + command.args(&["-c", "node src/tools/rustdoc-js/tester.js"]); + command + }; + builder.run(cmd); + } +} + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub struct Tidy { host: Interned, @@ -570,6 +604,7 @@ static HOST_COMPILETESTS: &[Test] = &[ }, Test { path: "src/test/run-make", mode: "run-make", suite: "run-make" }, Test { path: "src/test/rustdoc", mode: "rustdoc", suite: "rustdoc" }, + Test { path: "src/test/rustdoc-js", mode: "rustdoc-js", suite: "rustdoc-js" }, Test { path: "src/test/pretty", mode: "pretty", suite: "pretty" }, Test { path: "src/test/run-pass/pretty", mode: "pretty", suite: "run-pass" }, diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index ea055cb5d1b..d80d7732ab2 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -260,6 +260,7 @@ tool!( BuildManifest, "src/tools/build-manifest", "build-manifest", Mode::Libstd; RemoteTestClient, "src/tools/remote-test-client", "remote-test-client", Mode::Libstd; RustInstaller, "src/tools/rust-installer", "fabricate", Mode::Libstd; + RustdocJS, "node", "node", Mode::Tool; ); #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -- cgit 1.4.1-3-g733a5 From 50bb6ba13eeb66e96db5455d0dc2a7cab5b02e1e Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 8 Jan 2018 23:43:20 +0100 Subject: Move forward to add rustdoc test --- src/bootstrap/builder.rs | 4 +++- src/bootstrap/check.rs | 21 +++++++-------------- src/bootstrap/tool.rs | 2 +- 3 files changed, 11 insertions(+), 16 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index ce30d1f4cec..be62ce3bf3a 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -254,7 +254,9 @@ impl<'a> Builder<'a> { Kind::Test => describe!(check::Tidy, check::Bootstrap, check::DefaultCompiletest, check::HostCompiletest, check::Crate, check::CrateLibrustc, check::Rustdoc, check::Linkcheck, check::Cargotest, check::Cargo, check::Rls, check::Docs, - check::ErrorIndex, check::Distcheck, check::Rustfmt, check::Miri, check::Clippy), + check::ErrorIndex, check::Distcheck, check::Rustfmt, check::Miri, check::Clippy, + check::RustdocJS), + Kind::Bench => describe!(check::Crate, check::CrateLibrustc), Kind::Doc => describe!(doc::UnstableBook, doc::UnstableBookGen, doc::TheBook, doc::Standalone, doc::Std, doc::Test, doc::Rustc, doc::ErrorIndex, doc::Nomicon, diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index d4be0de6a1e..265e7721a97 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -430,12 +430,12 @@ pub struct RustdocJS { } impl Step for RustdocJS { - type Output = PathBuf; + type Output = (); const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { - run.path("node") + run.path("src/tests/rustdoc-js") } fn make_run(run: RunConfig) { @@ -444,17 +444,11 @@ impl Step for RustdocJS { }); } - fn run(self, _: &Builder) { - let cmd = if cfg!(target_os = "windows") { - let command = Command::new("cmd"); - command.args(&["/C", "node src/tools/rustdoc-js/tester.js"]); - command - } else { - let command = Command::new("sh"); - command.args(&["-c", "node src/tools/rustdoc-js/tester.js"]); - command - }; - builder.run(cmd); + fn run(self, builder: &Builder) { + let nodejs = builder.config.nodejs.clone(); + let mut command = Command::new(&nodejs.expect("no nodejs found")); + command.args(&["src/tools/rustdoc-js/tester.js", &*self.host]); + builder.run(&mut command); } } @@ -604,7 +598,6 @@ static HOST_COMPILETESTS: &[Test] = &[ }, Test { path: "src/test/run-make", mode: "run-make", suite: "run-make" }, Test { path: "src/test/rustdoc", mode: "rustdoc", suite: "rustdoc" }, - Test { path: "src/test/rustdoc-js", mode: "rustdoc-js", suite: "rustdoc-js" }, Test { path: "src/test/pretty", mode: "pretty", suite: "pretty" }, Test { path: "src/test/run-pass/pretty", mode: "pretty", suite: "run-pass" }, diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index d80d7732ab2..96947800d44 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -260,7 +260,7 @@ tool!( BuildManifest, "src/tools/build-manifest", "build-manifest", Mode::Libstd; RemoteTestClient, "src/tools/remote-test-client", "remote-test-client", Mode::Libstd; RustInstaller, "src/tools/rust-installer", "fabricate", Mode::Libstd; - RustdocJS, "node", "node", Mode::Tool; + RustdocJS, "rustdoc-js", "js-tests", Mode::Tool; ); #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -- cgit 1.4.1-3-g733a5 From 69521996c802e519f2b8f37d92259a7f389cde19 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 12 Jan 2018 23:40:00 +0100 Subject: End of rustdoc-js tool add into builder --- src/bootstrap/builder.rs | 3 ++- src/bootstrap/check.rs | 8 +++++++- src/bootstrap/doc.rs | 4 ++-- src/bootstrap/tool.rs | 1 - 4 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index be62ce3bf3a..4db522ebd13 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -445,7 +445,8 @@ impl<'a> Builder<'a> { let out_dir = self.stage_out(compiler, mode); cargo.env("CARGO_TARGET_DIR", out_dir) .arg(cmd) - .arg("--target").arg(target); + .arg("--target") + .arg(target); // If we were invoked from `make` then that's already got a jobserver // set up for us so no need to tell Cargo about jobs all over again. diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 265e7721a97..bfc0009fcfb 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -427,6 +427,7 @@ fn path_for_cargo(builder: &Builder, compiler: Compiler) -> OsString { #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct RustdocJS { pub host: Interned, + pub target: Interned, } impl Step for RustdocJS { @@ -435,12 +436,13 @@ impl Step for RustdocJS { const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { - run.path("src/tests/rustdoc-js") + run.path("src/test/rustdoc-js") } fn make_run(run: RunConfig) { run.builder.ensure(RustdocJS { host: run.host, + target: run.target, }); } @@ -448,6 +450,10 @@ impl Step for RustdocJS { let nodejs = builder.config.nodejs.clone(); let mut command = Command::new(&nodejs.expect("no nodejs found")); command.args(&["src/tools/rustdoc-js/tester.js", &*self.host]); + builder.ensure(::doc::Std { + target: self.target, + stage: builder.top_stage, + }); builder.run(&mut command); } } diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 832da24c994..0930bc15de1 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -418,8 +418,8 @@ impl Step for Standalone { #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct Std { - stage: u32, - target: Interned, + pub stage: u32, + pub target: Interned, } impl Step for Std { diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 96947800d44..ea055cb5d1b 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -260,7 +260,6 @@ tool!( BuildManifest, "src/tools/build-manifest", "build-manifest", Mode::Libstd; RemoteTestClient, "src/tools/remote-test-client", "remote-test-client", Mode::Libstd; RustInstaller, "src/tools/rust-installer", "fabricate", Mode::Libstd; - RustdocJS, "rustdoc-js", "js-tests", Mode::Tool; ); #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -- cgit 1.4.1-3-g733a5 From 026c7499895a7c251cc9f72345600195738f22fc Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 13 Jan 2018 22:35:41 +0100 Subject: Only run rustdoc-js test suite when nodejs is available --- src/bootstrap/check.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index bfc0009fcfb..25f2f6bc1d0 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -447,14 +447,17 @@ impl Step for RustdocJS { } fn run(self, builder: &Builder) { - let nodejs = builder.config.nodejs.clone(); - let mut command = Command::new(&nodejs.expect("no nodejs found")); - command.args(&["src/tools/rustdoc-js/tester.js", &*self.host]); - builder.ensure(::doc::Std { - target: self.target, - stage: builder.top_stage, - }); - builder.run(&mut command); + if let Some(ref nodejs) = builder.config.nodejs { + let mut command = Command::new(nodejs); + command.args(&["src/tools/rustdoc-js/tester.js", &*self.host]); + builder.ensure(::doc::Std { + target: self.target, + stage: builder.top_stage, + }); + builder.run(&mut command); + } else { + println!("No nodejs found, skipping \"src/test/rustdoc-js\" tests"); + } } } -- cgit 1.4.1-3-g733a5