Skip to content

Commit

Permalink
bench command supports --no-fail-fast flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
fa7ca7 committed Jul 4, 2017
1 parent eb6cf01 commit 63e5c17
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/bin/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub struct Options {
flag_tests: bool,
flag_bench: Vec<String>,
flag_benches: bool,
flag_no_fail_fast: bool,
flag_frozen: bool,
flag_locked: bool,
arg_args: Vec<String>,
Expand Down Expand Up @@ -64,6 +65,7 @@ Options:
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
--message-format FMT Error format: human, json [default: human]
--no-fail-fast Run all benchmarks regardless of failure
--frozen Require Cargo.lock and cache are up to date
--locked Require Cargo.lock is up to date
Expand Down Expand Up @@ -99,7 +101,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult {
options.flag_locked)?;
let ops = ops::TestOptions {
no_run: options.flag_no_run,
no_fail_fast: false,
no_fail_fast: options.flag_no_fail_fast,
only_doc: false,
compile_opts: ops::CompileOptions {
config: config,
Expand Down
38 changes: 38 additions & 0 deletions tests/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,44 @@ fn test_bench_no_run() {
"));
}

#[test]
fn test_bench_no_fail_fast() {
if !is_nightly() { return }

let p = project("foo")
.file("Cargo.toml", &basic_bin_manifest("foo"))
.file("src/foo.rs", r#"
#![feature(test)]
extern crate test;
fn hello() -> &'static str {
"hello"
}
pub fn main() {
println!("{}", hello())
}
#[bench]
fn bench_hello(_b: &mut test::Bencher) {
assert_eq!(hello(), "hello")
}
#[bench]
fn bench_nope(_b: &mut test::Bencher) {
assert_eq!("nope", hello())
}"#);

assert_that(p.cargo_process("bench").arg("--no-fail-fast"),
execs().with_status(101)
.with_stderr_contains("\
[RUNNING] target[/]release[/]deps[/]foo-[..][EXE]")
.with_stdout_contains("running 2 tests")
.with_stderr_contains("\
[RUNNING] target[/]release[/]deps[/]foo-[..][EXE]")
.with_stdout_contains("test bench_hello [..]")
.with_stdout_contains("test bench_nope [..]"));
}

#[test]
fn test_bench_multiple_packages() {
if !is_nightly() { return }
Expand Down

0 comments on commit 63e5c17

Please sign in to comment.