diff options
Diffstat (limited to 'test/sys/test_ptrace.rs')
-rw-r--r-- | test/sys/test_ptrace.rs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/test/sys/test_ptrace.rs b/test/sys/test_ptrace.rs index d3e579f3..debc4517 100644 --- a/test/sys/test_ptrace.rs +++ b/test/sys/test_ptrace.rs @@ -30,9 +30,8 @@ fn test_ptrace_getevent() { // Just make sure ptrace_getsiginfo can be called at all, for now. #[test] fn test_ptrace_getsiginfo() { - match ptrace::getsiginfo(getpid()) { - Err(Error::UnsupportedOperation) => panic!("ptrace_getsiginfo returns Error::UnsupportedOperation!"), - _ => (), + if let Err(Error::UnsupportedOperation) = ptrace::getsiginfo(getpid()) { + panic!("ptrace_getsiginfo returns Error::UnsupportedOperation!"); } } @@ -40,9 +39,8 @@ fn test_ptrace_getsiginfo() { #[test] fn test_ptrace_setsiginfo() { let siginfo = unsafe { mem::uninitialized() }; - match ptrace::setsiginfo(getpid(), &siginfo) { - Err(Error::UnsupportedOperation) => panic!("ptrace_setsiginfo returns Error::UnsupportedOperation!"), - _ => (), + if let Err(Error::UnsupportedOperation) = ptrace::setsiginfo(getpid(), &siginfo) { + panic!("ptrace_setsiginfo returns Error::UnsupportedOperation!"); } } @@ -66,8 +64,8 @@ fn test_ptrace_cont() { return; } - match fork() { - Ok(Child) => { + match fork().expect("Error: Fork Failed") { + Child => { ptrace::traceme().unwrap(); // As recommended by ptrace(2), raise SIGTRAP to pause the child // until the parent is ready to continue @@ -76,7 +74,7 @@ fn test_ptrace_cont() { } }, - Ok(Parent { child }) => { + Parent { child } => { assert_eq!(waitpid(child, None), Ok(WaitStatus::Stopped(child, Signal::SIGTRAP))); ptrace::cont(child, None).unwrap(); assert_eq!(waitpid(child, None), Ok(WaitStatus::Stopped(child, Signal::SIGTRAP))); @@ -86,6 +84,5 @@ fn test_ptrace_cont() { _ => panic!("The process should have been killed"), } }, - Err(_) => panic!("Error: Fork Failed") } } |