Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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