diff options
Diffstat (limited to 'test/sys/test_ptrace.rs')
-rw-r--r-- | test/sys/test_ptrace.rs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/test/sys/test_ptrace.rs b/test/sys/test_ptrace.rs index b8309a74..985945d1 100644 --- a/test/sys/test_ptrace.rs +++ b/test/sys/test_ptrace.rs @@ -1,4 +1,3 @@ -use nix::Error; use nix::errno::Errno; use nix::unistd::getpid; use nix::sys::ptrace; @@ -16,8 +15,8 @@ fn test_ptrace() { // FIXME: qemu-user doesn't implement ptrace on all arches, so permit ENOSYS require_capability!(CAP_SYS_PTRACE); let err = ptrace::attach(getpid()).unwrap_err(); - assert!(err == Error(Errno::EPERM) || err == Error(Errno::EINVAL) || - err == Error(Errno::ENOSYS)); + assert!(err == Errno::EPERM || err == Errno::EINVAL || + err == Errno::ENOSYS); } // Just make sure ptrace_setoptions can be called at all, for now. @@ -26,7 +25,7 @@ fn test_ptrace() { fn test_ptrace_setoptions() { require_capability!(CAP_SYS_PTRACE); let err = ptrace::setoptions(getpid(), Options::PTRACE_O_TRACESYSGOOD).unwrap_err(); - assert!(err != Error(Errno::EOPNOTSUPP)); + assert!(err != Errno::EOPNOTSUPP); } // Just make sure ptrace_getevent can be called at all, for now. @@ -35,7 +34,7 @@ fn test_ptrace_setoptions() { fn test_ptrace_getevent() { require_capability!(CAP_SYS_PTRACE); let err = ptrace::getevent(getpid()).unwrap_err(); - assert!(err != Error(Errno::EOPNOTSUPP)); + assert!(err != Errno::EOPNOTSUPP); } // Just make sure ptrace_getsiginfo can be called at all, for now. @@ -43,8 +42,8 @@ fn test_ptrace_getevent() { #[cfg(any(target_os = "android", target_os = "linux"))] fn test_ptrace_getsiginfo() { require_capability!(CAP_SYS_PTRACE); - if let Err(Error(Errno::EOPNOTSUPP)) = ptrace::getsiginfo(getpid()) { - panic!("ptrace_getsiginfo returns Error(Errno::EOPNOTSUPP)!"); + if let Err(Errno::EOPNOTSUPP) = ptrace::getsiginfo(getpid()) { + panic!("ptrace_getsiginfo returns Errno::EOPNOTSUPP!"); } } @@ -54,8 +53,8 @@ fn test_ptrace_getsiginfo() { fn test_ptrace_setsiginfo() { require_capability!(CAP_SYS_PTRACE); let siginfo = unsafe { mem::zeroed() }; - if let Err(Error(Errno::EOPNOTSUPP)) = ptrace::setsiginfo(getpid(), &siginfo) { - panic!("ptrace_setsiginfo returns Error(Errno::EOPNOTSUPP)!"); + if let Err(Errno::EOPNOTSUPP) = ptrace::setsiginfo(getpid(), &siginfo) { + panic!("ptrace_setsiginfo returns Errno::EOPNOTSUPP!"); } } @@ -79,7 +78,7 @@ fn test_ptrace_cont() { // On valid platforms the ptrace call should return Errno::EPERM, this // is already tested by `test_ptrace`. let err = ptrace::attach(getpid()).unwrap_err(); - if err == Error(Errno::ENOSYS) { + if err == Errno::ENOSYS { return; } |