diff options
| author | bors <bors@rust-lang.org> | 2015-05-03 14:06:08 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-05-03 14:06:08 +0000 |
| commit | 26933a638c360442412b51aa70fe25e419f44314 (patch) | |
| tree | 8936c357d5a2c74e3c5c53f8a62b0d575b094b92 /src/libstd/sys/unix/stack_overflow.rs | |
| parent | 07915ef6a1426952ba612c02ecafad003bf971a3 (diff) | |
| parent | d73545ceca711f88e3e79120c77fa83c2a1994e7 (diff) | |
| download | rust-26933a638c360442412b51aa70fe25e419f44314.tar.gz rust-26933a638c360442412b51aa70fe25e419f44314.zip | |
Auto merge of #25048 - huonw:test-benches, r=alexcrichton
E.g. if `foo.rs` looks like
#![feature(test)]
extern crate test;
#[bench]
fn bar(b: &mut test::Bencher) {
b.iter(|| {
1
})
}
#[test]
fn baz() {}
#[bench]
fn qux(b: &mut test::Bencher) {
b.iter(|| {
panic!()
})
}
Then
$ rustc --test foo.rs
$ ./foo
running 3 tests
test baz ... ok
test qux ... FAILED
test bar ... ok
failures:
---- qux stdout ----
thread 'qux' panicked at 'explicit panic', bench.rs:17
failures:
qux
test result: FAILED. 2 passed; 1 failed; 0 ignored; 0 measured
$ ./foo --bench ba
running 2 tests
test baz ... ignored
test bar ... bench: 97 ns/iter (+/- 74)
test result: ok. 0 passed; 0 failed; 1 ignored; 1 measured
In particular, the two benchmark are being run as tests in the default
mode.
This helps for the main distribution, since benchmarks are only run with
`PLEASE_BENCH=1`, which is rarely set (and never set on the test bots),
and helps for code-coverage tools: benchmarks are run and so don't count
as dead code.
Fixes #15842.
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions
