}
}
-#[cfg(test)]
+#[cfg(all(test, not(target_os = "emscripten")))]
mod tests {
use io::prelude::*;
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn file_test_io_smoke_test() {
let message = "it's alright. have a good time";
let tmpdir = tmpdir();
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn invalid_path_raises() {
let tmpdir = tmpdir();
let filename = &tmpdir.join("file_that_does_not_exist.txt");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn file_test_iounlinking_invalid_path_should_raise_condition() {
let tmpdir = tmpdir();
let filename = &tmpdir.join("file_another_file_that_does_not_exist.txt");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn file_test_io_non_positional_read() {
let message: &str = "ten-four";
let mut read_mem = [0; 8];
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn file_test_io_seek_and_tell_smoke_test() {
let message = "ten-four";
let mut read_mem = [0; 4];
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn file_test_io_seek_and_write() {
let initial_msg = "food-is-yummy";
let overwrite_msg = "-the-bar!!";
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn file_test_io_seek_shakedown() {
// 01234567890123
let initial_msg = "qwer-asdf-zxcv";
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn file_test_stat_is_correct_on_is_file() {
let tmpdir = tmpdir();
let filename = &tmpdir.join("file_stat_correct_on_is_file.txt");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn file_test_stat_is_correct_on_is_dir() {
let tmpdir = tmpdir();
let filename = &tmpdir.join("file_stat_correct_on_is_dir");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn file_test_fileinfo_false_when_checking_is_file_on_a_directory() {
let tmpdir = tmpdir();
let dir = &tmpdir.join("fileinfo_false_on_dir");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn file_test_fileinfo_check_exists_before_and_after_file_creation() {
let tmpdir = tmpdir();
let file = &tmpdir.join("fileinfo_check_exists_b_and_a.txt");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn file_test_directoryinfo_check_exists_before_and_after_mkdir() {
let tmpdir = tmpdir();
let dir = &tmpdir.join("before_and_after_dir");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn file_test_directoryinfo_readdir() {
let tmpdir = tmpdir();
let dir = &tmpdir.join("di_readdir");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn file_create_new_already_exists_error() {
let tmpdir = tmpdir();
let file = &tmpdir.join("file_create_new_error_exists");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn mkdir_path_already_exists_error() {
let tmpdir = tmpdir();
let dir = &tmpdir.join("mkdir_error_twice");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn recursive_mkdir() {
let tmpdir = tmpdir();
let dir = tmpdir.join("d1/d2");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn recursive_mkdir_failure() {
let tmpdir = tmpdir();
let dir = tmpdir.join("d1");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn recursive_mkdir_slash() {
check!(fs::create_dir_all(&Path::new("/")));
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn recursive_rmdir() {
let tmpdir = tmpdir();
let d1 = tmpdir.join("d1");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn recursive_rmdir_of_symlink() {
// test we do not recursively delete a symlink but only dirs.
let tmpdir = tmpdir();
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn unicode_path_is_dir() {
assert!(Path::new(".").is_dir());
assert!(!Path::new("test/stdtest/fs.rs").is_dir());
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn unicode_path_exists() {
assert!(Path::new(".").exists());
assert!(!Path::new("test/nonexistent-bogus-path").exists());
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn copy_file_does_not_exist() {
let from = Path::new("test/nonexistent-bogus-path");
let to = Path::new("test/other-bogus-path");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn copy_src_does_not_exist() {
let tmpdir = tmpdir();
let from = Path::new("test/nonexistent-bogus-path");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn copy_file_ok() {
let tmpdir = tmpdir();
let input = tmpdir.join("in.txt");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn copy_file_dst_dir() {
let tmpdir = tmpdir();
let out = tmpdir.join("out");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn copy_file_dst_exists() {
let tmpdir = tmpdir();
let input = tmpdir.join("in");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn copy_file_src_dir() {
let tmpdir = tmpdir();
let out = tmpdir.join("out");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn copy_file_preserves_perm_bits() {
let tmpdir = tmpdir();
let input = tmpdir.join("in.txt");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn symlinks_work() {
let tmpdir = tmpdir();
if !got_symlink_permission(&tmpdir) { return };
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn symlink_noexist() {
// Symlinks can point to things that don't exist
let tmpdir = tmpdir();
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn read_link() {
if cfg!(windows) {
// directory symlink
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn readlink_not_symlink() {
let tmpdir = tmpdir();
match fs::read_link(tmpdir.path()) {
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn links_work() {
let tmpdir = tmpdir();
let input = tmpdir.join("in.txt");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn chmod_works() {
let tmpdir = tmpdir();
let file = tmpdir.join("in.txt");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn sync_doesnt_kill_anything() {
let tmpdir = tmpdir();
let path = tmpdir.join("in.txt");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn truncate_works() {
let tmpdir = tmpdir();
let path = tmpdir.join("in.txt");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn open_flavors() {
use fs::OpenOptions as OO;
fn c<T: Clone>(t: &T) -> T { t.clone() }
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn binary_file() {
let mut bytes = [0; 1024];
StdRng::new().unwrap().fill_bytes(&mut bytes);
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn file_try_clone() {
let tmpdir = tmpdir();
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
#[cfg(not(windows))]
fn unlink_readonly() {
let tmpdir = tmpdir();
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn mkdir_trailing_slash() {
let tmpdir = tmpdir();
let path = tmpdir.join("file");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn canonicalize_works_simple() {
let tmpdir = tmpdir();
let tmpdir = fs::canonicalize(tmpdir.path()).unwrap();
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn realpath_works() {
let tmpdir = tmpdir();
if !got_symlink_permission(&tmpdir) { return };
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn realpath_works_tricky() {
let tmpdir = tmpdir();
if !got_symlink_permission(&tmpdir) { return };
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn dir_entry_methods() {
let tmpdir = tmpdir();
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn read_dir_not_found() {
let res = fs::read_dir("/path/that/does/not/exist");
assert_eq!(res.err().unwrap().kind(), ErrorKind::NotFound);
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn create_dir_all_with_junctions() {
let tmpdir = tmpdir();
let target = tmpdir.join("target");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn metadata_access_times() {
let tmpdir = tmpdir();
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn to_socket_addr_str_u16() {
let a = sa4(Ipv4Addr::new(77, 88, 21, 11), 24352);
assert_eq!(Ok(vec![a]), tsa(("77.88.21.11", 24352)));
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn to_socket_addr_str() {
let a = sa4(Ipv4Addr::new(77, 88, 21, 11), 24352);
assert_eq!(Ok(vec![a]), tsa("77.88.21.11:24352"));
// FIXME: figure out why this fails on openbsd and bitrig and fix it
#[test]
#[cfg(not(any(windows, target_os = "openbsd", target_os = "bitrig")))]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn to_socket_addr_str_bad() {
assert!(tsa("1200::AB00:1234::2552:7777:1313:34300").is_err());
}
}
}
-#[cfg(test)]
+#[cfg(all(test, not(target_os = "emscripten")))]
mod tests {
use sync::mpsc::channel;
use super::{Queue, Data, Empty, Inconsistent};
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test() {
let nthreads = 8;
let nmsgs = 1000;
}
}
-#[cfg(test)]
+#[cfg(all(test, not(target_os = "emscripten")))]
mod tests {
use sync::Arc;
use super::Queue;
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn stress() {
unsafe {
stress_bound(0);
&guard.__lock.poison
}
-#[cfg(test)]
+#[cfg(all(test, not(target_os = "emscripten")))]
mod tests {
use sync::mpsc::channel;
use sync::{Arc, Mutex, Condvar};
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn lots_and_lots() {
const J: u32 = 1000;
const K: u32 = 3;
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_into_inner_poison() {
let m = Arc::new(Mutex::new(NonCopy(10)));
let m2 = m.clone();
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_get_mut_poison() {
let m = Arc::new(Mutex::new(NonCopy(10)));
let m2 = m.clone();
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_mutex_arc_condvar() {
let packet = Packet(Arc::new((Mutex::new(false), Condvar::new())));
let packet2 = Packet(packet.0.clone());
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_arc_condvar_poison() {
let packet = Packet(Arc::new((Mutex::new(1), Condvar::new())));
let packet2 = Packet(packet.0.clone());
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_mutex_arc_poison() {
let arc = Arc::new(Mutex::new(1));
assert!(!arc.is_poisoned());
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_mutex_arc_nested() {
// Tests nested mutexes and access
// to underlying data.
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_mutex_arc_access_in_unwind() {
let arc = Arc::new(Mutex::new(1));
let arc2 = arc.clone();
}
}
-#[cfg(test)]
+#[cfg(all(test, not(target_os = "emscripten")))]
mod tests {
use panic;
use sync::mpsc::channel;
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn stampede_once() {
static O: Once = Once::new();
static mut run: bool = false;
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn wait_for_force_to_finish() {
static O: Once = Once::new();
}
}
-#[cfg(test)]
+#[cfg(all(test, not(target_os = "emscripten")))]
mod tests {
#![allow(deprecated)] // rand
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn frob() {
const N: usize = 10;
const M: usize = 1000;
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_rw_arc_poison_wr() {
let arc = Arc::new(RwLock::new(1));
let arc2 = arc.clone();
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_rw_arc_poison_ww() {
let arc = Arc::new(RwLock::new(1));
assert!(!arc.is_poisoned());
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_rw_arc_no_poison_rr() {
let arc = Arc::new(RwLock::new(1));
let arc2 = arc.clone();
assert_eq!(*lock, 1);
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_rw_arc_no_poison_rw() {
let arc = Arc::new(RwLock::new(1));
let arc2 = arc.clone();
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_rw_arc() {
let arc = Arc::new(RwLock::new(0));
let arc2 = arc.clone();
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_rw_arc_access_in_unwind() {
let arc = Arc::new(RwLock::new(1));
let arc2 = arc.clone();
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_into_inner_poison() {
let m = Arc::new(RwLock::new(NonCopy(10)));
let m2 = m.clone();
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_get_mut_poison() {
let m = Arc::new(RwLock::new(NonCopy(10)));
let m2 = m.clone();
}
}
-#[cfg(test)]
+#[cfg(all(test, not(target_os = "emscripten")))]
pub mod test {
use path::{Path, PathBuf};
use env;
}
-#[cfg(test)]
+#[cfg(all(test, not(target_os = "emscripten")))]
mod tests {
use sys_common::remutex::{ReentrantMutex, ReentrantMutexGuard};
use cell::RefCell;
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn is_mutex() {
let m = Arc::new(ReentrantMutex::new(RefCell::new(0)));
let m2 = m.clone();
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn trylock_works() {
let m = Arc::new(ReentrantMutex::new(()));
let m2 = m.clone();
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn poison_works() {
let m = Arc::new(ReentrantMutex::new(RefCell::new(0)));
let mc = m.clone();
}
}
-#[cfg(test)]
+#[cfg(all(test, not(target_os = "emscripten")))]
mod test {
use thread;
use io;
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn basic() {
let dir = tmpdir();
let socket_path = dir.path().join("sock");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn pair() {
let msg1 = b"hello";
let msg2 = b"world!";
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn try_clone() {
let dir = tmpdir();
let socket_path = dir.path().join("sock");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn iter() {
let dir = tmpdir();
let socket_path = dir.path().join("sock");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn long_path() {
let dir = tmpdir();
let socket_path = dir.path()
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn timeouts() {
let dir = tmpdir();
let socket_path = dir.path().join("sock");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_read_timeout() {
let dir = tmpdir();
let socket_path = dir.path().join("sock");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_read_with_timeout() {
let dir = tmpdir();
let socket_path = dir.path().join("sock");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_unix_datagram() {
let dir = tmpdir();
let path1 = dir.path().join("sock1");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_unnamed_unix_datagram() {
let dir = tmpdir();
let path1 = dir.path().join("sock1");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_connect_unix_datagram() {
let dir = tmpdir();
let path1 = dir.path().join("sock1");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_unix_datagram_recv() {
let dir = tmpdir();
let path1 = dir.path().join("sock1");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn datagram_pair() {
let msg1 = b"hello";
let msg2 = b"world!";
}
}
-#[cfg(test)]
+#[cfg(all(test, not(target_os = "emscripten")))]
mod tests {
use sync::mpsc::{channel, Sender};
use cell::{Cell, UnsafeCell};
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn smoke_no_dtor() {
thread_local!(static FOO: Cell<i32> = Cell::new(1));
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn states() {
struct Foo;
impl Drop for Foo {
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn smoke_dtor() {
thread_local!(static FOO: UnsafeCell<Option<Foo>> = UnsafeCell::new(None));
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn circular() {
struct S1;
struct S2;
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn self_referential() {
struct S1;
thread_local!(static K1: UnsafeCell<Option<S1>> = UnsafeCell::new(None));
// test on OSX.
#[test]
#[cfg_attr(target_os = "macos", ignore)]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn dtors_in_dtors_in_dtors() {
struct S1(Sender<()>);
thread_local!(static K1: UnsafeCell<Option<S1>> = UnsafeCell::new(None));
// Tests
////////////////////////////////////////////////////////////////////////////////
-#[cfg(test)]
+#[cfg(all(test, not(target_os = "emscripten")))]
mod tests {
use any::Any;
use sync::mpsc::{channel, Sender};
// !!! instead of exiting cleanly. This might wedge the buildbots. !!!
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_unnamed_thread() {
thread::spawn(move|| {
assert!(thread::current().name().is_none());
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_named_thread() {
Builder::new().name("ada lovelace".to_string()).spawn(move|| {
assert!(thread::current().name().unwrap() == "ada lovelace".to_string());
#[test]
#[should_panic]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_invalid_named_thread() {
let _ = Builder::new().name("ada l\0velace".to_string()).spawn(|| {});
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_run_basic() {
let (tx, rx) = channel();
thread::spawn(move|| {
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_join_panic() {
match thread::spawn(move|| {
panic!()
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_spawn_sched() {
let (tx, rx) = channel();
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_spawn_sched_childs_on_default_sched() {
let (tx, rx) = channel();
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_avoid_copying_the_body_spawn() {
avoid_copying_the_body(|v| {
thread::spawn(move || v());
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_avoid_copying_the_body_thread_spawn() {
avoid_copying_the_body(|f| {
thread::spawn(move|| {
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_avoid_copying_the_body_join() {
avoid_copying_the_body(|f| {
let _ = thread::spawn(move|| {
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_child_doesnt_ref_parent() {
// If the child refcounts the parent thread, this will stack overflow when
// climbing the thread tree to dereference each ancestor. (See #1789)
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_simple_newsched_spawn() {
thread::spawn(move || {});
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_try_panic_message_static_str() {
match thread::spawn(move|| {
panic!("static string");
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_try_panic_message_owned_str() {
match thread::spawn(move|| {
panic!("owned string".to_string());
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_try_panic_message_any() {
match thread::spawn(move|| {
panic!(box 413u16 as Box<Any + Send>);
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_try_panic_message_unit_struct() {
struct Juju;
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_park_timeout_unpark_before() {
for _ in 0..10 {
thread::current().unpark();
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_park_timeout_unpark_not_called() {
for _ in 0..10 {
thread::park_timeout(Duration::from_millis(10));
}
#[test]
- #[cfg_attr(target_os = "emscripten", ignore)]
fn test_park_timeout_unpark_called_other_thread() {
for _ in 0..10 {
let th = thread::current();