aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGravatar Ralf Jung <post@ralfj.de> 2020-12-29 22:54:48 +0100
committerGravatar GitHub <noreply@github.com> 2020-12-29 22:54:48 +0100
commit27a0f9ca6e01b953805684eff535a14eaff937d0 (patch)
tree41ec3f1a111eadfd43b1ab5e5caf984d5f542991 /tests
parented71a7beb3fd0cc67cad08da2643cff2732f6b52 (diff)
downloadbytes-27a0f9ca6e01b953805684eff535a14eaff937d0.tar.gz
bytes-27a0f9ca6e01b953805684eff535a14eaff937d0.tar.zst
bytes-27a0f9ca6e01b953805684eff535a14eaff937d0.zip
CI: run test suite in Miri (#456)
Diffstat (limited to 'tests')
-rw-r--r--tests/test_bytes.rs7
-rw-r--r--tests/test_bytes_odd_alloc.rs2
2 files changed, 6 insertions, 3 deletions
diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs
index 78be4b7..b9e6ce4 100644
--- a/tests/test_bytes.rs
+++ b/tests/test_bytes.rs
@@ -461,6 +461,7 @@ fn reserve_allocates_at_least_original_capacity() {
}
#[test]
+#[cfg_attr(miri, ignore)] // Miri is too slow
fn reserve_max_original_capacity_value() {
const SIZE: usize = 128 * 1024;
@@ -608,15 +609,15 @@ fn advance_past_len() {
#[test]
// Only run these tests on little endian systems. CI uses qemu for testing
-// little endian... and qemu doesn't really support threading all that well.
-#[cfg(target_endian = "little")]
+// big endian... and qemu doesn't really support threading all that well.
+#[cfg(any(miri, target_endian = "little"))]
fn stress() {
// Tests promoting a buffer from a vec -> shared in a concurrent situation
use std::sync::{Arc, Barrier};
use std::thread;
const THREADS: usize = 8;
- const ITERS: usize = 1_000;
+ const ITERS: usize = if cfg!(miri) { 100 } else { 1_000 };
for i in 0..ITERS {
let data = [i as u8; 256];
diff --git a/tests/test_bytes_odd_alloc.rs b/tests/test_bytes_odd_alloc.rs
index 4ce424b..04ba7c2 100644
--- a/tests/test_bytes_odd_alloc.rs
+++ b/tests/test_bytes_odd_alloc.rs
@@ -1,6 +1,8 @@
//! Test using `Bytes` with an allocator that hands out "odd" pointers for
//! vectors (pointers where the LSB is set).
+#![cfg(not(miri))] // Miri does not support custom allocators (also, Miri is "odd" by default with 50% chance)
+
use std::alloc::{GlobalAlloc, Layout, System};
use std::ptr;