Fix std tests for wasm32-wasip2 target
This commit is contained in:
parent
3b11c82a3d
commit
87f17f3ccb
29 changed files with 125 additions and 45 deletions
|
@ -1018,6 +1018,7 @@ mod test_extract_if {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
|
||||||
fn drop_panic_leak() {
|
fn drop_panic_leak() {
|
||||||
static PREDS: AtomicUsize = AtomicUsize::new(0);
|
static PREDS: AtomicUsize = AtomicUsize::new(0);
|
||||||
static DROPS: AtomicUsize = AtomicUsize::new(0);
|
static DROPS: AtomicUsize = AtomicUsize::new(0);
|
||||||
|
@ -1047,6 +1048,7 @@ mod test_extract_if {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
|
||||||
fn pred_panic_leak() {
|
fn pred_panic_leak() {
|
||||||
static PREDS: AtomicUsize = AtomicUsize::new(0);
|
static PREDS: AtomicUsize = AtomicUsize::new(0);
|
||||||
static DROPS: AtomicUsize = AtomicUsize::new(0);
|
static DROPS: AtomicUsize = AtomicUsize::new(0);
|
||||||
|
@ -1076,6 +1078,7 @@ mod test_extract_if {
|
||||||
|
|
||||||
// Same as above, but attempt to use the iterator again after the panic in the predicate
|
// Same as above, but attempt to use the iterator again after the panic in the predicate
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
|
||||||
fn pred_panic_reuse() {
|
fn pred_panic_reuse() {
|
||||||
static PREDS: AtomicUsize = AtomicUsize::new(0);
|
static PREDS: AtomicUsize = AtomicUsize::new(0);
|
||||||
static DROPS: AtomicUsize = AtomicUsize::new(0);
|
static DROPS: AtomicUsize = AtomicUsize::new(0);
|
||||||
|
|
|
@ -429,6 +429,7 @@ fn test_extract_if() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
|
||||||
fn test_extract_if_drop_panic_leak() {
|
fn test_extract_if_drop_panic_leak() {
|
||||||
static PREDS: AtomicU32 = AtomicU32::new(0);
|
static PREDS: AtomicU32 = AtomicU32::new(0);
|
||||||
static DROPS: AtomicU32 = AtomicU32::new(0);
|
static DROPS: AtomicU32 = AtomicU32::new(0);
|
||||||
|
@ -459,6 +460,7 @@ fn test_extract_if_drop_panic_leak() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
|
||||||
fn test_extract_if_pred_panic_leak() {
|
fn test_extract_if_pred_panic_leak() {
|
||||||
static PREDS: AtomicU32 = AtomicU32::new(0);
|
static PREDS: AtomicU32 = AtomicU32::new(0);
|
||||||
static DROPS: AtomicU32 = AtomicU32::new(0);
|
static DROPS: AtomicU32 = AtomicU32::new(0);
|
||||||
|
|
2
library/std/src/env/tests.rs
vendored
2
library/std/src/env/tests.rs
vendored
|
@ -1,7 +1,7 @@
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(any(target_os = "emscripten", target_env = "sgx"), ignore)]
|
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi", target_env = "sgx"), ignore)]
|
||||||
fn test_self_exe_path() {
|
fn test_self_exe_path() {
|
||||||
let path = current_exe();
|
let path = current_exe();
|
||||||
assert!(path.is_ok());
|
assert!(path.is_ok());
|
||||||
|
|
|
@ -8,7 +8,15 @@
|
||||||
#![stable(feature = "rust1", since = "1.0.0")]
|
#![stable(feature = "rust1", since = "1.0.0")]
|
||||||
#![deny(unsafe_op_in_unsafe_fn)]
|
#![deny(unsafe_op_in_unsafe_fn)]
|
||||||
|
|
||||||
#[cfg(all(test, not(any(target_os = "emscripten", target_env = "sgx", target_os = "xous"))))]
|
#[cfg(all(
|
||||||
|
test,
|
||||||
|
not(any(
|
||||||
|
target_os = "emscripten",
|
||||||
|
target_os = "wasi",
|
||||||
|
target_env = "sgx",
|
||||||
|
target_os = "xous"
|
||||||
|
))
|
||||||
|
))]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
use crate::ffi::OsString;
|
use crate::ffi::OsString;
|
||||||
|
|
|
@ -164,6 +164,7 @@ fn test_buffered_reader_stream_position() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
|
||||||
fn test_buffered_reader_stream_position_panic() {
|
fn test_buffered_reader_stream_position_panic() {
|
||||||
let inner: &[u8] = &[5, 6, 7, 0, 1, 2, 3, 4];
|
let inner: &[u8] = &[5, 6, 7, 0, 1, 2, 3, 4];
|
||||||
let mut reader = BufReader::with_capacity(4, io::Cursor::new(inner));
|
let mut reader = BufReader::with_capacity(4, io::Cursor::new(inner));
|
||||||
|
@ -487,7 +488,7 @@ fn dont_panic_in_drop_on_panicked_flush() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
|
||||||
fn panic_in_write_doesnt_flush_in_drop() {
|
fn panic_in_write_doesnt_flush_in_drop() {
|
||||||
static WRITES: AtomicUsize = AtomicUsize::new(0);
|
static WRITES: AtomicUsize = AtomicUsize::new(0);
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ fn stderrlock_unwind_safe() {
|
||||||
fn assert_unwind_safe<T: UnwindSafe + RefUnwindSafe>() {}
|
fn assert_unwind_safe<T: UnwindSafe + RefUnwindSafe>() {}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
|
||||||
fn panic_doesnt_poison() {
|
fn panic_doesnt_poison() {
|
||||||
thread::spawn(|| {
|
thread::spawn(|| {
|
||||||
let _a = stdin();
|
let _a = stdin();
|
||||||
|
@ -48,17 +48,17 @@ fn panic_doesnt_poison() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
|
||||||
fn test_lock_stderr() {
|
fn test_lock_stderr() {
|
||||||
test_lock(stderr, || stderr().lock());
|
test_lock(stderr, || stderr().lock());
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
|
||||||
fn test_lock_stdin() {
|
fn test_lock_stdin() {
|
||||||
test_lock(stdin, || stdin().lock());
|
test_lock(stdin, || stdin().lock());
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
|
||||||
fn test_lock_stdout() {
|
fn test_lock_stdout() {
|
||||||
test_lock(stdout, || stdout().lock());
|
test_lock(stdout, || stdout().lock());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Tests for this module
|
// Tests for this module
|
||||||
#[cfg(all(test, not(target_os = "emscripten")))]
|
#[cfg(all(test, not(any(target_os = "emscripten", all(target_os = "wasi", target_env = "p1")))))]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
#[stable(feature = "ip_addr", since = "1.7.0")]
|
#[stable(feature = "ip_addr", since = "1.7.0")]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Tests for this module
|
// Tests for this module
|
||||||
#[cfg(all(test, not(target_os = "emscripten")))]
|
#[cfg(all(test, not(any(target_os = "emscripten", all(target_os = "wasi", target_env = "p1")))))]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
#![deny(unsafe_op_in_unsafe_fn)]
|
#![deny(unsafe_op_in_unsafe_fn)]
|
||||||
|
|
||||||
#[cfg(all(test, not(any(target_os = "emscripten", target_os = "xous"))))]
|
#[cfg(all(
|
||||||
|
test,
|
||||||
|
not(any(
|
||||||
|
target_os = "emscripten",
|
||||||
|
all(target_os = "wasi", target_env = "p1"),
|
||||||
|
target_os = "xous"
|
||||||
|
))
|
||||||
|
))]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
use crate::fmt;
|
use crate::fmt;
|
||||||
|
|
|
@ -57,6 +57,7 @@ fn connect_timeout_error() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn listen_localhost() {
|
fn listen_localhost() {
|
||||||
let socket_addr = next_test_ip4();
|
let socket_addr = next_test_ip4();
|
||||||
let listener = t!(TcpListener::bind(&socket_addr));
|
let listener = t!(TcpListener::bind(&socket_addr));
|
||||||
|
@ -73,6 +74,7 @@ fn listen_localhost() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn connect_loopback() {
|
fn connect_loopback() {
|
||||||
each_ip(&mut |addr| {
|
each_ip(&mut |addr| {
|
||||||
let acceptor = t!(TcpListener::bind(&addr));
|
let acceptor = t!(TcpListener::bind(&addr));
|
||||||
|
@ -94,6 +96,7 @@ fn connect_loopback() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn smoke_test() {
|
fn smoke_test() {
|
||||||
each_ip(&mut |addr| {
|
each_ip(&mut |addr| {
|
||||||
let acceptor = t!(TcpListener::bind(&addr));
|
let acceptor = t!(TcpListener::bind(&addr));
|
||||||
|
@ -114,6 +117,7 @@ fn smoke_test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn read_eof() {
|
fn read_eof() {
|
||||||
each_ip(&mut |addr| {
|
each_ip(&mut |addr| {
|
||||||
let acceptor = t!(TcpListener::bind(&addr));
|
let acceptor = t!(TcpListener::bind(&addr));
|
||||||
|
@ -133,6 +137,7 @@ fn read_eof() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn write_close() {
|
fn write_close() {
|
||||||
each_ip(&mut |addr| {
|
each_ip(&mut |addr| {
|
||||||
let acceptor = t!(TcpListener::bind(&addr));
|
let acceptor = t!(TcpListener::bind(&addr));
|
||||||
|
@ -161,6 +166,7 @@ fn write_close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn multiple_connect_serial() {
|
fn multiple_connect_serial() {
|
||||||
each_ip(&mut |addr| {
|
each_ip(&mut |addr| {
|
||||||
let max = 10;
|
let max = 10;
|
||||||
|
@ -183,6 +189,7 @@ fn multiple_connect_serial() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn multiple_connect_interleaved_greedy_schedule() {
|
fn multiple_connect_interleaved_greedy_schedule() {
|
||||||
const MAX: usize = 10;
|
const MAX: usize = 10;
|
||||||
each_ip(&mut |addr| {
|
each_ip(&mut |addr| {
|
||||||
|
@ -220,6 +227,7 @@ fn multiple_connect_interleaved_greedy_schedule() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn multiple_connect_interleaved_lazy_schedule() {
|
fn multiple_connect_interleaved_lazy_schedule() {
|
||||||
const MAX: usize = 10;
|
const MAX: usize = 10;
|
||||||
each_ip(&mut |addr| {
|
each_ip(&mut |addr| {
|
||||||
|
@ -255,6 +263,7 @@ fn multiple_connect_interleaved_lazy_schedule() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn socket_and_peer_name() {
|
fn socket_and_peer_name() {
|
||||||
each_ip(&mut |addr| {
|
each_ip(&mut |addr| {
|
||||||
let listener = t!(TcpListener::bind(&addr));
|
let listener = t!(TcpListener::bind(&addr));
|
||||||
|
@ -270,6 +279,7 @@ fn socket_and_peer_name() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn partial_read() {
|
fn partial_read() {
|
||||||
each_ip(&mut |addr| {
|
each_ip(&mut |addr| {
|
||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
|
@ -291,6 +301,7 @@ fn partial_read() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn read_buf() {
|
fn read_buf() {
|
||||||
each_ip(&mut |addr| {
|
each_ip(&mut |addr| {
|
||||||
let srv = t!(TcpListener::bind(&addr));
|
let srv = t!(TcpListener::bind(&addr));
|
||||||
|
@ -389,6 +400,7 @@ fn double_bind() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn tcp_clone_smoke() {
|
fn tcp_clone_smoke() {
|
||||||
each_ip(&mut |addr| {
|
each_ip(&mut |addr| {
|
||||||
let acceptor = t!(TcpListener::bind(&addr));
|
let acceptor = t!(TcpListener::bind(&addr));
|
||||||
|
@ -420,6 +432,7 @@ fn tcp_clone_smoke() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn tcp_clone_two_read() {
|
fn tcp_clone_two_read() {
|
||||||
each_ip(&mut |addr| {
|
each_ip(&mut |addr| {
|
||||||
let acceptor = t!(TcpListener::bind(&addr));
|
let acceptor = t!(TcpListener::bind(&addr));
|
||||||
|
@ -454,6 +467,7 @@ fn tcp_clone_two_read() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn tcp_clone_two_write() {
|
fn tcp_clone_two_write() {
|
||||||
each_ip(&mut |addr| {
|
each_ip(&mut |addr| {
|
||||||
let acceptor = t!(TcpListener::bind(&addr));
|
let acceptor = t!(TcpListener::bind(&addr));
|
||||||
|
@ -483,6 +497,7 @@ fn tcp_clone_two_write() {
|
||||||
#[test]
|
#[test]
|
||||||
// FIXME: https://github.com/fortanix/rust-sgx/issues/110
|
// FIXME: https://github.com/fortanix/rust-sgx/issues/110
|
||||||
#[cfg_attr(target_env = "sgx", ignore)]
|
#[cfg_attr(target_env = "sgx", ignore)]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn shutdown_smoke() {
|
fn shutdown_smoke() {
|
||||||
each_ip(&mut |addr| {
|
each_ip(&mut |addr| {
|
||||||
let a = t!(TcpListener::bind(&addr));
|
let a = t!(TcpListener::bind(&addr));
|
||||||
|
@ -505,6 +520,7 @@ fn shutdown_smoke() {
|
||||||
#[test]
|
#[test]
|
||||||
// FIXME: https://github.com/fortanix/rust-sgx/issues/110
|
// FIXME: https://github.com/fortanix/rust-sgx/issues/110
|
||||||
#[cfg_attr(target_env = "sgx", ignore)]
|
#[cfg_attr(target_env = "sgx", ignore)]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn close_readwrite_smoke() {
|
fn close_readwrite_smoke() {
|
||||||
each_ip(&mut |addr| {
|
each_ip(&mut |addr| {
|
||||||
let a = t!(TcpListener::bind(&addr));
|
let a = t!(TcpListener::bind(&addr));
|
||||||
|
@ -547,6 +563,7 @@ fn close_readwrite_smoke() {
|
||||||
#[cfg_attr(target_env = "sgx", ignore)]
|
#[cfg_attr(target_env = "sgx", ignore)]
|
||||||
// On windows, shutdown will not wake up blocking I/O operations.
|
// On windows, shutdown will not wake up blocking I/O operations.
|
||||||
#[cfg_attr(windows, ignore)]
|
#[cfg_attr(windows, ignore)]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn close_read_wakes_up() {
|
fn close_read_wakes_up() {
|
||||||
each_ip(&mut |addr| {
|
each_ip(&mut |addr| {
|
||||||
let listener = t!(TcpListener::bind(&addr));
|
let listener = t!(TcpListener::bind(&addr));
|
||||||
|
@ -574,6 +591,7 @@ fn close_read_wakes_up() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn clone_while_reading() {
|
fn clone_while_reading() {
|
||||||
each_ip(&mut |addr| {
|
each_ip(&mut |addr| {
|
||||||
let accept = t!(TcpListener::bind(&addr));
|
let accept = t!(TcpListener::bind(&addr));
|
||||||
|
@ -614,6 +632,7 @@ fn clone_while_reading() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn clone_accept_smoke() {
|
fn clone_accept_smoke() {
|
||||||
each_ip(&mut |addr| {
|
each_ip(&mut |addr| {
|
||||||
let a = t!(TcpListener::bind(&addr));
|
let a = t!(TcpListener::bind(&addr));
|
||||||
|
@ -632,6 +651,7 @@ fn clone_accept_smoke() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn clone_accept_concurrent() {
|
fn clone_accept_concurrent() {
|
||||||
each_ip(&mut |addr| {
|
each_ip(&mut |addr| {
|
||||||
let a = t!(TcpListener::bind(&addr));
|
let a = t!(TcpListener::bind(&addr));
|
||||||
|
@ -670,10 +690,10 @@ fn debug() {
|
||||||
addr.to_string()
|
addr.to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(any(unix, target_os = "wasi"))]
|
||||||
|
use crate::os::fd::AsRawFd;
|
||||||
#[cfg(target_env = "sgx")]
|
#[cfg(target_env = "sgx")]
|
||||||
use crate::os::fortanix_sgx::io::AsRawFd;
|
use crate::os::fortanix_sgx::io::AsRawFd;
|
||||||
#[cfg(unix)]
|
|
||||||
use crate::os::unix::io::AsRawFd;
|
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
fn render_inner(addr: &dyn AsRawFd) -> impl fmt::Debug {
|
fn render_inner(addr: &dyn AsRawFd) -> impl fmt::Debug {
|
||||||
addr.as_raw_fd()
|
addr.as_raw_fd()
|
||||||
|
@ -714,6 +734,7 @@ fn debug() {
|
||||||
ignore
|
ignore
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31
|
#[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // timeout not supported
|
||||||
#[test]
|
#[test]
|
||||||
fn timeouts() {
|
fn timeouts() {
|
||||||
let addr = next_test_ip4();
|
let addr = next_test_ip4();
|
||||||
|
@ -742,6 +763,7 @@ fn timeouts() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31
|
#[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // timeout not supported
|
||||||
fn test_read_timeout() {
|
fn test_read_timeout() {
|
||||||
let addr = next_test_ip4();
|
let addr = next_test_ip4();
|
||||||
let listener = t!(TcpListener::bind(&addr));
|
let listener = t!(TcpListener::bind(&addr));
|
||||||
|
@ -763,6 +785,7 @@ fn test_read_timeout() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31
|
#[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // timeout not supported
|
||||||
fn test_read_with_timeout() {
|
fn test_read_with_timeout() {
|
||||||
let addr = next_test_ip4();
|
let addr = next_test_ip4();
|
||||||
let listener = t!(TcpListener::bind(&addr));
|
let listener = t!(TcpListener::bind(&addr));
|
||||||
|
@ -810,6 +833,7 @@ fn test_timeout_zero_duration() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_env = "sgx", ignore)]
|
#[cfg_attr(target_env = "sgx", ignore)]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // linger not supported
|
||||||
fn linger() {
|
fn linger() {
|
||||||
let addr = next_test_ip4();
|
let addr = next_test_ip4();
|
||||||
let _listener = t!(TcpListener::bind(&addr));
|
let _listener = t!(TcpListener::bind(&addr));
|
||||||
|
@ -879,6 +903,7 @@ fn set_nonblocking() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31
|
#[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn peek() {
|
fn peek() {
|
||||||
each_ip(&mut |addr| {
|
each_ip(&mut |addr| {
|
||||||
let (txdone, rxdone) = channel();
|
let (txdone, rxdone) = channel();
|
||||||
|
|
|
@ -1,4 +1,12 @@
|
||||||
#[cfg(all(test, not(any(target_os = "emscripten", target_env = "sgx", target_os = "xous"))))]
|
#[cfg(all(
|
||||||
|
test,
|
||||||
|
not(any(
|
||||||
|
target_os = "emscripten",
|
||||||
|
all(target_os = "wasi", target_env = "p1"),
|
||||||
|
target_env = "sgx",
|
||||||
|
target_os = "xous"
|
||||||
|
))
|
||||||
|
))]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
use crate::fmt;
|
use crate::fmt;
|
||||||
|
|
|
@ -27,6 +27,7 @@ fn bind_error() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn socket_smoke_test_ip4() {
|
fn socket_smoke_test_ip4() {
|
||||||
each_ip(&mut |server_ip, client_ip| {
|
each_ip(&mut |server_ip, client_ip| {
|
||||||
let (tx1, rx1) = channel();
|
let (tx1, rx1) = channel();
|
||||||
|
@ -69,6 +70,7 @@ fn socket_peer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn udp_clone_smoke() {
|
fn udp_clone_smoke() {
|
||||||
each_ip(&mut |addr1, addr2| {
|
each_ip(&mut |addr1, addr2| {
|
||||||
let sock1 = t!(UdpSocket::bind(&addr1));
|
let sock1 = t!(UdpSocket::bind(&addr1));
|
||||||
|
@ -98,6 +100,7 @@ fn udp_clone_smoke() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn udp_clone_two_read() {
|
fn udp_clone_two_read() {
|
||||||
each_ip(&mut |addr1, addr2| {
|
each_ip(&mut |addr1, addr2| {
|
||||||
let sock1 = t!(UdpSocket::bind(&addr1));
|
let sock1 = t!(UdpSocket::bind(&addr1));
|
||||||
|
@ -130,6 +133,7 @@ fn udp_clone_two_read() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // no threads
|
||||||
fn udp_clone_two_write() {
|
fn udp_clone_two_write() {
|
||||||
each_ip(&mut |addr1, addr2| {
|
each_ip(&mut |addr1, addr2| {
|
||||||
let sock1 = t!(UdpSocket::bind(&addr1));
|
let sock1 = t!(UdpSocket::bind(&addr1));
|
||||||
|
@ -183,6 +187,7 @@ fn debug() {
|
||||||
any(target_os = "netbsd", target_os = "openbsd", target_os = "vxworks", target_os = "nto"),
|
any(target_os = "netbsd", target_os = "openbsd", target_os = "vxworks", target_os = "nto"),
|
||||||
ignore
|
ignore
|
||||||
)]
|
)]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // timeout not supported
|
||||||
#[test]
|
#[test]
|
||||||
fn timeouts() {
|
fn timeouts() {
|
||||||
let addr = next_test_ip4();
|
let addr = next_test_ip4();
|
||||||
|
@ -208,6 +213,7 @@ fn timeouts() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // timeout not supported
|
||||||
fn test_read_timeout() {
|
fn test_read_timeout() {
|
||||||
let addr = next_test_ip4();
|
let addr = next_test_ip4();
|
||||||
|
|
||||||
|
@ -232,6 +238,7 @@ fn test_read_timeout() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // timeout not supported
|
||||||
fn test_read_with_timeout() {
|
fn test_read_with_timeout() {
|
||||||
let addr = next_test_ip4();
|
let addr = next_test_ip4();
|
||||||
|
|
||||||
|
@ -291,6 +298,7 @@ fn connect_send_recv() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // peek not supported
|
||||||
fn connect_send_peek_recv() {
|
fn connect_send_peek_recv() {
|
||||||
each_ip(&mut |addr, _| {
|
each_ip(&mut |addr, _| {
|
||||||
let socket = t!(UdpSocket::bind(&addr));
|
let socket = t!(UdpSocket::bind(&addr));
|
||||||
|
@ -313,6 +321,7 @@ fn connect_send_peek_recv() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)] // peek_from not supported
|
||||||
fn peek_from() {
|
fn peek_from() {
|
||||||
each_ip(&mut |addr, _| {
|
each_ip(&mut |addr, _| {
|
||||||
let socket = t!(UdpSocket::bind(&addr));
|
let socket = t!(UdpSocket::bind(&addr));
|
||||||
|
|
|
@ -139,7 +139,7 @@ fn test_pathbuf_leak() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(unix)]
|
#[cfg(any(unix, target_os = "wasi"))]
|
||||||
pub fn test_decompositions_unix() {
|
pub fn test_decompositions_unix() {
|
||||||
t!("",
|
t!("",
|
||||||
iter: [],
|
iter: [],
|
||||||
|
@ -1201,7 +1201,10 @@ pub fn test_push() {
|
||||||
});
|
});
|
||||||
);
|
);
|
||||||
|
|
||||||
if cfg!(unix) || cfg!(all(target_env = "sgx", target_vendor = "fortanix")) {
|
if cfg!(unix)
|
||||||
|
|| cfg!(target_os = "wasi")
|
||||||
|
|| cfg!(all(target_env = "sgx", target_vendor = "fortanix"))
|
||||||
|
{
|
||||||
tp!("", "foo", "foo");
|
tp!("", "foo", "foo");
|
||||||
tp!("foo", "bar", "foo/bar");
|
tp!("foo", "bar", "foo/bar");
|
||||||
tp!("foo/", "bar", "foo/bar");
|
tp!("foo/", "bar", "foo/bar");
|
||||||
|
@ -1358,7 +1361,10 @@ pub fn test_set_file_name() {
|
||||||
tfn!("foo", "bar", "bar");
|
tfn!("foo", "bar", "bar");
|
||||||
tfn!("foo", "", "");
|
tfn!("foo", "", "");
|
||||||
tfn!("", "foo", "foo");
|
tfn!("", "foo", "foo");
|
||||||
if cfg!(unix) || cfg!(all(target_env = "sgx", target_vendor = "fortanix")) {
|
if cfg!(unix)
|
||||||
|
|| cfg!(target_os = "wasi")
|
||||||
|
|| cfg!(all(target_env = "sgx", target_vendor = "fortanix"))
|
||||||
|
{
|
||||||
tfn!(".", "foo", "./foo");
|
tfn!(".", "foo", "./foo");
|
||||||
tfn!("foo/", "bar", "bar");
|
tfn!("foo/", "bar", "bar");
|
||||||
tfn!("foo/.", "bar", "bar");
|
tfn!("foo/.", "bar", "bar");
|
||||||
|
@ -1758,7 +1764,7 @@ fn test_components_debug() {
|
||||||
assert_eq!(expected, actual);
|
assert_eq!(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(any(unix, target_os = "wasi"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn test_iter_debug() {
|
fn test_iter_debug() {
|
||||||
let path = Path::new("/tmp");
|
let path = Path::new("/tmp");
|
||||||
|
@ -1859,7 +1865,7 @@ fn test_ord() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(unix)]
|
#[cfg(any(unix, target_os = "wasi"))]
|
||||||
fn test_unix_absolute() {
|
fn test_unix_absolute() {
|
||||||
use crate::path::absolute;
|
use crate::path::absolute;
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,15 @@
|
||||||
#![stable(feature = "process", since = "1.0.0")]
|
#![stable(feature = "process", since = "1.0.0")]
|
||||||
#![deny(unsafe_op_in_unsafe_fn)]
|
#![deny(unsafe_op_in_unsafe_fn)]
|
||||||
|
|
||||||
#[cfg(all(test, not(any(target_os = "emscripten", target_env = "sgx", target_os = "xous"))))]
|
#[cfg(all(
|
||||||
|
test,
|
||||||
|
not(any(
|
||||||
|
target_os = "emscripten",
|
||||||
|
target_os = "wasi",
|
||||||
|
target_env = "sgx",
|
||||||
|
target_os = "xous"
|
||||||
|
))
|
||||||
|
))]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
use crate::convert::Infallible;
|
use crate::convert::Infallible;
|
||||||
|
|
|
@ -3,7 +3,7 @@ use crate::sync::{Arc, Barrier};
|
||||||
use crate::thread;
|
use crate::thread;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
|
||||||
fn test_barrier() {
|
fn test_barrier() {
|
||||||
const N: usize = 10;
|
const N: usize = 10;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ fn smoke() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
|
||||||
fn notify_one() {
|
fn notify_one() {
|
||||||
let m = Arc::new(Mutex::new(()));
|
let m = Arc::new(Mutex::new(()));
|
||||||
let m2 = m.clone();
|
let m2 = m.clone();
|
||||||
|
@ -29,7 +29,7 @@ fn notify_one() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
|
||||||
fn notify_all() {
|
fn notify_all() {
|
||||||
const N: usize = 10;
|
const N: usize = 10;
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ fn notify_all() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
|
||||||
fn wait_while() {
|
fn wait_while() {
|
||||||
let pair = Arc::new((Mutex::new(false), Condvar::new()));
|
let pair = Arc::new((Mutex::new(false), Condvar::new()));
|
||||||
let pair2 = pair.clone();
|
let pair2 = pair.clone();
|
||||||
|
@ -87,7 +87,7 @@ fn wait_while() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // condvar wait not supported
|
||||||
fn wait_timeout_wait() {
|
fn wait_timeout_wait() {
|
||||||
let m = Arc::new(Mutex::new(()));
|
let m = Arc::new(Mutex::new(()));
|
||||||
let c = Arc::new(Condvar::new());
|
let c = Arc::new(Condvar::new());
|
||||||
|
@ -106,7 +106,7 @@ fn wait_timeout_wait() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // condvar wait not supported
|
||||||
fn wait_timeout_while_wait() {
|
fn wait_timeout_while_wait() {
|
||||||
let m = Arc::new(Mutex::new(()));
|
let m = Arc::new(Mutex::new(()));
|
||||||
let c = Arc::new(Condvar::new());
|
let c = Arc::new(Condvar::new());
|
||||||
|
@ -118,7 +118,7 @@ fn wait_timeout_while_wait() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // condvar wait not supported
|
||||||
fn wait_timeout_while_instant_satisfy() {
|
fn wait_timeout_while_instant_satisfy() {
|
||||||
let m = Arc::new(Mutex::new(()));
|
let m = Arc::new(Mutex::new(()));
|
||||||
let c = Arc::new(Condvar::new());
|
let c = Arc::new(Condvar::new());
|
||||||
|
@ -130,7 +130,7 @@ fn wait_timeout_while_instant_satisfy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
|
||||||
fn wait_timeout_while_wake() {
|
fn wait_timeout_while_wake() {
|
||||||
let pair = Arc::new((Mutex::new(false), Condvar::new()));
|
let pair = Arc::new((Mutex::new(false), Condvar::new()));
|
||||||
let pair_copy = pair.clone();
|
let pair_copy = pair.clone();
|
||||||
|
@ -153,7 +153,7 @@ fn wait_timeout_while_wake() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
|
||||||
fn wait_timeout_wake() {
|
fn wait_timeout_wake() {
|
||||||
let m = Arc::new(Mutex::new(()));
|
let m = Arc::new(Mutex::new(()));
|
||||||
let c = Arc::new(Condvar::new());
|
let c = Arc::new(Condvar::new());
|
||||||
|
|
|
@ -34,6 +34,7 @@ fn lazy_default() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
|
||||||
fn lazy_poisoning() {
|
fn lazy_poisoning() {
|
||||||
let x: LazyCell<String> = LazyCell::new(|| panic!("kaboom"));
|
let x: LazyCell<String> = LazyCell::new(|| panic!("kaboom"));
|
||||||
for _ in 0..2 {
|
for _ in 0..2 {
|
||||||
|
@ -43,7 +44,7 @@ fn lazy_poisoning() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
|
||||||
fn sync_lazy_new() {
|
fn sync_lazy_new() {
|
||||||
static CALLED: AtomicUsize = AtomicUsize::new(0);
|
static CALLED: AtomicUsize = AtomicUsize::new(0);
|
||||||
static SYNC_LAZY: LazyLock<i32> = LazyLock::new(|| {
|
static SYNC_LAZY: LazyLock<i32> = LazyLock::new(|| {
|
||||||
|
@ -90,7 +91,7 @@ fn sync_lazy_default() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
|
||||||
fn static_sync_lazy() {
|
fn static_sync_lazy() {
|
||||||
static XS: LazyLock<Vec<i32>> = LazyLock::new(|| {
|
static XS: LazyLock<Vec<i32>> = LazyLock::new(|| {
|
||||||
let mut xs = Vec::new();
|
let mut xs = Vec::new();
|
||||||
|
@ -123,6 +124,7 @@ fn static_sync_lazy_via_fn() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
|
||||||
fn sync_lazy_poisoning() {
|
fn sync_lazy_poisoning() {
|
||||||
let x: LazyLock<String> = LazyLock::new(|| panic!("kaboom"));
|
let x: LazyLock<String> = LazyLock::new(|| panic!("kaboom"));
|
||||||
for _ in 0..2 {
|
for _ in 0..2 {
|
||||||
|
|
|
@ -137,10 +137,10 @@
|
||||||
|
|
||||||
#![stable(feature = "rust1", since = "1.0.0")]
|
#![stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
|
||||||
#[cfg(all(test, not(target_os = "emscripten")))]
|
#[cfg(all(test, not(any(target_os = "emscripten", target_os = "wasi"))))]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
#[cfg(all(test, not(target_os = "emscripten")))]
|
#[cfg(all(test, not(any(target_os = "emscripten", target_os = "wasi"))))]
|
||||||
mod sync_tests;
|
mod sync_tests;
|
||||||
|
|
||||||
// MPSC channels are built as a wrapper around MPMC channels, which
|
// MPSC channels are built as a wrapper around MPMC channels, which
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[cfg(all(test, not(target_os = "emscripten")))]
|
#[cfg(all(test, not(any(target_os = "emscripten", target_os = "wasi"))))]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
use crate::cell::UnsafeCell;
|
use crate::cell::UnsafeCell;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//! This primitive is meant to be used to run one-time initialization. An
|
//! This primitive is meant to be used to run one-time initialization. An
|
||||||
//! example use case would be for initializing an FFI library.
|
//! example use case would be for initializing an FFI library.
|
||||||
|
|
||||||
#[cfg(all(test, not(target_os = "emscripten")))]
|
#[cfg(all(test, not(any(target_os = "emscripten", target_os = "wasi"))))]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
use crate::fmt;
|
use crate::fmt;
|
||||||
|
|
|
@ -9,7 +9,7 @@ fn spawn_and_wait<R: Send + 'static>(f: impl FnOnce() -> R + Send + 'static) ->
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
|
||||||
fn sync_once_cell() {
|
fn sync_once_cell() {
|
||||||
static ONCE_CELL: OnceLock<i32> = OnceLock::new();
|
static ONCE_CELL: OnceLock<i32> = OnceLock::new();
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ fn sync_once_cell_get_unchecked() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
|
||||||
fn sync_once_cell_drop() {
|
fn sync_once_cell_drop() {
|
||||||
static DROP_CNT: AtomicUsize = AtomicUsize::new(0);
|
static DROP_CNT: AtomicUsize = AtomicUsize::new(0);
|
||||||
struct Dropper;
|
struct Dropper;
|
||||||
|
@ -81,6 +81,7 @@ fn clone() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
|
||||||
fn get_or_try_init() {
|
fn get_or_try_init() {
|
||||||
let cell: OnceLock<String> = OnceLock::new();
|
let cell: OnceLock<String> = OnceLock::new();
|
||||||
assert!(cell.get().is_none());
|
assert!(cell.get().is_none());
|
||||||
|
@ -154,7 +155,7 @@ fn eval_once_macro() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
|
||||||
fn sync_once_cell_does_not_leak_partially_constructed_boxes() {
|
fn sync_once_cell_does_not_leak_partially_constructed_boxes() {
|
||||||
static ONCE_CELL: OnceLock<String> = OnceLock::new();
|
static ONCE_CELL: OnceLock<String> = OnceLock::new();
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[cfg(all(test, not(target_os = "emscripten")))]
|
#[cfg(all(test, not(any(target_os = "emscripten", target_os = "wasi"))))]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
use cfg_if::cfg_if;
|
use cfg_if::cfg_if;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[cfg(all(test, not(target_os = "emscripten")))]
|
#[cfg(all(test, not(any(target_os = "emscripten", target_os = "wasi"))))]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
use crate::cell::UnsafeCell;
|
use crate::cell::UnsafeCell;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
pub const DEFAULT_BUF_SIZE: usize = if cfg!(target_os = "espidf") { 512 } else { 8 * 1024 };
|
pub const DEFAULT_BUF_SIZE: usize = if cfg!(target_os = "espidf") { 512 } else { 8 * 1024 };
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[allow(dead_code)] // not used on emscripten
|
#[allow(dead_code)] // not used on emscripten and wasi
|
||||||
pub mod test {
|
pub mod test {
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#![unstable(feature = "thread_local_internals", issue = "none")]
|
#![unstable(feature = "thread_local_internals", issue = "none")]
|
||||||
|
|
||||||
#[cfg(all(test, not(target_os = "emscripten")))]
|
#[cfg(all(test, not(any(target_os = "emscripten", target_os = "wasi"))))]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
|
@ -155,7 +155,7 @@
|
||||||
// Under `test`, `__FastLocalKeyInner` seems unused.
|
// Under `test`, `__FastLocalKeyInner` seems unused.
|
||||||
#![cfg_attr(test, allow(dead_code))]
|
#![cfg_attr(test, allow(dead_code))]
|
||||||
|
|
||||||
#[cfg(all(test, not(target_os = "emscripten")))]
|
#[cfg(all(test, not(any(target_os = "emscripten", target_os = "wasi"))))]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
use crate::any::Any;
|
use crate::any::Any;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![cfg(all(test, not(any(target_os = "emscripten", target_env = "sgx"))))]
|
#![cfg(all(test, not(any(target_os = "emscripten", target_os = "wasi", target_env = "sgx"))))]
|
||||||
|
|
||||||
//! Note that this test changes the current directory so
|
//! Note that this test changes the current directory so
|
||||||
//! should not be in the same process as other tests.
|
//! should not be in the same process as other tests.
|
||||||
|
|
|
@ -5,7 +5,7 @@ use std::{env, fs, process, str};
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(miri, ignore)] // Process spawning not supported by Miri
|
#[cfg_attr(any(miri, target_os = "wasi"), ignore)] // Process spawning not supported by Miri and wasi
|
||||||
fn issue_15149() {
|
fn issue_15149() {
|
||||||
// If we're the parent, copy our own binary to a new directory.
|
// If we're the parent, copy our own binary to a new directory.
|
||||||
let my_path = env::current_exe().unwrap();
|
let my_path = env::current_exe().unwrap();
|
||||||
|
|
|
@ -4,7 +4,7 @@ use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
|
||||||
#[cfg_attr(miri, ignore)] // Miri does not like the thread leak
|
#[cfg_attr(miri, ignore)] // Miri does not like the thread leak
|
||||||
fn sleep_very_long() {
|
fn sleep_very_long() {
|
||||||
let finished = Arc::new(Mutex::new(false));
|
let finished = Arc::new(Mutex::new(false));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue