about summary refs log tree commit diff
path: root/library/std/src/sync/once_lock
diff options
context:
space:
mode:
authorNicola Krumschmidt <git@nkcom.de>2024-09-04 02:18:32 +0200
committerNicola Krumschmidt <git@nkcom.de>2024-09-29 04:48:13 +0200
commit87f17f3ccb69e9827562522ae1a38f84d2ba998a (patch)
treed9ca03f59b55b85e2ea912e0bb6d6349305ff3b2 /library/std/src/sync/once_lock
parent3b11c82a3d625a01dd5f7b91785374103eb41589 (diff)
downloadrust-87f17f3ccb69e9827562522ae1a38f84d2ba998a.tar.gz
rust-87f17f3ccb69e9827562522ae1a38f84d2ba998a.zip
Fix std tests for wasm32-wasip2 target
Diffstat (limited to 'library/std/src/sync/once_lock')
-rw-r--r--library/std/src/sync/once_lock/tests.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/library/std/src/sync/once_lock/tests.rs b/library/std/src/sync/once_lock/tests.rs
index 1fff3273d20..5113d436c3c 100644
--- a/library/std/src/sync/once_lock/tests.rs
+++ b/library/std/src/sync/once_lock/tests.rs
@@ -9,7 +9,7 @@ fn spawn_and_wait<R: Send + 'static>(f: impl FnOnce() -> R + Send + 'static) ->
 }
 
 #[test]
-#[cfg_attr(target_os = "emscripten", ignore)]
+#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
 fn sync_once_cell() {
     static ONCE_CELL: OnceLock<i32> = OnceLock::new();
 
@@ -43,7 +43,7 @@ fn sync_once_cell_get_unchecked() {
 }
 
 #[test]
-#[cfg_attr(target_os = "emscripten", ignore)]
+#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
 fn sync_once_cell_drop() {
     static DROP_CNT: AtomicUsize = AtomicUsize::new(0);
     struct Dropper;
@@ -81,6 +81,7 @@ fn clone() {
 }
 
 #[test]
+#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
 fn get_or_try_init() {
     let cell: OnceLock<String> = OnceLock::new();
     assert!(cell.get().is_none());
@@ -154,7 +155,7 @@ fn eval_once_macro() {
 }
 
 #[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() {
     static ONCE_CELL: OnceLock<String> = OnceLock::new();