diff options
| author | Ralf Jung <post@ralfj.de> | 2019-02-13 17:18:47 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2019-02-13 18:21:13 +0100 |
| commit | 4c1a1c38305d72fc564f554ae980105d74331108 (patch) | |
| tree | 7ab43d7948f271a773a2f4b979da0539565e8a74 /src/liballoc | |
| parent | b17ca0107755f60a1760f1dca17240cd70d15c5f (diff) | |
| download | rust-4c1a1c38305d72fc564f554ae980105d74331108.tar.gz rust-4c1a1c38305d72fc564f554ae980105d74331108.zip | |
review failures in btree, string
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/tests/btree/map.rs | 28 | ||||
| -rw-r--r-- | src/liballoc/tests/btree/mod.rs | 2 | ||||
| -rw-r--r-- | src/liballoc/tests/string.rs | 13 | ||||
| -rw-r--r-- | src/liballoc/tests/vec_deque.rs | 4 |
4 files changed, 42 insertions, 5 deletions
diff --git a/src/liballoc/tests/btree/map.rs b/src/liballoc/tests/btree/map.rs index aaf50407328..a92e7479048 100644 --- a/src/liballoc/tests/btree/map.rs +++ b/src/liballoc/tests/btree/map.rs @@ -7,6 +7,7 @@ use std::iter::FromIterator; use super::DeterministicRng; #[test] +#[cfg(not(miri))] // Miri is too slow fn test_basic_large() { let mut map = BTreeMap::new(); let size = 10000; @@ -69,7 +70,10 @@ fn test_basic_small() { #[test] fn test_iter() { + #[cfg(not(miri))] // Miri is too slow let size = 10000; + #[cfg(miri)] + let size = 100; // Forwards let mut map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect(); @@ -91,7 +95,10 @@ fn test_iter() { #[test] fn test_iter_rev() { + #[cfg(not(miri))] // Miri is too slow let size = 10000; + #[cfg(miri)] + let size = 100; // Forwards let mut map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect(); @@ -127,7 +134,10 @@ fn test_values_mut() { #[test] fn test_iter_mixed() { + #[cfg(not(miri))] // Miri is too slow let size = 10000; + #[cfg(miri)] + let size = 100; // Forwards let mut map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect(); @@ -214,6 +224,7 @@ fn test_range_equal_empty_cases() { #[test] #[should_panic] +#[cfg(not(miri))] // Miri does not support panics fn test_range_equal_excluded() { let map: BTreeMap<_, _> = (0..5).map(|i| (i, i)).collect(); map.range((Excluded(2), Excluded(2))); @@ -221,6 +232,7 @@ fn test_range_equal_excluded() { #[test] #[should_panic] +#[cfg(not(miri))] // Miri does not support panics fn test_range_backwards_1() { let map: BTreeMap<_, _> = (0..5).map(|i| (i, i)).collect(); map.range((Included(3), Included(2))); @@ -228,6 +240,7 @@ fn test_range_backwards_1() { #[test] #[should_panic] +#[cfg(not(miri))] // Miri does not support panics fn test_range_backwards_2() { let map: BTreeMap<_, _> = (0..5).map(|i| (i, i)).collect(); map.range((Included(3), Excluded(2))); @@ -235,6 +248,7 @@ fn test_range_backwards_2() { #[test] #[should_panic] +#[cfg(not(miri))] // Miri does not support panics fn test_range_backwards_3() { let map: BTreeMap<_, _> = (0..5).map(|i| (i, i)).collect(); map.range((Excluded(3), Included(2))); @@ -242,6 +256,7 @@ fn test_range_backwards_3() { #[test] #[should_panic] +#[cfg(not(miri))] // Miri does not support panics fn test_range_backwards_4() { let map: BTreeMap<_, _> = (0..5).map(|i| (i, i)).collect(); map.range((Excluded(3), Excluded(2))); @@ -249,7 +264,10 @@ fn test_range_backwards_4() { #[test] fn test_range_1000() { + #[cfg(not(miri))] // Miri is too slow let size = 1000; + #[cfg(miri)] + let size = 100; let map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect(); fn test(map: &BTreeMap<u32, u32>, size: u32, min: Bound<&u32>, max: Bound<&u32>) { @@ -286,7 +304,10 @@ fn test_range_borrowed_key() { #[test] fn test_range() { + #[cfg(not(miri))] // Miri is too slow let size = 200; + #[cfg(miri)] + let size = 20; let map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect(); for i in 0..size { @@ -305,7 +326,10 @@ fn test_range() { #[test] fn test_range_mut() { + #[cfg(not(miri))] // Miri is too slow let size = 200; + #[cfg(miri)] + let size = 20; let mut map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect(); for i in 0..size { @@ -479,7 +503,10 @@ fn test_bad_zst() { #[test] fn test_clone() { let mut map = BTreeMap::new(); + #[cfg(not(miri))] // Miri is too slow let size = 100; + #[cfg(miri)] + let size = 20; assert_eq!(map.len(), 0); for i in 0..size { @@ -631,6 +658,7 @@ create_append_test!(test_append_145, 145); create_append_test!(test_append_170, 170); create_append_test!(test_append_181, 181); create_append_test!(test_append_239, 239); +#[cfg(not(miri))] // Miri is too slow create_append_test!(test_append_1700, 1700); fn rand_data(len: usize) -> Vec<(u32, u32)> { diff --git a/src/liballoc/tests/btree/mod.rs b/src/liballoc/tests/btree/mod.rs index 653b3f5bcb4..4c704d0f8c2 100644 --- a/src/liballoc/tests/btree/mod.rs +++ b/src/liballoc/tests/btree/mod.rs @@ -1,5 +1,3 @@ -#![cfg(not(miri))] - mod map; mod set; diff --git a/src/liballoc/tests/string.rs b/src/liballoc/tests/string.rs index e6ca54c4088..7e93d84fe3b 100644 --- a/src/liballoc/tests/string.rs +++ b/src/liballoc/tests/string.rs @@ -1,5 +1,3 @@ -#![cfg(not(miri))] - use std::borrow::Cow; use std::collections::CollectionAllocErr::*; use std::mem::size_of; @@ -233,6 +231,7 @@ fn test_split_off_empty() { #[test] #[should_panic] +#[cfg(not(miri))] // Miri does not support panics fn test_split_off_past_end() { let orig = "Hello, world!"; let mut split = String::from(orig); @@ -241,6 +240,7 @@ fn test_split_off_past_end() { #[test] #[should_panic] +#[cfg(not(miri))] // Miri does not support panics fn test_split_off_mid_char() { let mut orig = String::from("山"); orig.split_off(1); @@ -289,6 +289,7 @@ fn test_str_truncate_invalid_len() { #[test] #[should_panic] +#[cfg(not(miri))] // Miri does not support panics fn test_str_truncate_split_codepoint() { let mut s = String::from("\u{FC}"); // ü s.truncate(1); @@ -323,6 +324,7 @@ fn remove() { #[test] #[should_panic] +#[cfg(not(miri))] // Miri does not support panics fn remove_bad() { "ศ".to_string().remove(1); } @@ -358,11 +360,13 @@ fn insert() { #[test] #[should_panic] +#[cfg(not(miri))] // Miri does not support panics fn insert_bad1() { "".to_string().insert(1, 't'); } #[test] #[should_panic] +#[cfg(not(miri))] // Miri does not support panics fn insert_bad2() { "ệ".to_string().insert(1, 't'); } @@ -443,6 +447,7 @@ fn test_replace_range() { #[test] #[should_panic] +#[cfg(not(miri))] // Miri does not support panics fn test_replace_range_char_boundary() { let mut s = "Hello, 世界!".to_owned(); s.replace_range(..8, ""); @@ -459,6 +464,7 @@ fn test_replace_range_inclusive_range() { #[test] #[should_panic] +#[cfg(not(miri))] // Miri does not support panics fn test_replace_range_out_of_bounds() { let mut s = String::from("12345"); s.replace_range(5..6, "789"); @@ -466,6 +472,7 @@ fn test_replace_range_out_of_bounds() { #[test] #[should_panic] +#[cfg(not(miri))] // Miri does not support panics fn test_replace_range_inclusive_out_of_bounds() { let mut s = String::from("12345"); s.replace_range(5..=5, "789"); @@ -525,6 +532,7 @@ fn test_reserve_exact() { } #[test] +#[cfg(not(miri))] // Miri does not support signalling OOM fn test_try_reserve() { // These are the interesting cases: @@ -602,6 +610,7 @@ fn test_try_reserve() { } #[test] +#[cfg(not(miri))] // Miri does not support signalling OOM fn test_try_reserve_exact() { // This is exactly the same as test_try_reserve with the method changed. diff --git a/src/liballoc/tests/vec_deque.rs b/src/liballoc/tests/vec_deque.rs index d3439fed3cf..e0cb0e7a9e7 100644 --- a/src/liballoc/tests/vec_deque.rs +++ b/src/liballoc/tests/vec_deque.rs @@ -921,7 +921,6 @@ fn test_append() { } #[test] -#[cfg(not(miri))] // Miri is too slow fn test_append_permutations() { fn construct_vec_deque( push_back: usize, @@ -945,7 +944,10 @@ fn test_append_permutations() { out } + #[cfg(not(miri))] // Miri is too slow const MAX: usize = 5; + #[cfg(miri)] + const MAX: usize = 3; // Many different permutations of both the `VecDeque` getting appended to // and the one getting appended are generated to check `append`. |
