From 0bf5af584c11ffa22c452fb89dcbea70c03e018c Mon Sep 17 00:00:00 2001 From: Geoffrey Thomas Date: Tue, 20 Jun 2017 01:13:29 -0400 Subject: Enable ptrace on all Linux platforms Nothing that nix currently binds is architecture-specific, and Android supports ptrace just as much as non-Android Linux. --- test/sys/mod.rs | 2 ++ test/sys/test_ptrace.rs | 14 ++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 test/sys/test_ptrace.rs (limited to 'test') 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)); +} -- cgit v1.2.3