From 1ae5dd8b16aed61958fd3ce488ed7fd459743652 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Sun, 31 May 2020 15:17:16 -0600 Subject: Convert the crate to edition 2018 --- test/sys/test_aio.rs | 4 ++-- test/sys/test_aio_drop.rs | 3 --- test/sys/test_lio_listio_resubmit.rs | 4 ---- test/sys/test_ptrace.rs | 4 ++-- test/sys/test_select.rs | 2 +- test/sys/test_signal.rs | 8 ++++---- test/sys/test_signalfd.rs | 2 +- test/sys/test_termios.rs | 8 ++++---- test/sys/test_uio.rs | 2 +- test/sys/test_wait.rs | 8 ++++---- 10 files changed, 19 insertions(+), 26 deletions(-) (limited to 'test/sys') diff --git a/test/sys/test_aio.rs b/test/sys/test_aio.rs index d03adc5e..6b9bd911 100644 --- a/test/sys/test_aio.rs +++ b/test/sys/test_aio.rs @@ -445,7 +445,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() { - let _m = ::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test"); + let _m = crate::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test"); let sa = SigAction::new(SigHandler::Handler(sigfunc), SaFlags::SA_RESETHAND, SigSet::empty()); @@ -583,7 +583,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() { - let _m = ::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test"); + let _m = crate::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_aio_drop.rs b/test/sys/test_aio_drop.rs index 492da401..71a2183b 100644 --- a/test/sys/test_aio_drop.rs +++ b/test/sys/test_aio_drop.rs @@ -1,6 +1,3 @@ -extern crate nix; -extern crate tempfile; - // Test dropping an AioCb that hasn't yet finished. // This must happen in its own process, because on OSX this test seems to hose // the AIO subsystem and causes subsequent tests to fail diff --git a/test/sys/test_lio_listio_resubmit.rs b/test/sys/test_lio_listio_resubmit.rs index 19ee3fac..0795370b 100644 --- a/test/sys/test_lio_listio_resubmit.rs +++ b/test/sys/test_lio_listio_resubmit.rs @@ -4,10 +4,6 @@ // we must disable the test here rather than in Cargo.toml #![cfg(target_os = "freebsd")] -extern crate nix; -extern crate sysctl; -extern crate tempfile; - use nix::Error; use nix::errno::*; use nix::libc::off_t; diff --git a/test/sys/test_ptrace.rs b/test/sys/test_ptrace.rs index cb2f04e9..05f407cc 100644 --- a/test/sys/test_ptrace.rs +++ b/test/sys/test_ptrace.rs @@ -68,7 +68,7 @@ fn test_ptrace_cont() { require_capability!(CAP_SYS_PTRACE); - let _m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test"); + let _m = crate::FORK_MTX.lock().expect("Mutex got poisoned by another test"); // FIXME: qemu-user doesn't implement ptrace on all architectures // and retunrs ENOSYS in this case. @@ -128,7 +128,7 @@ fn test_ptrace_syscall() { use nix::unistd::getpid; use nix::unistd::ForkResult::*; - let _m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test"); + let _m = crate::FORK_MTX.lock().expect("Mutex got poisoned by another test"); match fork().expect("Error: Fork Failed") { Child => { diff --git a/test/sys/test_select.rs b/test/sys/test_select.rs index cf68700c..37951086 100644 --- a/test/sys/test_select.rs +++ b/test/sys/test_select.rs @@ -5,7 +5,7 @@ use nix::sys::time::{TimeSpec, TimeValLike}; #[test] pub fn test_pselect() { - let _mtx = ::SIGNAL_MTX + let _mtx = crate::SIGNAL_MTX .lock() .expect("Mutex got poisoned by another test"); diff --git a/test/sys/test_signal.rs b/test/sys/test_signal.rs index 1c3a25f8..5e0b2762 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 = ::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test"); + let _m = crate::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test"); 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 = ::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test"); + let _m = crate::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; @@ -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 = ::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test"); + let _m = crate::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test"); let action_handler = SigHandler::SigAction(test_sigaction_action); assert_eq!(unsafe { signal(Signal::SIGINT, action_handler) }.unwrap_err(), Error::UnsupportedOperation); @@ -97,7 +97,7 @@ fn test_signal_sigaction() { #[test] fn test_signal() { - let _m = ::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test"); + let _m = crate::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test"); unsafe { signal(Signal::SIGINT, SigHandler::SigIgn) }.unwrap(); raise(Signal::SIGINT).unwrap(); diff --git a/test/sys/test_signalfd.rs b/test/sys/test_signalfd.rs index 92759a48..af04c222 100644 --- a/test/sys/test_signalfd.rs +++ b/test/sys/test_signalfd.rs @@ -6,7 +6,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. - let _m = ::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test"); + let _m = crate::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 a14b8ce1..40b47af4 100644 --- a/test/sys/test_termios.rs +++ b/test/sys/test_termios.rs @@ -19,7 +19,7 @@ fn write_all(f: RawFd, buf: &[u8]) { #[test] fn test_tcgetattr_pty() { // openpty uses ptname(3) internally - let _m = ::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test"); + let _m = crate::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()); @@ -46,7 +46,7 @@ fn test_tcgetattr_ebadf() { #[test] fn test_output_flags() { // openpty uses ptname(3) internally - let _m = ::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test"); + let _m = crate::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test"); // Open one pty to get attributes for the second one let mut termios = { @@ -77,7 +77,7 @@ fn test_output_flags() { // Read from the slave verifying that the output has been properly transformed let mut buf = [0u8; 10]; - ::read_exact(pty.slave, &mut buf); + crate::read_exact(pty.slave, &mut buf); let transformed_string = "foofoofoo\n"; close(pty.master).unwrap(); close(pty.slave).unwrap(); @@ -88,7 +88,7 @@ fn test_output_flags() { #[test] fn test_local_flags() { // openpty uses ptname(3) internally - let _m = ::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test"); + let _m = crate::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 d0025b87..236560f4 100644 --- a/test/sys/test_uio.rs +++ b/test/sys/test_uio.rs @@ -205,7 +205,7 @@ fn test_process_vm_readv() { use nix::sys::wait::*; require_capability!(CAP_SYS_PTRACE); - let _ = ::FORK_MTX.lock().expect("Mutex got poisoned by another test"); + let _ = crate::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 6b0fb321..53b7c84a 100644 --- a/test/sys/test_wait.rs +++ b/test/sys/test_wait.rs @@ -8,7 +8,7 @@ use libc::_exit; #[test] #[cfg(not(target_os = "redox"))] fn test_wait_signal() { - let _ = ::FORK_MTX.lock().expect("Mutex got poisoned by another test"); + let _ = crate::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,7 +25,7 @@ fn test_wait_signal() { #[test] fn test_wait_exit() { - let _m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test"); + let _m = crate::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") { @@ -46,7 +46,7 @@ fn test_waitstatus_from_raw() { #[test] fn test_waitstatus_pid() { - let _m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test"); + let _m = crate::FORK_MTX.lock().expect("Mutex got poisoned by another test"); match fork().unwrap() { Child => unsafe { _exit(0) }, @@ -96,7 +96,7 @@ mod ptrace { #[test] fn test_wait_ptrace() { require_capability!(CAP_SYS_PTRACE); - let _m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test"); + let _m = crate::FORK_MTX.lock().expect("Mutex got poisoned by another test"); match fork().expect("Error: Fork Failed") { Child => ptrace_child(), -- cgit v1.2.3