Skip to content

Commit 7ba1232

Browse files
committed
libcore: ignore tests in Miri instead of removing them entirely
1 parent 0a953cd commit 7ba1232

File tree

6 files changed

+11
-13
lines changed

6 files changed

+11
-13
lines changed

src/libcore/tests/num/dec2flt/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn large() {
5353
}
5454

5555
#[test]
56-
#[cfg(not(miri))] // Miri is too slow
56+
#[cfg_attr(miri, ignore)] // Miri is too slow
5757
fn subnormals() {
5858
test_literal!(5e-324);
5959
test_literal!(91e-324);
@@ -65,7 +65,7 @@ fn subnormals() {
6565
}
6666

6767
#[test]
68-
#[cfg(not(miri))] // Miri is too slow
68+
#[cfg_attr(miri, ignore)] // Miri is too slow
6969
fn infinity() {
7070
test_literal!(1e400);
7171
test_literal!(1e309);

src/libcore/tests/num/flt2dec/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ pub fn f32_shortest_sanity_test<F>(mut f: F) where F: FnMut(&Decoded, &mut [u8])
256256
check_shortest!(f(minf32) => b"1", -44);
257257
}
258258

259-
#[cfg(not(miri))] // Miri is too slow
260259
pub fn f32_exact_sanity_test<F>(mut f: F)
261260
where F: FnMut(&Decoded, &mut [u8], i16) -> (usize, i16) {
262261
let minf32 = ldexp_f32(1.0, -149);
@@ -362,7 +361,6 @@ pub fn f64_shortest_sanity_test<F>(mut f: F) where F: FnMut(&Decoded, &mut [u8])
362361
check_shortest!(f(minf64) => b"5", -323);
363362
}
364363

365-
#[cfg(not(miri))] // Miri is too slow
366364
pub fn f64_exact_sanity_test<F>(mut f: F)
367365
where F: FnMut(&Decoded, &mut [u8], i16) -> (usize, i16) {
368366
let minf64 = ldexp_f64(1.0, -1074);

src/libcore/tests/num/flt2dec/strategy/dragon.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn shortest_sanity_test() {
2222
}
2323

2424
#[test]
25-
#[cfg(not(miri))] // Miri is too slow
25+
#[cfg_attr(miri, ignore)] // Miri is too slow
2626
fn exact_sanity_test() {
2727
// This test ends up running what I can only assume is some corner-ish case
2828
// of the `exp2` library function, defined in whatever C runtime we're

src/libcore/tests/num/flt2dec/strategy/grisu.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn shortest_sanity_test() {
3636
}
3737

3838
#[test]
39-
#[cfg(not(miri))] // Miri is too slow
39+
#[cfg_attr(miri, ignore)] // Miri is too slow
4040
fn exact_sanity_test() {
4141
// See comments in dragon.rs's exact_sanity_test for why this test is
4242
// ignored on MSVC

src/libcore/tests/ptr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ fn write_unaligned_drop() {
291291
}
292292

293293
#[test]
294-
#[cfg(not(miri))] // Miri does not compute a maximal `mid` for `align_offset`
294+
#[cfg_attr(miri, ignore)] // Miri does not compute a maximal `mid` for `align_offset`
295295
fn align_offset_zst() {
296296
// For pointers of stride = 0, the pointer is already aligned or it cannot be aligned at
297297
// all, because no amount of elements will align the pointer.
@@ -306,7 +306,7 @@ fn align_offset_zst() {
306306
}
307307

308308
#[test]
309-
#[cfg(not(miri))] // Miri does not compute a maximal `mid` for `align_offset`
309+
#[cfg_attr(miri, ignore)] // Miri does not compute a maximal `mid` for `align_offset`
310310
fn align_offset_stride1() {
311311
// For pointers of stride = 1, the pointer can always be aligned. The offset is equal to
312312
// number of bytes.
@@ -323,7 +323,7 @@ fn align_offset_stride1() {
323323
}
324324

325325
#[test]
326-
#[cfg(not(miri))] // Miri is too slow
326+
#[cfg_attr(miri, ignore)] // Miri is too slow
327327
fn align_offset_weird_strides() {
328328
#[repr(packed)]
329329
struct A3(u16, u8);

src/libcore/tests/slice.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,7 @@ fn test_rotate_right() {
11721172
}
11731173

11741174
#[test]
1175-
#[cfg(not(miri))] // Miri is too slow
1175+
#[cfg_attr(miri, ignore)] // Miri is too slow
11761176
fn brute_force_rotate_test_0() {
11771177
// In case of edge cases involving multiple algorithms
11781178
let n = 300;
@@ -1291,7 +1291,7 @@ fn sort_unstable() {
12911291

12921292
#[test]
12931293
#[cfg(not(target_arch = "wasm32"))]
1294-
#[cfg(not(miri))] // Miri is too slow
1294+
#[cfg_attr(miri, ignore)] // Miri is too slow
12951295
fn partition_at_index() {
12961296
use core::cmp::Ordering::{Equal, Greater, Less};
12971297
use rand::rngs::StdRng;
@@ -1494,7 +1494,7 @@ pub mod memchr {
14941494
}
14951495

14961496
#[test]
1497-
#[cfg(not(miri))] // Miri does not compute a maximal `mid` for `align_offset`
1497+
#[cfg_attr(miri, ignore)] // Miri does not compute a maximal `mid` for `align_offset`
14981498
fn test_align_to_simple() {
14991499
let bytes = [1u8, 2, 3, 4, 5, 6, 7];
15001500
let (prefix, aligned, suffix) = unsafe { bytes.align_to::<u16>() };
@@ -1518,7 +1518,7 @@ fn test_align_to_zst() {
15181518
}
15191519

15201520
#[test]
1521-
#[cfg(not(miri))] // Miri does not compute a maximal `mid` for `align_offset`
1521+
#[cfg_attr(miri, ignore)] // Miri does not compute a maximal `mid` for `align_offset`
15221522
fn test_align_to_non_trivial() {
15231523
#[repr(align(8))] struct U64(u64, u64);
15241524
#[repr(align(8))] struct U64U64U32(u64, u64, u32);

0 commit comments

Comments
 (0)