Browse Source

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

Tom Almeida 5 years ago
parent
commit
14e275d814

+ 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]