diff options
| author | bors <bors@rust-lang.org> | 2022-10-31 18:50:06 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-10-31 18:50:06 +0000 |
| commit | 95a3a7277b44bbd2dd3485703d9a05f64652b60e (patch) | |
| tree | d025a9dd44178f689ba492b9a0e53c30418c5769 /src | |
| parent | 2afca78a0b03db144c5d8b9f8868feebfe096309 (diff) | |
| parent | bf88755f8892c1e42eccd302ed5b17716f669975 (diff) | |
| download | rust-95a3a7277b44bbd2dd3485703d9a05f64652b60e.tar.gz rust-95a3a7277b44bbd2dd3485703d9a05f64652b60e.zip | |
Auto merge of #103795 - thomcc:untest, r=Mark-Simulacrum
Include both benchmarks and tests in the numbers given to `TeFiltered{,Out}`
Fixes #103794
`#[bench]` is broken on nightly without this, sadly. It apparently has no test coverage. In addition to manually testing, I've added a run-make smokecheck for this (which would have caught the issue), but it would be nice to have a better way to test, err, libtest. For now we should get this in ASAP IMO
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/run-make/test-benches/Makefile | 11 | ||||
| -rw-r--r-- | src/test/run-make/test-benches/smokebench.rs | 14 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/test/run-make/test-benches/Makefile b/src/test/run-make/test-benches/Makefile new file mode 100644 index 00000000000..8fc122515d0 --- /dev/null +++ b/src/test/run-make/test-benches/Makefile @@ -0,0 +1,11 @@ +include ../../run-make-fulldeps/tools.mk + +# ignore-cross-compile + +all: + # Smoke-test that `#[bench]` isn't entirely broken. + $(RUSTC) --test smokebench.rs -O + $(call RUN,smokebench --bench) + $(call RUN,smokebench --bench noiter) + $(call RUN,smokebench --bench yesiter) + $(call RUN,smokebench) diff --git a/src/test/run-make/test-benches/smokebench.rs b/src/test/run-make/test-benches/smokebench.rs new file mode 100644 index 00000000000..ef5e5a62068 --- /dev/null +++ b/src/test/run-make/test-benches/smokebench.rs @@ -0,0 +1,14 @@ +#![feature(test)] +extern crate test; + +#[bench] +fn smoke_yesiter(b: &mut test::Bencher) { + let mut i = 0usize; + b.iter(|| { + i = i.wrapping_add(1); + i + }) +} + +#[bench] +fn smoke_noiter(_: &mut test::Bencher) {} |
