// And now that you've seen all the races that I found and attempted to fix,
// here's the code for you to find some more!
-use sync::Arc;
-use error;
-use fmt;
-use mem;
-use cell::UnsafeCell;
-use time::{Duration, Instant};
+use crate::sync::Arc;
+use crate::error;
+use crate::fmt;
+use crate::mem;
+use crate::cell::UnsafeCell;
+use crate::time::{Duration, Instant};
#[unstable(feature = "mpsc_select", issue = "27800")]
pub use self::select::{Select, Handle};
#[cfg(all(test, not(target_os = "emscripten")))]
mod tests {
- use env;
use super::*;
- use thread;
- use time::{Duration, Instant};
+ use crate::env;
+ use crate::thread;
+ use crate::time::{Duration, Instant};
pub fn stress_factor() -> usize {
match env::var("RUST_TEST_STRESS") {
for _ in 0..10000 {
assert_eq!(rx.recv().unwrap(), 1);
}
- t.join().ok().unwrap();
+ t.join().ok().expect("thread panicked");
}
#[test]
});
}
drop(tx);
- t.join().ok().unwrap();
+ t.join().ok().expect("thread panicked");
}
#[test]
tx2.send(1).unwrap();
}
});
- t1.join().ok().unwrap();
- t2.join().ok().unwrap();
+ t1.join().ok().expect("thread panicked");
+ t2.join().ok().expect("thread panicked");
}
#[test]
for _ in 0..40 {
tx.send(1).unwrap();
}
- t.join().ok().unwrap();
+ t.join().ok().expect("thread panicked");
}
#[test]
tx1.send(1).unwrap();
assert_eq!(rx2.recv().unwrap(), 2);
});
- t1.join().ok().unwrap();
- t2.join().ok().unwrap();
+ t1.join().ok().expect("thread panicked");
+ t2.join().ok().expect("thread panicked");
}
#[test]
}
#[test]
+ #[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31
fn oneshot_single_thread_recv_timeout() {
let (tx, rx) = channel();
tx.send(()).unwrap();
}
#[test]
+ #[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31
fn stress_recv_timeout_two_threads() {
let (tx, rx) = channel();
let stress = stress_factor() + 100;
}
#[test]
+ #[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31
fn recv_timeout_upgrade() {
let (tx, rx) = channel::<()>();
let timeout = Duration::from_millis(1);
}
#[test]
+ #[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31
fn stress_recv_timeout_shared() {
let (tx, rx) = channel();
let stress = stress_factor() + 100;
}
#[test]
+ #[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31
fn very_long_recv_timeout_wont_panic() {
let (tx, rx) = channel::<()>();
let join_handle = thread::spawn(move || {
}
#[test]
+ #[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31
fn shared_recv_timeout() {
let (tx, rx) = channel();
let total = 5;
#[cfg(all(test, not(target_os = "emscripten")))]
mod sync_tests {
- use env;
- use thread;
use super::*;
- use time::Duration;
+ use crate::env;
+ use crate::thread;
+ use crate::time::Duration;
pub fn stress_factor() -> usize {
match env::var("RUST_TEST_STRESS") {
}
#[test]
+ #[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31
fn recv_timeout() {
let (tx, rx) = sync_channel::<i32>(1);
assert_eq!(rx.recv_timeout(Duration::from_millis(1)), Err(RecvTimeoutError::Timeout));
}
#[test]
+ #[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31
fn stress_recv_timeout_two_threads() {
let (tx, rx) = sync_channel::<i32>(0);
}
#[test]
+ #[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31
fn stress_recv_timeout_shared() {
const AMT: u32 = 1000;
const NTHREADS: u32 = 8;