Store positive instead of negative fail_fast.

This makes later negation much easier to interpret.
This commit is contained in:
Mark Simulacrum 2017-06-27 13:37:24 -06:00
parent 712bd0d841
commit 4dc8fe9083
3 changed files with 11 additions and 10 deletions

View File

@ -59,7 +59,7 @@ impl fmt::Display for TestKind {
}
fn try_run(build: &Build, cmd: &mut Command) {
if build.flags.cmd.no_fail_fast() {
if !build.fail_fast {
if !build.try_run(cmd) {
let failures = build.delayed_failures.get();
build.delayed_failures.set(failures + 1);
@ -70,7 +70,7 @@ fn try_run(build: &Build, cmd: &mut Command) {
}
fn try_run_quiet(build: &Build, cmd: &mut Command) {
if build.flags.cmd.no_fail_fast() {
if !build.fail_fast {
if !build.try_run_quiet(cmd) {
let failures = build.delayed_failures.get();
build.delayed_failures.set(failures + 1);
@ -128,7 +128,7 @@ pub fn cargo(build: &Build, stage: u32, host: &str) {
let mut cargo = build.cargo(compiler, Mode::Tool, host, "test");
cargo.arg("--manifest-path").arg(build.src.join("src/tools/cargo/Cargo.toml"));
if build.flags.cmd.no_fail_fast() {
if !build.fail_fast {
cargo.arg("--no-fail-fast");
}
@ -448,7 +448,7 @@ pub fn krate(build: &Build,
cargo.arg("--manifest-path")
.arg(build.src.join(path).join("Cargo.toml"))
.arg("--features").arg(features);
if test_kind.subcommand() == "test" && build.flags.cmd.no_fail_fast() {
if test_kind.subcommand() == "test" && !build.fail_fast {
cargo.arg("--no-fail-fast");
}
@ -669,7 +669,7 @@ pub fn bootstrap(build: &Build) {
.env("CARGO_TARGET_DIR", build.out.join("bootstrap"))
.env("RUSTC_BOOTSTRAP", "1")
.env("RUSTC", &build.initial_rustc);
if build.flags.cmd.no_fail_fast() {
if !build.fail_fast {
cmd.arg("--no-fail-fast");
}
cmd.arg("--").args(&build.flags.cmd.test_args());

View File

@ -61,7 +61,7 @@ pub enum Subcommand {
Test {
paths: Vec<PathBuf>,
test_args: Vec<String>,
no_fail_fast: bool,
fail_fast: bool,
},
Bench {
paths: Vec<PathBuf>,
@ -278,7 +278,7 @@ Arguments:
Subcommand::Test {
paths: paths,
test_args: matches.opt_strs("test-args"),
no_fail_fast: matches.opt_present("no-fail-fast"),
fail_fast: !matches.opt_present("no-fail-fast"),
}
}
"bench" => {
@ -354,9 +354,9 @@ impl Subcommand {
}
}
pub fn no_fail_fast(&self) -> bool {
pub fn fail_fast(&self) -> bool {
match *self {
Subcommand::Test { no_fail_fast, .. } => no_fail_fast,
Subcommand::Test { fail_fast, .. } => fail_fast,
_ => false,
}
}

View File

@ -167,6 +167,7 @@ pub struct Build {
cargo_info: channel::GitInfo,
rls_info: channel::GitInfo,
local_rebuild: bool,
fail_fast: bool,
// Stage 0 (downloaded) compiler and cargo or their local rust equivalents.
initial_rustc: PathBuf,
@ -240,12 +241,12 @@ impl Build {
let rust_info = channel::GitInfo::new(&src);
let cargo_info = channel::GitInfo::new(&src.join("src/tools/cargo"));
let rls_info = channel::GitInfo::new(&src.join("src/tools/rls"));
let src_is_git = src.join(".git").exists();
Build {
initial_rustc: config.initial_rustc.clone(),
initial_cargo: config.initial_cargo.clone(),
local_rebuild: config.local_rebuild,
fail_fast: flags.cmd.fail_fast(),
flags: flags,
config: config,