소스 검색

Made sure all tests and benches actually use ralloc as their global allocator

Tom Almeida 6 년 전
부모
커밋
14e275d814
21개의 변경된 파일61개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 0
      benches/box.rs
  2. 3 0
      benches/mpsc.rs
  3. 1 1
      benches/sbrk.rs
  4. 3 0
      benches/vec.rs
  5. 3 0
      benches/vec_box.rs
  6. 3 0
      tests/arc.rs
  7. 3 0
      tests/box.rs
  8. 3 0
      tests/btreemap.rs
  9. 3 0
      tests/cross_thread_drop.rs
  10. 3 0
      tests/join.rs
  11. 3 0
      tests/manual.rs
  12. 3 0
      tests/manual2.rs
  13. 3 0
      tests/minimal.rs
  14. 3 0
      tests/mpsc.rs
  15. 3 0
      tests/partial_free.rs
  16. 3 0
      tests/partial_realloc.rs
  17. 3 0
      tests/realloc.rs
  18. 3 0
      tests/scaling.rs
  19. 3 0
      tests/string.rs
  20. 3 0
      tests/too_many_threads.rs
  21. 3 0
      tests/vec.rs

+ 3 - 0
benches/box.rs

@@ -3,6 +3,9 @@
 extern crate ralloc;
 extern crate test;
 
+#[global_allocator]
+static ALLOCATOR: ralloc::Allocator = ralloc::Allocator;
+
 #[bench]
 fn bench_box(b: &mut test::Bencher) {
     b.iter(|| {

+ 3 - 0
benches/mpsc.rs

@@ -3,6 +3,9 @@
 extern crate ralloc;
 extern crate test;
 
+#[global_allocator]
+static ALLOCATOR: ralloc::Allocator = ralloc::Allocator;
+
 use std::sync::mpsc;
 use std::thread;
 

+ 1 - 1
benches/sbrk.rs

@@ -5,5 +5,5 @@ extern crate test;
 
 #[bench]
 fn bench_sbrk(b: &mut test::Bencher) {
-    b.iter(|| ralloc::sbrk(200).unwrap());
+    b.iter(|| unsafe { ralloc::sbrk(200) });
 }

+ 3 - 0
benches/vec.rs

@@ -1,5 +1,8 @@
 #![feature(test)]
 
+#[global_allocator]
+static ALLOCATOR: ralloc::Allocator = ralloc::Allocator;
+
 extern crate ralloc;
 extern crate test;
 

+ 3 - 0
benches/vec_box.rs

@@ -1,5 +1,8 @@
 #![feature(test)]
 
+#[global_allocator]
+static ALLOCATOR: ralloc::Allocator = ralloc::Allocator;
+
 extern crate ralloc;
 extern crate test;
 

+ 3 - 0
tests/arc.rs

@@ -3,6 +3,9 @@
 
 extern crate ralloc;
 
+#[global_allocator]
+static ALLOCATOR: ralloc::Allocator = ralloc::Allocator;
+
 use std::sync::Arc;
 use std::thread;
 

+ 3 - 0
tests/box.rs

@@ -1,5 +1,8 @@
 extern crate ralloc;
 
+#[global_allocator]
+static ALLOCATOR: ralloc::Allocator = ralloc::Allocator;
+
 mod util;
 
 #[inline(never)]

+ 3 - 0
tests/btreemap.rs

@@ -1,5 +1,8 @@
 extern crate ralloc;
 
+#[global_allocator]
+static ALLOCATOR: ralloc::Allocator = ralloc::Allocator;
+
 mod util;
 
 use std::collections::BTreeMap;

+ 3 - 0
tests/cross_thread_drop.rs

@@ -1,5 +1,8 @@
 extern crate ralloc;
 
+#[global_allocator]
+static ALLOCATOR: ralloc::Allocator = ralloc::Allocator;
+
 mod util;
 
 use std::thread;

+ 3 - 0
tests/join.rs

@@ -1,5 +1,8 @@
 extern crate ralloc;
 
+#[global_allocator]
+static ALLOCATOR: ralloc::Allocator = ralloc::Allocator;
+
 mod util;
 
 use std::thread;

+ 3 - 0
tests/manual.rs

@@ -1,5 +1,8 @@
 extern crate ralloc;
 
+#[global_allocator]
+static ALLOCATOR: ralloc::Allocator = ralloc::Allocator;
+
 mod util;
 
 use std::ptr;

+ 3 - 0
tests/manual2.rs

@@ -1,5 +1,8 @@
 extern crate ralloc;
 
+#[global_allocator]
+static ALLOCATOR: ralloc::Allocator = ralloc::Allocator;
+
 mod util;
 
 #[test]

+ 3 - 0
tests/minimal.rs

@@ -1,5 +1,8 @@
 extern crate ralloc;
 
+#[global_allocator]
+static ALLOCATOR: ralloc::Allocator = ralloc::Allocator;
+
 #[test]
 fn minimal() {
     let a = Box::new(1);

+ 3 - 0
tests/mpsc.rs

@@ -1,5 +1,8 @@
 extern crate ralloc;
 
+#[global_allocator]
+static ALLOCATOR: ralloc::Allocator = ralloc::Allocator;
+
 mod util;
 
 use std::sync::mpsc;

+ 3 - 0
tests/partial_free.rs

@@ -1,5 +1,8 @@
 extern crate ralloc;
 
+#[global_allocator]
+static ALLOCATOR: ralloc::Allocator = ralloc::Allocator;
+
 mod util;
 
 use std::ptr;

+ 3 - 0
tests/partial_realloc.rs

@@ -1,5 +1,8 @@
 extern crate ralloc;
 
+#[global_allocator]
+static ALLOCATOR: ralloc::Allocator = ralloc::Allocator;
+
 mod util;
 
 use std::ptr;

+ 3 - 0
tests/realloc.rs

@@ -1,5 +1,8 @@
 extern crate ralloc;
 
+#[global_allocator]
+static ALLOCATOR: ralloc::Allocator = ralloc::Allocator;
+
 mod util;
 
 #[test]

+ 3 - 0
tests/scaling.rs

@@ -1,5 +1,8 @@
 extern crate ralloc;
 
+#[global_allocator]
+static ALLOCATOR: ralloc::Allocator = ralloc::Allocator;
+
 mod util;
 
 #[test]

+ 3 - 0
tests/string.rs

@@ -1,5 +1,8 @@
 extern crate ralloc;
 
+#[global_allocator]
+static ALLOCATOR: ralloc::Allocator = ralloc::Allocator;
+
 mod util;
 
 #[test]

+ 3 - 0
tests/too_many_threads.rs

@@ -1,5 +1,8 @@
 extern crate ralloc;
 
+#[global_allocator]
+static ALLOCATOR: ralloc::Allocator = ralloc::Allocator;
+
 mod util;
 
 use std::thread;

+ 3 - 0
tests/vec.rs

@@ -1,5 +1,8 @@
 extern crate ralloc;
 
+#[global_allocator]
+static ALLOCATOR: ralloc::Allocator = ralloc::Allocator;
+
 mod util;
 
 #[test]