Added `./x.py test --no-doc` option.
This enables `./x.py test --stage 0 src/libstd --no-doc` and ensures the stage2-rustc and rustdoc need to be built.
This commit is contained in:
parent
fa30ae5c7e
commit
1733f5e1c0
|
@ -25,7 +25,7 @@ use compile;
|
|||
use install;
|
||||
use dist;
|
||||
use util::{exe, libdir, add_lib_path};
|
||||
use {Build, Mode};
|
||||
use {Build, Mode, DocTestsOption};
|
||||
use cache::{INTERNER, Interned, Cache};
|
||||
use check;
|
||||
use test;
|
||||
|
@ -591,6 +591,8 @@ impl<'a> Builder<'a> {
|
|||
format!("{} {}", env::var("RUSTFLAGS").unwrap_or_default(), extra_args));
|
||||
}
|
||||
|
||||
let want_rustdoc = self.doc_tests != DocTestsOption::No;
|
||||
|
||||
// Customize the compiler we're running. Specify the compiler to cargo
|
||||
// as our shim and then pass it some various options used to configure
|
||||
// how the actual compiler itself is called.
|
||||
|
@ -607,7 +609,7 @@ impl<'a> Builder<'a> {
|
|||
.env("RUSTC_LIBDIR", self.rustc_libdir(compiler))
|
||||
.env("RUSTC_RPATH", self.config.rust_rpath.to_string())
|
||||
.env("RUSTDOC", self.out.join("bootstrap/debug/rustdoc"))
|
||||
.env("RUSTDOC_REAL", if cmd == "doc" || cmd == "test" {
|
||||
.env("RUSTDOC_REAL", if cmd == "doc" || (cmd == "test" && want_rustdoc) {
|
||||
self.rustdoc(compiler.host)
|
||||
} else {
|
||||
PathBuf::from("/path/to/nowhere/rustdoc/not/required")
|
||||
|
@ -624,7 +626,7 @@ impl<'a> Builder<'a> {
|
|||
if let Some(ref error_format) = self.config.rustc_error_format {
|
||||
cargo.env("RUSTC_ERROR_FORMAT", error_format);
|
||||
}
|
||||
if cmd != "build" && cmd != "check" {
|
||||
if cmd != "build" && cmd != "check" && want_rustdoc {
|
||||
cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(self.compiler(2, self.config.build)));
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ use std::process;
|
|||
|
||||
use getopts::Options;
|
||||
|
||||
use Build;
|
||||
use {Build, DocTestsOption};
|
||||
use config::Config;
|
||||
use metadata;
|
||||
use builder::Builder;
|
||||
|
@ -62,7 +62,7 @@ pub enum Subcommand {
|
|||
test_args: Vec<String>,
|
||||
rustc_args: Vec<String>,
|
||||
fail_fast: bool,
|
||||
doc_tests: bool,
|
||||
doc_tests: DocTestsOption,
|
||||
},
|
||||
Bench {
|
||||
paths: Vec<PathBuf>,
|
||||
|
@ -171,7 +171,8 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
|
|||
"extra options to pass the compiler when running tests",
|
||||
"ARGS",
|
||||
);
|
||||
opts.optflag("", "doc", "run doc tests");
|
||||
opts.optflag("", "no-doc", "do not run doc tests");
|
||||
opts.optflag("", "doc", "only run doc tests");
|
||||
},
|
||||
"bench" => { opts.optmulti("", "test-args", "extra arguments", "ARGS"); },
|
||||
"clean" => { opts.optflag("", "all", "clean all build artifacts"); },
|
||||
|
@ -324,7 +325,13 @@ Arguments:
|
|||
test_args: matches.opt_strs("test-args"),
|
||||
rustc_args: matches.opt_strs("rustc-args"),
|
||||
fail_fast: !matches.opt_present("no-fail-fast"),
|
||||
doc_tests: matches.opt_present("doc"),
|
||||
doc_tests: if matches.opt_present("doc") {
|
||||
DocTestsOption::Only
|
||||
} else if matches.opt_present("no-doc") {
|
||||
DocTestsOption::No
|
||||
} else {
|
||||
DocTestsOption::Yes
|
||||
}
|
||||
}
|
||||
}
|
||||
"bench" => {
|
||||
|
@ -411,10 +418,10 @@ impl Subcommand {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn doc_tests(&self) -> bool {
|
||||
pub fn doc_tests(&self) -> DocTestsOption {
|
||||
match *self {
|
||||
Subcommand::Test { doc_tests, .. } => doc_tests,
|
||||
_ => false,
|
||||
_ => DocTestsOption::Yes,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,6 +210,16 @@ pub struct Compiler {
|
|||
host: Interned<String>,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
|
||||
pub enum DocTestsOption {
|
||||
// Default, run normal tests and doc tests.
|
||||
Yes,
|
||||
// Do not run any doc tests.
|
||||
No,
|
||||
// Only run doc tests.
|
||||
Only,
|
||||
}
|
||||
|
||||
/// Global configuration for the build system.
|
||||
///
|
||||
/// This structure transitively contains all configuration for the build system.
|
||||
|
@ -233,7 +243,7 @@ pub struct Build {
|
|||
rustfmt_info: channel::GitInfo,
|
||||
local_rebuild: bool,
|
||||
fail_fast: bool,
|
||||
doc_tests: bool,
|
||||
doc_tests: DocTestsOption,
|
||||
verbosity: usize,
|
||||
|
||||
// Targets for which to build.
|
||||
|
|
|
@ -32,7 +32,7 @@ use dist;
|
|||
use native;
|
||||
use tool::{self, Tool};
|
||||
use util::{self, dylib_path, dylib_path_var};
|
||||
use Mode;
|
||||
use {Mode, DocTestsOption};
|
||||
use toolstate::ToolState;
|
||||
|
||||
const ADB_TEST_DIR: &str = "/data/tmp/work";
|
||||
|
@ -1519,8 +1519,14 @@ impl Step for Crate {
|
|||
if test_kind.subcommand() == "test" && !builder.fail_fast {
|
||||
cargo.arg("--no-fail-fast");
|
||||
}
|
||||
if builder.doc_tests {
|
||||
cargo.arg("--doc");
|
||||
match builder.doc_tests {
|
||||
DocTestsOption::Only => {
|
||||
cargo.arg("--doc");
|
||||
}
|
||||
DocTestsOption::No => {
|
||||
cargo.args(&["--lib", "--bins", "--examples", "--tests", "--benches"]);
|
||||
}
|
||||
DocTestsOption::Yes => {}
|
||||
}
|
||||
|
||||
cargo.arg("-p").arg(krate);
|
||||
|
|
Loading…
Reference in New Issue