aboutsummaryrefslogtreecommitdiff
path: root/tests/test_bytes.rs
diff options
context:
space:
mode:
authorGravatar Carl Lerche <me@carllerche.com> 2017-03-20 10:12:23 -0700
committerGravatar GitHub <noreply@github.com> 2017-03-20 10:12:23 -0700
commitdc9c8e304e60b6038e0df4bfd7abfdc145251310 (patch)
tree92121d76e895356416fcd7ff978ce53de6328900 /tests/test_bytes.rs
parentbed128b2c0697a34e96b4b4d77c00cd8f1d13ca3 (diff)
downloadbytes-dc9c8e304e60b6038e0df4bfd7abfdc145251310.tar.gz
bytes-dc9c8e304e60b6038e0df4bfd7abfdc145251310.tar.zst
bytes-dc9c8e304e60b6038e0df4bfd7abfdc145251310.zip
Misc CI fixes (#89)
Limit the number of threads when using qemu to 1. Also, don't bother running the stress test as this will trigger qemu bugs. Finally, also make the stress test actually stress test.
Diffstat (limited to '')
-rw-r--r--tests/test_bytes.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs
index cfb5070..2e163df 100644
--- a/tests/test_bytes.rs
+++ b/tests/test_bytes.rs
@@ -298,6 +298,9 @@ fn extend() {
}
#[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")]
fn stress() {
// Tests promoting a buffer from a vec -> shared in a concurrent situation
use std::sync::{Arc, Barrier};
@@ -308,7 +311,7 @@ fn stress() {
for i in 0..ITERS {
let data = [i as u8; 256];
- let buf = Arc::new(BytesMut::from(&data[..]));
+ let buf = Arc::new(Bytes::from(&data[..]));
let barrier = Arc::new(Barrier::new(THREADS));
let mut joins = Vec::with_capacity(THREADS);
@@ -319,7 +322,8 @@ fn stress() {
joins.push(thread::spawn(move || {
c.wait();
- let _buf = buf.clone();
+ let buf: Bytes = (*buf).clone();
+ drop(buf);
}));
}