From bb06a0cf0e60ef09782a41b76d5204498355193a Mon Sep 17 00:00:00 2001 From: David Cook Date: Sat, 28 Mar 2020 09:35:51 -0500 Subject: [PATCH] Restrict mutex static initializer test to Linux On macOS, libc does not have a static initializer for recursive mutexes --- tests/run-pass/sync.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/run-pass/sync.rs b/tests/run-pass/sync.rs index 025ae81372cf..24d7b0be5342 100644 --- a/tests/run-pass/sync.rs +++ b/tests/run-pass/sync.rs @@ -10,10 +10,13 @@ fn main() { { test_mutex_libc_init_recursive(); test_mutex_libc_init_normal(); - test_mutex_libc_static_initializer_recursive(); test_rwlock_stdlib(); test_rwlock_libc_static_initializer(); } + #[cfg(target_os = "linux")] + { + test_mutex_libc_static_initializer_recursive(); + } } fn test_mutex_stdlib() { @@ -64,7 +67,7 @@ fn test_mutex_libc_init_normal() { } } -#[cfg(not(target_os = "windows"))] +#[cfg(target_os = "linux")] fn test_mutex_libc_static_initializer_recursive() { let mutex = std::cell::UnsafeCell::new(libc::PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP); unsafe {