1
Fork 0

Teach rustdoc --test about --sysroot, pass it when testing rust

This permits rustdoc tests to work in stage0
This commit is contained in:
Aidan Hobson Sayers 2016-12-24 16:04:48 +00:00
parent 17d873c2db
commit babb7daf35
5 changed files with 26 additions and 14 deletions

View file

@ -144,7 +144,7 @@ pub fn render(input: &str, mut output: PathBuf, matches: &getopts::Matches,
/// Run any tests/code examples in the markdown file `input`.
pub fn test(input: &str, cfgs: Vec<String>, libs: SearchPaths, externs: Externs,
mut test_args: Vec<String>) -> isize {
mut test_args: Vec<String>, maybe_sysroot: Option<PathBuf>) -> isize {
let input_str = match load_string(input) {
Ok(s) => s,
Err(LoadStringError::ReadFail) => return 1,
@ -154,7 +154,7 @@ pub fn test(input: &str, cfgs: Vec<String>, libs: SearchPaths, externs: Externs,
let mut opts = TestOptions::default();
opts.no_crate_inject = true;
let mut collector = Collector::new(input.to_string(), cfgs, libs, externs,
true, opts);
true, opts, maybe_sysroot);
find_testable_code(&input_str, &mut collector);
test_args.insert(0, "rustdoctest".to_string());
testing::test_main(&test_args, collector.tests);