Skip to content

Commit 878cc93

Browse files
Rollup merge of #153722 - RalfJung:miri-test-benches, r=Kobzol
miri-test-libstd: use --tests and update some comments #153143 added `./x test --tests` matching `cargo --tests`, which is exactly what Miri wants when testing the standard library. So let's use it for that. We can then also remove a hack in `library/alloctests/benches/vec_deque_append.rs`. Also update the comment for why the other benchmarks still need to be disabled in Miri, and remove some `cfg_attr` that seem unnecessary since the entire crate that contains them is already disabled in Miri. Those were copied over in b8fa843 -- they used to be needed since benches and tests were in the same crate, but they aren't any more.
2 parents e014ac8 + bc4dfa5 commit 878cc93

File tree

6 files changed

+4
-14
lines changed

6 files changed

+4
-14
lines changed

library/alloctests/benches/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Disabling in Miri as these would take too long.
1+
// This is marked as `test = true` and hence picked up by `./x miri`, but that would be too slow.
22
#![cfg(not(miri))]
33
#![feature(iter_next_chunk)]
44
#![feature(repr_simd)]

library/alloctests/benches/vec_deque_append.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ const WARMUP_N: usize = 100;
66
const BENCH_N: usize = 1000;
77

88
fn main() {
9-
if cfg!(miri) {
10-
// Don't benchmark Miri...
11-
// (Due to bootstrap quirks, this gets picked up by `x.py miri library/alloc --all-targets`.)
12-
return;
13-
}
149
let a: VecDeque<i32> = (0..VECDEQUE_LEN).collect();
1510
let b: VecDeque<i32> = (0..VECDEQUE_LEN).collect();
1611

library/coretests/benches/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// wasm32 does not support benches (no time).
22
#![cfg(not(target_arch = "wasm32"))]
3-
// Disabling in Miri as these would take too long.
3+
// This is marked as `test = true` and hence picked up by `./x miri`, but that would be too slow.
44
#![cfg(not(miri))]
55
#![feature(flt2dec)]
66
#![feature(test)]

library/std/benches/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Disabling in Miri as these would take too long.
1+
// This is marked as `test = true` and hence picked up by `./x miri`, but that would be too slow.
22
#![cfg(not(miri))]
33
#![feature(test)]
44

library/std/benches/path.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use std::hash::{DefaultHasher, Hash, Hasher};
44
use std::path::*;
55

66
#[bench]
7-
#[cfg_attr(miri, ignore)] // Miri isn't fast...
87
fn bench_path_cmp_fast_path_buf_sort(b: &mut test::Bencher) {
98
let prefix = "my/home";
109
let mut paths: Vec<_> =
@@ -18,7 +17,6 @@ fn bench_path_cmp_fast_path_buf_sort(b: &mut test::Bencher) {
1817
}
1918

2019
#[bench]
21-
#[cfg_attr(miri, ignore)] // Miri isn't fast...
2220
fn bench_path_cmp_fast_path_long(b: &mut test::Bencher) {
2321
let prefix = "/my/home/is/my/castle/and/my/castle/has/a/rusty/workbench/";
2422
let paths: Vec<_> =
@@ -37,7 +35,6 @@ fn bench_path_cmp_fast_path_long(b: &mut test::Bencher) {
3735
}
3836

3937
#[bench]
40-
#[cfg_attr(miri, ignore)] // Miri isn't fast...
4138
fn bench_path_cmp_fast_path_short(b: &mut test::Bencher) {
4239
let prefix = "my/home";
4340
let paths: Vec<_> =
@@ -80,7 +77,6 @@ fn bench_path_file_name(b: &mut test::Bencher) {
8077
}
8178

8279
#[bench]
83-
#[cfg_attr(miri, ignore)] // Miri isn't fast...
8480
fn bench_path_hashset(b: &mut test::Bencher) {
8581
let prefix = "/my/home/is/my/castle/and/my/castle/has/a/rusty/workbench/";
8682
let paths: Vec<_> =
@@ -99,7 +95,6 @@ fn bench_path_hashset(b: &mut test::Bencher) {
9995
}
10096

10197
#[bench]
102-
#[cfg_attr(miri, ignore)] // Miri isn't fast...
10398
fn bench_path_hashset_miss(b: &mut test::Bencher) {
10499
let prefix = "/my/home/is/my/castle/and/my/castle/has/a/rusty/workbench/";
105100
let paths: Vec<_> =

src/bootstrap/mk/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ check-aux:
6464
library/core \
6565
library/alloc \
6666
$(BOOTSTRAP_ARGS) \
67-
--all-targets
67+
--tests # exclude doc tests
6868
# Some doctests use file system operations to demonstrate dealing with `Result`,
6969
# so we have to run them with isolation disabled.
7070
$(Q)MIRIFLAGS="-Zmiri-disable-isolation" \

0 commit comments

Comments
 (0)