summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/sys/test_aio.rs6
-rw-r--r--test/sys/test_signal.rs3
-rw-r--r--test/sys/test_signalfd.rs3
-rw-r--r--test/sys/test_termios.rs9
-rw-r--r--test/sys/test_uio.rs3
-rw-r--r--test/sys/test_wait.rs9
-rw-r--r--test/test_pty.rs20
-rw-r--r--test/test_unistd.rs21
8 files changed, 25 insertions, 49 deletions
diff --git a/test/sys/test_aio.rs b/test/sys/test_aio.rs
index 48399fbd..d4b09b0b 100644
--- a/test/sys/test_aio.rs
+++ b/test/sys/test_aio.rs
@@ -441,8 +441,7 @@ extern fn sigfunc(_: c_int) {
#[test]
#[cfg_attr(any(all(target_env = "musl", target_arch = "x86_64"), target_arch = "mips", target_arch = "mips64"), ignore)]
fn test_write_sigev_signal() {
- #[allow(unused_variables)]
- let m = ::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test");
+ let _m = ::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test");
let sa = SigAction::new(SigHandler::Handler(sigfunc),
SaFlags::SA_RESETHAND,
SigSet::empty());
@@ -580,8 +579,7 @@ fn test_liocb_listio_nowait() {
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
#[cfg_attr(any(target_arch = "mips", target_arch = "mips64", target_env = "musl"), ignore)]
fn test_liocb_listio_signal() {
- #[allow(unused_variables)]
- let m = ::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test");
+ let _m = ::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test");
const INITIAL: &[u8] = b"abcdef123456";
const WBUF: &[u8] = b"CDEF";
let mut rbuf = vec![0; 4];
diff --git a/test/sys/test_signal.rs b/test/sys/test_signal.rs
index 7d3a9bf2..c8dd9776 100644
--- a/test/sys/test_signal.rs
+++ b/test/sys/test_signal.rs
@@ -28,8 +28,7 @@ fn test_sigprocmask_noop() {
#[test]
fn test_sigprocmask() {
- #[allow(unused_variables)]
- let m = ::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test");
+ let _m = ::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test");
// This needs to be a signal that rust doesn't use in the test harness.
const SIGNAL: Signal = Signal::SIGCHLD;
diff --git a/test/sys/test_signalfd.rs b/test/sys/test_signalfd.rs
index a2f8fd8f..a3b60988 100644
--- a/test/sys/test_signalfd.rs
+++ b/test/sys/test_signalfd.rs
@@ -4,8 +4,7 @@ fn test_signalfd() {
use nix::sys::signal::{self, raise, Signal, SigSet};
// Grab the mutex for altering signals so we don't interfere with other tests.
- #[allow(unused_variables)]
- let m = ::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test");
+ let _m = ::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test");
// Block the SIGUSR1 signal from automatic processing for this thread
let mut mask = SigSet::empty();
diff --git a/test/sys/test_termios.rs b/test/sys/test_termios.rs
index 831fc18b..a14b8ce1 100644
--- a/test/sys/test_termios.rs
+++ b/test/sys/test_termios.rs
@@ -19,8 +19,7 @@ fn write_all(f: RawFd, buf: &[u8]) {
#[test]
fn test_tcgetattr_pty() {
// openpty uses ptname(3) internally
- #[allow(unused_variables)]
- let m = ::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test");
+ let _m = ::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test");
let pty = openpty(None, None).expect("openpty failed");
assert!(termios::tcgetattr(pty.master).is_ok());
@@ -47,8 +46,7 @@ fn test_tcgetattr_ebadf() {
#[test]
fn test_output_flags() {
// openpty uses ptname(3) internally
- #[allow(unused_variables)]
- let m = ::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test");
+ let _m = ::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test");
// Open one pty to get attributes for the second one
let mut termios = {
@@ -90,8 +88,7 @@ fn test_output_flags() {
#[test]
fn test_local_flags() {
// openpty uses ptname(3) internally
- #[allow(unused_variables)]
- let m = ::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test");
+ let _m = ::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test");
// Open one pty to get attributes for the second one
let mut termios = {
diff --git a/test/sys/test_uio.rs b/test/sys/test_uio.rs
index 727194d5..3e4fc28c 100644
--- a/test/sys/test_uio.rs
+++ b/test/sys/test_uio.rs
@@ -200,8 +200,7 @@ fn test_process_vm_readv() {
use nix::sys::signal::*;
use nix::sys::wait::*;
- #[allow(unused_variables)]
- let m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test");
+ let _ = ::FORK_MTX.lock().expect("Mutex got poisoned by another test");
// Pre-allocate memory in the child, since allocation isn't safe
// post-fork (~= async-signal-safe)
diff --git a/test/sys/test_wait.rs b/test/sys/test_wait.rs
index 2f68e7c4..d07d82f0 100644
--- a/test/sys/test_wait.rs
+++ b/test/sys/test_wait.rs
@@ -7,8 +7,7 @@ use libc::_exit;
#[test]
fn test_wait_signal() {
- #[allow(unused_variables)]
- let m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test");
+ let _ = ::FORK_MTX.lock().expect("Mutex got poisoned by another test");
// Safe: The child only calls `pause` and/or `_exit`, which are async-signal-safe.
match fork().expect("Error: Fork Failed") {
@@ -25,8 +24,7 @@ fn test_wait_signal() {
#[test]
fn test_wait_exit() {
- #[allow(unused_variables)]
- let m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test");
+ let _m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test");
// Safe: Child only calls `_exit`, which is async-signal-safe.
match fork().expect("Error: Fork Failed") {
@@ -96,8 +94,7 @@ mod ptrace {
#[test]
fn test_wait_ptrace() {
- #[allow(unused_variables)]
- let m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test");
+ let _m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test");
match fork().expect("Error: Fork Failed") {
Child => ptrace_child(),
diff --git a/test/test_pty.rs b/test/test_pty.rs
index 0adcc99f..4f428bed 100644
--- a/test/test_pty.rs
+++ b/test/test_pty.rs
@@ -27,8 +27,7 @@ fn test_explicit_close() {
#[test]
#[cfg(any(target_os = "android", target_os = "linux"))]
fn test_ptsname_equivalence() {
- #[allow(unused_variables)]
- let m = ::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test");
+ let _m = ::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test");
// Open a new PTTY master
let master_fd = posix_openpt(OFlag::O_RDWR).unwrap();
@@ -45,8 +44,7 @@ fn test_ptsname_equivalence() {
#[test]
#[cfg(any(target_os = "android", target_os = "linux"))]
fn test_ptsname_copy() {
- #[allow(unused_variables)]
- let m = ::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test");
+ let _m = ::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test");
// Open a new PTTY master
let master_fd = posix_openpt(OFlag::O_RDWR).unwrap();
@@ -80,8 +78,7 @@ fn test_ptsname_r_copy() {
#[test]
#[cfg(any(target_os = "android", target_os = "linux"))]
fn test_ptsname_unique() {
- #[allow(unused_variables)]
- let m = ::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test");
+ let _m = ::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test");
// Open a new PTTY master
let master1_fd = posix_openpt(OFlag::O_RDWR).unwrap();
@@ -103,9 +100,8 @@ fn test_ptsname_unique() {
/// this test we perform the basic act of getting a file handle for a connect master/slave PTTY
/// pair.
#[test]
-fn test_open_ptty_pair() {
- #[allow(unused_variables)]
- let m = ::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test");
+fn test_open_ptty_pair() {
+ let _m = ::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test");
// Open a new PTTY master
let master_fd = posix_openpt(OFlag::O_RDWR).expect("posix_openpt failed");
@@ -126,8 +122,7 @@ fn test_open_ptty_pair() {
#[test]
fn test_openpty() {
// openpty uses ptname(3) internally
- #[allow(unused_variables)]
- let m = ::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test");
+ let _m = ::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test");
let pty = openpty(None, None).unwrap();
assert!(pty.master > 0);
@@ -162,8 +157,7 @@ fn test_openpty() {
#[test]
fn test_openpty_with_termios() {
// openpty uses ptname(3) internally
- #[allow(unused_variables)]
- let m = ::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test");
+ let _m = ::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test");
// Open one pty to get attributes for the second one
let mut termios = {
diff --git a/test/test_unistd.rs b/test/test_unistd.rs
index d36a3d39..39c0952e 100644
--- a/test/test_unistd.rs
+++ b/test/test_unistd.rs
@@ -14,8 +14,7 @@ use libc::{self, _exit, off_t};
#[test]
fn test_fork_and_waitpid() {
- #[allow(unused_variables)]
- let m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test");
+ let _m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test");
// Safe: Child only calls `_exit`, which is signal-safe
match fork().expect("Error: Fork Failed") {
@@ -43,8 +42,7 @@ fn test_fork_and_waitpid() {
#[test]
fn test_wait() {
// Grab FORK_MTX so wait doesn't reap a different test's child process
- #[allow(unused_variables)]
- let m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test");
+ let _m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test");
// Safe: Child only calls `_exit`, which is signal-safe
match fork().expect("Error: Fork Failed") {
@@ -136,8 +134,7 @@ fn test_setgroups() {
return;
}
- #[allow(unused_variables)]
- let m = ::GROUPS_MTX.lock().expect("Mutex got poisoned by another test");
+ let _m = ::GROUPS_MTX.lock().expect("Mutex got poisoned by another test");
// Save the existing groups
let old_groups = getgroups().unwrap();
@@ -166,8 +163,7 @@ fn test_initgroups() {
return;
}
- #[allow(unused_variables)]
- let m = ::GROUPS_MTX.lock().expect("Mutex got poisoned by another test");
+ let _m = ::GROUPS_MTX.lock().expect("Mutex got poisoned by another test");
// Save the existing groups
let old_groups = getgroups().unwrap();
@@ -195,8 +191,7 @@ macro_rules! execve_test_factory(
($test_name:ident, $syscall:ident, $exe: expr $(, $pathname:expr, $flags:expr)*) => (
#[test]
fn $test_name() {
- #[allow(unused_variables)]
- let m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test");
+ let _m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test");
// The `exec`d process will write to `writer`, and we'll read that
// data from `reader`.
let (reader, writer) = pipe().unwrap();
@@ -280,8 +275,7 @@ cfg_if!{
#[test]
fn test_fchdir() {
// fchdir changes the process's cwd
- #[allow(unused_variables)]
- let m = ::CWD_MTX.lock().expect("Mutex got poisoned by another test");
+ let _m = ::CWD_MTX.lock().expect("Mutex got poisoned by another test");
let tmpdir = tempfile::tempdir().unwrap();
let tmpdir_path = tmpdir.path().canonicalize().unwrap();
@@ -296,8 +290,7 @@ fn test_fchdir() {
#[test]
fn test_getcwd() {
// chdir changes the process's cwd
- #[allow(unused_variables)]
- let m = ::CWD_MTX.lock().expect("Mutex got poisoned by another test");
+ let _m = ::CWD_MTX.lock().expect("Mutex got poisoned by another test");
let tmpdir = tempfile::tempdir().unwrap();
let tmpdir_path = tmpdir.path().canonicalize().unwrap();