about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-02-09 00:16:04 +0100
committerGitHub <noreply@github.com>2019-02-09 00:16:04 +0100
commit970864453097c7e1a25c4b960afaca5674eb5f92 (patch)
treec259167e2ba9a73b94a55f660e5819df7b152691 /src/liballoc
parentc3b4102e2fd252f4d087c0f7d3c7c30b907132dc (diff)
parent81613ad7cf9889a59d0a7233af9e462715945a72 (diff)
downloadrust-970864453097c7e1a25c4b960afaca5674eb5f92.tar.gz
rust-970864453097c7e1a25c4b960afaca5674eb5f92.zip
Rollup merge of #58275 - RalfJung:miri-test-libcore, r=Mark-Simulacrum
libcore, liballoc: disable tests in Miri

I am going to run the libcore and liballoc unit test suites in Miri.  Not all tests pass.  This PR disables a whole bunch of tests when running in Miri, to get us to a baseline from which I can investigate failures.

Cc @SimonSapin @alexcrichton
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/tests/arc.rs2
-rw-r--r--src/liballoc/tests/binary_heap.rs1
-rw-r--r--src/liballoc/tests/btree/mod.rs2
-rw-r--r--src/liballoc/tests/heap.rs2
-rw-r--r--src/liballoc/tests/rc.rs2
-rw-r--r--src/liballoc/tests/slice.rs2
-rw-r--r--src/liballoc/tests/str.rs21
-rw-r--r--src/liballoc/tests/string.rs2
-rw-r--r--src/liballoc/tests/vec.rs2
-rw-r--r--src/liballoc/tests/vec_deque.rs7
10 files changed, 43 insertions, 0 deletions
diff --git a/src/liballoc/tests/arc.rs b/src/liballoc/tests/arc.rs
index 2759b1b1cac..7c5a8926126 100644
--- a/src/liballoc/tests/arc.rs
+++ b/src/liballoc/tests/arc.rs
@@ -1,3 +1,5 @@
+#![cfg(not(miri))]
+
 use std::any::Any;
 use std::sync::{Arc, Weak};
 use std::cell::RefCell;
diff --git a/src/liballoc/tests/binary_heap.rs b/src/liballoc/tests/binary_heap.rs
index 94ae43237d1..c1a1c5d8878 100644
--- a/src/liballoc/tests/binary_heap.rs
+++ b/src/liballoc/tests/binary_heap.rs
@@ -282,6 +282,7 @@ fn assert_covariance() {
 //
 // Destructors must be called exactly once per element.
 #[test]
+#[cfg(not(miri))]
 fn panic_safe() {
     static DROP_COUNTER: AtomicUsize = AtomicUsize::new(0);
 
diff --git a/src/liballoc/tests/btree/mod.rs b/src/liballoc/tests/btree/mod.rs
index 4c704d0f8c2..653b3f5bcb4 100644
--- a/src/liballoc/tests/btree/mod.rs
+++ b/src/liballoc/tests/btree/mod.rs
@@ -1,3 +1,5 @@
+#![cfg(not(miri))]
+
 mod map;
 mod set;
 
diff --git a/src/liballoc/tests/heap.rs b/src/liballoc/tests/heap.rs
index 24eea1d2949..809d2bc094a 100644
--- a/src/liballoc/tests/heap.rs
+++ b/src/liballoc/tests/heap.rs
@@ -1,3 +1,5 @@
+#![cfg(not(miri))]
+
 use std::alloc::{Global, Alloc, Layout, System};
 
 /// https://github.com/rust-lang/rust/issues/45955
diff --git a/src/liballoc/tests/rc.rs b/src/liballoc/tests/rc.rs
index 18f82e80410..1be01d1a7ce 100644
--- a/src/liballoc/tests/rc.rs
+++ b/src/liballoc/tests/rc.rs
@@ -1,3 +1,5 @@
+#![cfg(not(miri))]
+
 use std::any::Any;
 use std::rc::{Rc, Weak};
 use std::cell::RefCell;
diff --git a/src/liballoc/tests/slice.rs b/src/liballoc/tests/slice.rs
index 334466dfb25..2a9fdfa9324 100644
--- a/src/liballoc/tests/slice.rs
+++ b/src/liballoc/tests/slice.rs
@@ -1,3 +1,5 @@
+#![cfg(not(miri))]
+
 use std::cell::Cell;
 use std::cmp::Ordering::{self, Equal, Greater, Less};
 use std::mem;
diff --git a/src/liballoc/tests/str.rs b/src/liballoc/tests/str.rs
index 1bc1bd8d78c..f4e6bc9ea31 100644
--- a/src/liballoc/tests/str.rs
+++ b/src/liballoc/tests/str.rs
@@ -31,6 +31,7 @@ fn test_rfind() {
 }
 
 #[test]
+#[cfg(not(miri))]
 fn test_collect() {
     let empty = "";
     let s: String = empty.chars().collect();
@@ -118,6 +119,7 @@ fn test_concat_for_different_types() {
 #[test]
 fn test_concat_for_different_lengths() {
     let empty: &[&str] = &[];
+    #[cfg(not(miri))]
     test_concat!("", empty);
     test_concat!("a", ["a"]);
     test_concat!("ab", ["a", "b"]);
@@ -146,6 +148,7 @@ fn test_join_for_different_types() {
 #[test]
 fn test_join_for_different_lengths() {
     let empty: &[&str] = &[];
+    #[cfg(not(miri))]
     test_join!("", empty, "-");
     test_join!("a", ["a"], "-");
     test_join!("a-b", ["a", "b"], "-");
@@ -159,6 +162,7 @@ fn test_join_for_different_lengths_with_long_separator() {
     assert_eq!("~~~~~".len(), 15);
 
     let empty: &[&str] = &[];
+    #[cfg(not(miri))]
     test_join!("", empty, "~~~~~");
     test_join!("a", ["a"], "~~~~~");
     test_join!("a~~~~~b", ["a", "b"], "~~~~~");
@@ -166,6 +170,7 @@ fn test_join_for_different_lengths_with_long_separator() {
 }
 
 #[test]
+#[cfg(not(miri))]
 fn test_unsafe_slice() {
     assert_eq!("ab", unsafe {"abc".get_unchecked(0..2)});
     assert_eq!("bc", unsafe {"abc".get_unchecked(1..3)});
@@ -238,6 +243,7 @@ fn test_replacen() {
 #[test]
 fn test_replace() {
     let a = "a";
+    #[cfg(not(miri))]
     assert_eq!("".replace(a, "b"), "");
     assert_eq!("a".replace(a, "b"), "b");
     assert_eq!("ab".replace(a, "b"), "bb");
@@ -297,6 +303,7 @@ fn test_replace_pattern() {
 // The current implementation of SliceIndex fails to handle methods
 // orthogonally from range types; therefore, it is worth testing
 // all of the indexing operations on each input.
+#[cfg(not(miri))]
 mod slice_index {
     // Test a slicing operation **that should succeed,**
     // testing it on all of the indexing methods.
@@ -679,6 +686,7 @@ fn test_str_slice_rangetoinclusive_ok() {
 
 #[test]
 #[should_panic]
+#[cfg(not(miri))]
 fn test_str_slice_rangetoinclusive_notok() {
     let s = "abcαβγ";
     &s[..=3];
@@ -694,6 +702,7 @@ fn test_str_slicemut_rangetoinclusive_ok() {
 
 #[test]
 #[should_panic]
+#[cfg(not(miri))]
 fn test_str_slicemut_rangetoinclusive_notok() {
     let mut s = "abcαβγ".to_owned();
     let s: &mut str = &mut s;
@@ -883,6 +892,7 @@ fn test_as_bytes() {
 
 #[test]
 #[should_panic]
+#[cfg(not(miri))]
 fn test_as_bytes_fail() {
     // Don't double free. (I'm not sure if this exercises the
     // original problem code path anymore.)
@@ -972,6 +982,7 @@ fn test_split_at_mut() {
 
 #[test]
 #[should_panic]
+#[cfg(not(miri))]
 fn test_split_at_boundscheck() {
     let s = "ศไทย中华Việt Nam";
     s.split_at(1);
@@ -1066,6 +1077,7 @@ fn test_rev_iterator() {
 }
 
 #[test]
+#[cfg(not(miri))]
 fn test_chars_decoding() {
     let mut bytes = [0; 4];
     for c in (0..0x110000).filter_map(std::char::from_u32) {
@@ -1077,6 +1089,7 @@ fn test_chars_decoding() {
 }
 
 #[test]
+#[cfg(not(miri))]
 fn test_chars_rev_decoding() {
     let mut bytes = [0; 4];
     for c in (0..0x110000).filter_map(std::char::from_u32) {
@@ -1306,6 +1319,7 @@ fn test_splitator() {
 }
 
 #[test]
+#[cfg(not(miri))]
 fn test_str_default() {
     use std::default::Default;
 
@@ -1365,6 +1379,7 @@ fn test_bool_from_str() {
     assert_eq!("not even a boolean".parse::<bool>().ok(), None);
 }
 
+#[cfg(not(miri))]
 fn check_contains_all_substrings(s: &str) {
     assert!(s.contains(""));
     for i in 0..s.len() {
@@ -1375,6 +1390,7 @@ fn check_contains_all_substrings(s: &str) {
 }
 
 #[test]
+#[cfg(not(miri))]
 fn strslice_issue_16589() {
     assert!("bananas".contains("nana"));
 
@@ -1384,6 +1400,7 @@ fn strslice_issue_16589() {
 }
 
 #[test]
+#[cfg(not(miri))]
 fn strslice_issue_16878() {
     assert!(!"1234567ah012345678901ah".contains("hah"));
     assert!(!"00abc01234567890123456789abc".contains("bcabc"));
@@ -1391,6 +1408,7 @@ fn strslice_issue_16878() {
 
 
 #[test]
+#[cfg(not(miri))]
 fn test_strslice_contains() {
     let x = "There are moments, Jeeves, when one asks oneself, 'Do trousers matter?'";
     check_contains_all_substrings(x);
@@ -1528,6 +1546,7 @@ fn trim_ws() {
 
 #[test]
 fn to_lowercase() {
+    #[cfg(not(miri))]
     assert_eq!("".to_lowercase(), "");
     assert_eq!("AÉDžaé ".to_lowercase(), "aédžaé ");
 
@@ -1561,6 +1580,7 @@ fn to_lowercase() {
 
 #[test]
 fn to_uppercase() {
+    #[cfg(not(miri))]
     assert_eq!("".to_uppercase(), "");
     assert_eq!("aéDžßfiᾀ".to_uppercase(), "AÉDŽSSFIἈΙ");
 }
@@ -1592,6 +1612,7 @@ fn test_cow_from() {
 }
 
 #[test]
+#[cfg(not(miri))]
 fn test_repeat() {
     assert_eq!("".repeat(3), "");
     assert_eq!("abc".repeat(0), "");
diff --git a/src/liballoc/tests/string.rs b/src/liballoc/tests/string.rs
index e5ce51a36ee..e6ca54c4088 100644
--- a/src/liballoc/tests/string.rs
+++ b/src/liballoc/tests/string.rs
@@ -1,3 +1,5 @@
+#![cfg(not(miri))]
+
 use std::borrow::Cow;
 use std::collections::CollectionAllocErr::*;
 use std::mem::size_of;
diff --git a/src/liballoc/tests/vec.rs b/src/liballoc/tests/vec.rs
index 89f2e0a046d..545332bcd6a 100644
--- a/src/liballoc/tests/vec.rs
+++ b/src/liballoc/tests/vec.rs
@@ -1,3 +1,5 @@
+#![cfg(not(miri))]
+
 use std::borrow::Cow;
 use std::mem::size_of;
 use std::{usize, isize};
diff --git a/src/liballoc/tests/vec_deque.rs b/src/liballoc/tests/vec_deque.rs
index aa49bdb0090..b47e7c867e6 100644
--- a/src/liballoc/tests/vec_deque.rs
+++ b/src/liballoc/tests/vec_deque.rs
@@ -108,6 +108,7 @@ fn test_index() {
 
 #[test]
 #[should_panic]
+#[cfg(not(miri))]
 fn test_index_out_of_bounds() {
     let mut deq = VecDeque::new();
     for i in 1..4 {
@@ -906,20 +907,24 @@ fn test_append() {
     // normal append
     a.append(&mut b);
     assert_eq!(a.iter().cloned().collect::<Vec<_>>(), [1, 2, 3, 4, 5, 6]);
+    #[cfg(not(miri))]
     assert_eq!(b.iter().cloned().collect::<Vec<_>>(), []);
 
     // append nothing to something
     a.append(&mut b);
     assert_eq!(a.iter().cloned().collect::<Vec<_>>(), [1, 2, 3, 4, 5, 6]);
+    #[cfg(not(miri))]
     assert_eq!(b.iter().cloned().collect::<Vec<_>>(), []);
 
     // append something to nothing
     b.append(&mut a);
     assert_eq!(b.iter().cloned().collect::<Vec<_>>(), [1, 2, 3, 4, 5, 6]);
+    #[cfg(not(miri))]
     assert_eq!(a.iter().cloned().collect::<Vec<_>>(), []);
 }
 
 #[test]
+#[cfg(not(miri))]
 fn test_append_permutations() {
     fn construct_vec_deque(
         push_back: usize,
@@ -1120,6 +1125,7 @@ fn test_reserve_exact_2() {
 }
 
 #[test]
+#[cfg(not(miri))]
 fn test_try_reserve() {
 
     // These are the interesting cases:
@@ -1221,6 +1227,7 @@ fn test_try_reserve() {
 }
 
 #[test]
+#[cfg(not(miri))]
 fn test_try_reserve_exact() {
 
     // This is exactly the same as test_try_reserve with the method changed.