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;
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.
.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")
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)));
}
use getopts::Options;
-use Build;
+use {Build, DocTestsOption};
use config::Config;
use metadata;
use builder::Builder;
test_args: Vec<String>,
rustc_args: Vec<String>,
fail_fast: bool,
- doc_tests: bool,
+ doc_tests: DocTestsOption,
},
Bench {
paths: Vec<PathBuf>,
"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"); },
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" => {
}
}
- pub fn doc_tests(&self) -> bool {
+ pub fn doc_tests(&self) -> DocTestsOption {
match *self {
Subcommand::Test { doc_tests, .. } => doc_tests,
- _ => false,
+ _ => DocTestsOption::Yes,
}
}
}
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.
rustfmt_info: channel::GitInfo,
local_rebuild: bool,
fail_fast: bool,
- doc_tests: bool,
+ doc_tests: DocTestsOption,
verbosity: usize,
// Targets for which to build.
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";
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);