diff options
author | Ryan Zoeller <rtzoeller@rtzoeller.com> | 2021-11-27 13:50:29 -0600 |
---|---|---|
committer | Ryan Zoeller <rtzoeller@rtzoeller.com> | 2021-11-27 13:50:29 -0600 |
commit | 09bddc36769b4be38b6ce567c3352e2934204771 (patch) | |
tree | 679be22f4cdb6c9775b2da67551bca55c61900bc /test/sys/test_signal.rs | |
parent | b91bce3113c79728e84b1a24a565b5cac6333f52 (diff) | |
download | nix-09bddc36769b4be38b6ce567c3352e2934204771.zip |
Avoid lock poisoning by using parking_lot
parking_lot provides synchronization primitives which aren't
poisoned on panic. This makes it easier to determine which tests
are failing, as a test failure no longer causes all subsequent tests
using that mutex to fail.
Diffstat (limited to 'test/sys/test_signal.rs')
-rw-r--r-- | test/sys/test_signal.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/sys/test_signal.rs b/test/sys/test_signal.rs index 1b89af57..fdd2568d 100644 --- a/test/sys/test_signal.rs +++ b/test/sys/test_signal.rs @@ -19,7 +19,7 @@ fn test_killpg_none() { #[test] fn test_old_sigaction_flags() { - let _m = crate::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test"); + let _m = crate::SIGNAL_MTX.lock(); extern "C" fn handler(_: ::libc::c_int) {} let act = SigAction::new( @@ -41,7 +41,7 @@ fn test_sigprocmask_noop() { #[test] fn test_sigprocmask() { - let _m = crate::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test"); + let _m = crate::SIGNAL_MTX.lock(); // This needs to be a signal that rust doesn't use in the test harness. const SIGNAL: Signal = Signal::SIGCHLD; @@ -89,7 +89,7 @@ extern fn test_sigaction_action(_: libc::c_int, _: *mut libc::siginfo_t, _: *mut #[test] #[cfg(not(target_os = "redox"))] fn test_signal_sigaction() { - let _m = crate::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test"); + let _m = crate::SIGNAL_MTX.lock(); let action_handler = SigHandler::SigAction(test_sigaction_action); assert_eq!(unsafe { signal(Signal::SIGINT, action_handler) }.unwrap_err(), Errno::ENOTSUP); @@ -97,7 +97,7 @@ fn test_signal_sigaction() { #[test] fn test_signal() { - let _m = crate::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test"); + let _m = crate::SIGNAL_MTX.lock(); unsafe { signal(Signal::SIGINT, SigHandler::SigIgn) }.unwrap(); raise(Signal::SIGINT).unwrap(); |