diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2017-07-09 16:23:25 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2017-07-09 16:23:25 +0000 |
commit | 1b1f15c27c73197bc256220644440a2d0874d9aa (patch) | |
tree | ee1c727795207605f07dd0a1a041316b18adb5aa /test | |
parent | 930de3811f024d7e6e5fda3da527d122f9a24279 (diff) | |
parent | 0bf5af584c11ffa22c452fb89dcbea70c03e018c (diff) | |
download | nix-1b1f15c27c73197bc256220644440a2d0874d9aa.zip |
Merge #624
624: Enable ptrace on all Linux platforms r=Susurrus
Nothing that nix currently binds is architecture-specific, and Android
supports ptrace just as much as non-Android Linux.
Diffstat (limited to 'test')
-rw-r--r-- | test/sys/mod.rs | 2 | ||||
-rw-r--r-- | test/sys/test_ptrace.rs | 14 |
2 files changed, 16 insertions, 0 deletions
diff --git a/test/sys/mod.rs b/test/sys/mod.rs index e93b0d28..4edb6af0 100644 --- a/test/sys/mod.rs +++ b/test/sys/mod.rs @@ -13,3 +13,5 @@ mod test_uio; #[cfg(target_os = "linux")] mod test_epoll; mod test_pthread; +#[cfg(any(target_os = "linux", target_os = "android"))] +mod test_ptrace; diff --git a/test/sys/test_ptrace.rs b/test/sys/test_ptrace.rs new file mode 100644 index 00000000..6318495a --- /dev/null +++ b/test/sys/test_ptrace.rs @@ -0,0 +1,14 @@ +use nix::Error; +use nix::errno::*; +use nix::unistd::*; +use nix::sys::ptrace::*; +use nix::sys::ptrace::ptrace::*; +use std::ptr; + +#[test] +fn test_ptrace() { + // Just make sure ptrace can be called at all, for now. + // FIXME: qemu-user doesn't implement ptrace on all arches, so permit ENOSYS + let err = ptrace(PTRACE_ATTACH, getpid(), ptr::null_mut(), ptr::null_mut()).unwrap_err(); + assert!(err == Error::Sys(Errno::EPERM) || err == Error::Sys(Errno::ENOSYS)); +} |