diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2016-04-29 14:23:15 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2016-05-12 08:52:20 -0700 |
| commit | bb9062a2967a5b772788aa14f742d8927ac040ba (patch) | |
| tree | 26600100ee45d6ec7c95f4961954f8b8d4f6bd89 /src/bootstrap/rustdoc.rs | |
| parent | 8d65591cf249a64bffa14ed49cb196af4eabac3c (diff) | |
| download | rust-bb9062a2967a5b772788aa14f742d8927ac040ba.tar.gz rust-bb9062a2967a5b772788aa14f742d8927ac040ba.zip | |
rustbuild: Add support for crate tests + doctests
This commit adds support to rustbuild to run crate unit tests (those defined by `#[test]`) as well as documentation tests. All tests are powered by `cargo test` under the hood. Each step requires the `libtest` library is built for that corresponding stage. Ideally the `test` crate would be a dev-dependency, but for now it's just easier to ensure that we sequence everything in the right order. Currently no filtering is implemented, so there's not actually a method of testing *only* libstd or *only* libcore, but rather entire swaths of crates are tested all at once. A few points of note here are: * The `coretest` and `collectionstest` crates are just listed as `[[test]]` entires for `cargo test` to naturally pick up. This mean that `cargo test -p core` actually runs all the tests for libcore. * Libraries that aren't tested all mention `test = false` in their `Cargo.toml` * Crates aren't currently allowed to have dev-dependencies due to rust-lang/cargo#860, but we can likely alleviate this restriction once workspaces are implemented. cc #31590
Diffstat (limited to 'src/bootstrap/rustdoc.rs')
| -rw-r--r-- | src/bootstrap/rustdoc.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/bootstrap/rustdoc.rs b/src/bootstrap/rustdoc.rs index 8c618196113..88ac26d32f6 100644 --- a/src/bootstrap/rustdoc.rs +++ b/src/bootstrap/rustdoc.rs @@ -12,17 +12,25 @@ //! //! See comments in `src/bootstrap/rustc.rs` for more information. +extern crate bootstrap; + use std::env; use std::process::Command; +use std::path::PathBuf; fn main() { let args = env::args_os().skip(1).collect::<Vec<_>>(); let rustdoc = env::var_os("RUSTDOC_REAL").unwrap(); + let libdir = env::var_os("RUSTC_LIBDIR").unwrap(); + + let mut dylib_path = bootstrap::dylib_path(); + dylib_path.insert(0, PathBuf::from(libdir)); let mut cmd = Command::new(rustdoc); cmd.args(&args) .arg("--cfg").arg(format!("stage{}", env::var("RUSTC_STAGE").unwrap())) - .arg("--cfg").arg("dox"); + .arg("--cfg").arg("dox") + .env(bootstrap::dylib_path_var(), env::join_paths(&dylib_path).unwrap()); std::process::exit(match cmd.status() { Ok(s) => s.code().unwrap_or(1), Err(e) => panic!("\n\nfailed to run {:?}: {}\n\n", cmd, e), |
