mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Adapt tests to be able to run in miri
Decrease the Ns of bug loops to a smaller N, which makes them a lot faster in miri.
This commit is contained in:
parent
9a74608543
commit
907ea55841
@ -79,7 +79,11 @@ fn test_arena_alloc_nested() {
|
|||||||
#[test]
|
#[test]
|
||||||
pub fn test_copy() {
|
pub fn test_copy() {
|
||||||
let arena = TypedArena::default();
|
let arena = TypedArena::default();
|
||||||
for _ in 0..100000 {
|
#[cfg(not(miri))]
|
||||||
|
const N: usize = 100000;
|
||||||
|
#[cfg(miri)]
|
||||||
|
const N: usize = 1000;
|
||||||
|
for _ in 0..N {
|
||||||
arena.alloc(Point { x: 1, y: 2, z: 3 });
|
arena.alloc(Point { x: 1, y: 2, z: 3 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,7 +110,11 @@ struct Noncopy {
|
|||||||
#[test]
|
#[test]
|
||||||
pub fn test_noncopy() {
|
pub fn test_noncopy() {
|
||||||
let arena = TypedArena::default();
|
let arena = TypedArena::default();
|
||||||
for _ in 0..100000 {
|
#[cfg(not(miri))]
|
||||||
|
const N: usize = 100000;
|
||||||
|
#[cfg(miri)]
|
||||||
|
const N: usize = 1000;
|
||||||
|
for _ in 0..N {
|
||||||
arena.alloc(Noncopy { string: "hello world".to_string(), array: vec![1, 2, 3, 4, 5] });
|
arena.alloc(Noncopy { string: "hello world".to_string(), array: vec![1, 2, 3, 4, 5] });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,7 +122,11 @@ pub fn test_noncopy() {
|
|||||||
#[test]
|
#[test]
|
||||||
pub fn test_typed_arena_zero_sized() {
|
pub fn test_typed_arena_zero_sized() {
|
||||||
let arena = TypedArena::default();
|
let arena = TypedArena::default();
|
||||||
for _ in 0..100000 {
|
#[cfg(not(miri))]
|
||||||
|
const N: usize = 100000;
|
||||||
|
#[cfg(miri)]
|
||||||
|
const N: usize = 1000;
|
||||||
|
for _ in 0..N {
|
||||||
arena.alloc(());
|
arena.alloc(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -124,7 +136,11 @@ pub fn test_typed_arena_clear() {
|
|||||||
let mut arena = TypedArena::default();
|
let mut arena = TypedArena::default();
|
||||||
for _ in 0..10 {
|
for _ in 0..10 {
|
||||||
arena.clear();
|
arena.clear();
|
||||||
for _ in 0..10000 {
|
#[cfg(not(miri))]
|
||||||
|
const N: usize = 10000;
|
||||||
|
#[cfg(miri)]
|
||||||
|
const N: usize = 100;
|
||||||
|
for _ in 0..N {
|
||||||
arena.alloc(Point { x: 1, y: 2, z: 3 });
|
arena.alloc(Point { x: 1, y: 2, z: 3 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user