summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorxd009642 <danielmckenna93@gmail.com>2017-08-12 16:49:08 +0100
committerxd009642 <danielmckenna93@gmail.com>2017-08-28 10:35:55 +0100
commit33249db1c0f20491947c92e092961171a7bd4f68 (patch)
tree9b0eee9a4b3cf8323480b8c12a1705b43555289f /test
parentb569cfc1e9bb3b665fb0d4c4fe1084bfa3feb6ba (diff)
downloadnix-33249db1c0f20491947c92e092961171a7bd4f68.zip
Moved ptrace constants into enum types added minor functionality.
Used the libc_enum! macro to create enums for the ptrace event, request, and libc_bitflags for options constants defined in libc. Also, replicated functionality to move from c_int to PtraceEvent enum in PR #728 as it appears to be abandoned. Added utility function for detaching from tracee. Updated names and removed ptrace::ptrace namespace
Diffstat (limited to 'test')
-rw-r--r--test/sys/test_ptrace.rs3
-rw-r--r--test/sys/test_wait.rs4
2 files changed, 3 insertions, 4 deletions
diff --git a/test/sys/test_ptrace.rs b/test/sys/test_ptrace.rs
index 16b24110..20cde1aa 100644
--- a/test/sys/test_ptrace.rs
+++ b/test/sys/test_ptrace.rs
@@ -16,8 +16,7 @@ fn test_ptrace() {
// Just make sure ptrace_setoptions can be called at all, for now.
#[test]
fn test_ptrace_setoptions() {
- use nix::sys::ptrace::ptrace::PTRACE_O_TRACESYSGOOD;
- let err = ptrace::setoptions(getpid(), PTRACE_O_TRACESYSGOOD).unwrap_err();
+ let err = ptrace::setoptions(getpid(), ptrace::PTRACE_O_TRACESYSGOOD).unwrap_err();
assert!(err != Error::UnsupportedOperation);
}
diff --git a/test/sys/test_wait.rs b/test/sys/test_wait.rs
index 0193e262..0fcaa19c 100644
--- a/test/sys/test_wait.rs
+++ b/test/sys/test_wait.rs
@@ -55,7 +55,7 @@ fn test_waitstatus_pid() {
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
mod ptrace {
use nix::sys::ptrace;
- use nix::sys::ptrace::ptrace::*;
+ use nix::sys::ptrace::*;
use nix::sys::signal::*;
use nix::sys::wait::*;
use nix::unistd::*;
@@ -81,7 +81,7 @@ mod ptrace {
assert_eq!(waitpid(child, None), Ok(WaitStatus::PtraceSyscall(child)));
// Then get the ptrace event for the process exiting
assert!(ptrace::cont(child, None).is_ok());
- assert_eq!(waitpid(child, None), Ok(WaitStatus::PtraceEvent(child, SIGTRAP, PTRACE_EVENT_EXIT)));
+ assert_eq!(waitpid(child, None), Ok(WaitStatus::PtraceEvent(child, SIGTRAP, Event::PTRACE_EVENT_EXIT as i32)));
// Finally get the normal wait() result, now that the process has exited
assert!(ptrace::cont(child, None).is_ok());
assert_eq!(waitpid(child, None), Ok(WaitStatus::Exited(child, 0)));