Skip to content

Commit 8c71820

Browse files
committed
smoketest that libtest doesn't panic in #[bench]
1 parent b56cb9e commit 8c71820

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
include ../../run-make-fulldeps/tools.mk
2+
3+
all:
4+
# Smoke-test that `#[bench]` isn't entirely broken.
5+
$(RUSTC) --test smokebench.rs -O
6+
$(call RUN,smokebench --bench)
7+
$(call RUN,smokebench --bench noiter)
8+
$(call RUN,smokebench --bench yesiter)
9+
$(call RUN,smokebench)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![feature(test)]
2+
extern crate test;
3+
4+
#[bench]
5+
fn smoke_yesiter(b: &mut test::Bencher) {
6+
let mut i = 0usize;
7+
b.iter(|| {
8+
i = i.wrapping_add(1);
9+
i
10+
})
11+
}
12+
13+
#[bench]
14+
fn smoke_noiter(_: &mut test::Bencher) {}

0 commit comments

Comments
 (0)