diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2017-07-01 06:58:54 +1200 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2017-07-17 17:21:46 +1200 |
| commit | 04415dc64c5af86957b4e3b45e124108c93263c4 (patch) | |
| tree | 668748ab97a6e7c32d6a45583e81daf9694bac7e /src/bootstrap | |
| parent | 25797938b0300232b1ac575b9a4cd670e9a6df3a (diff) | |
| download | rust-04415dc64c5af86957b4e3b45e124108c93263c4.tar.gz rust-04415dc64c5af86957b4e3b45e124108c93263c4.zip | |
Run RLS tests
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/check.rs | 36 | ||||
| -rw-r--r-- | src/bootstrap/mk/Makefile.in | 3 | ||||
| -rw-r--r-- | src/bootstrap/step.rs | 6 |
3 files changed, 34 insertions, 11 deletions
diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 371512908a0..e4b0e2fb9ca 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -15,6 +15,7 @@ use std::collections::HashSet; use std::env; +use std::ffi::OsString; use std::iter; use std::fmt; use std::fs::{self, File}; @@ -117,14 +118,7 @@ pub fn cargotest(build: &Build, stage: u32, host: &str) { /// Runs `cargo test` for `cargo` packaged with Rust. pub fn cargo(build: &Build, stage: u32, host: &str) { - let ref compiler = Compiler::new(stage, host); - - // Configure PATH to find the right rustc. NB. we have to use PATH - // and not RUSTC because the Cargo test suite has tests that will - // fail if rustc is not spelled `rustc`. - let path = build.sysroot(compiler).join("bin"); - let old_path = env::var_os("PATH").unwrap_or_default(); - let newpath = env::join_paths(iter::once(path).chain(env::split_paths(&old_path))).expect(""); + let compiler = &Compiler::new(stage, host); let mut cargo = build.cargo(compiler, Mode::Tool, host, "test"); cargo.arg("--manifest-path").arg(build.src.join("src/tools/cargo/Cargo.toml")); @@ -139,7 +133,31 @@ pub fn cargo(build: &Build, stage: u32, host: &str) { // available. cargo.env("CFG_DISABLE_CROSS_TESTS", "1"); - try_run(build, cargo.env("PATH", newpath)); + try_run(build, cargo.env("PATH", &path_for_cargo(build, compiler))); +} + +/// Runs `cargo test` for the rls. +pub fn rls(build: &Build, stage: u32, host: &str) { + let compiler = &Compiler::new(stage, host); + + let mut cargo = build.cargo(compiler, Mode::Tool, host, "test"); + cargo.arg("--manifest-path").arg(build.src.join("src/tools/rls/Cargo.toml")); + + // Don't build tests dynamically, just a pain to work with + cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1"); + + build.add_rustc_lib_path(compiler, &mut cargo); + + try_run(build, &mut cargo); +} + +fn path_for_cargo(build: &Build, compiler: &Compiler) -> OsString { + // Configure PATH to find the right rustc. NB. we have to use PATH + // and not RUSTC because the Cargo test suite has tests that will + // fail if rustc is not spelled `rustc`. + let path = build.sysroot(compiler).join("bin"); + let old_path = env::var_os("PATH").unwrap_or_default(); + env::join_paths(iter::once(path).chain(env::split_paths(&old_path))).expect("") } /// Runs the `tidy` tool as compiled in `stage` by the `host` compiler. diff --git a/src/bootstrap/mk/Makefile.in b/src/bootstrap/mk/Makefile.in index 47c792a510b..ad0ee8d47d6 100644 --- a/src/bootstrap/mk/Makefile.in +++ b/src/bootstrap/mk/Makefile.in @@ -55,7 +55,8 @@ check: check-aux: $(Q)$(BOOTSTRAP) test \ src/tools/cargotest \ - cargo \ + src/tools/cargo \ + src/tools/rls \ src/test/pretty \ src/test/run-pass/pretty \ src/test/run-fail/pretty \ diff --git a/src/bootstrap/step.rs b/src/bootstrap/step.rs index 5a1ef818ccf..a1b26f44b7d 100644 --- a/src/bootstrap/step.rs +++ b/src/bootstrap/step.rs @@ -472,10 +472,14 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules { .dep(|s| s.name("librustc")) .host(true) .run(move |s| check::cargotest(build, s.stage, s.target)); - rules.test("check-cargo", "cargo") + rules.test("check-cargo", "src/tools/cargo") .dep(|s| s.name("tool-cargo")) .host(true) .run(move |s| check::cargo(build, s.stage, s.target)); + rules.test("check-rls", "src/tools/rls") + .dep(|s| s.name("tool-rls")) + .host(true) + .run(move |s| check::rls(build, s.stage, s.target)); rules.test("check-tidy", "src/tools/tidy") .dep(|s| s.name("tool-tidy").stage(0)) .default(true) |
