summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGeoffrey Thomas <geofft@ldpreload.com>2017-06-20 01:13:29 -0400
committerGeoffrey Thomas <geofft@ldpreload.com>2017-07-08 22:30:57 -0400
commit0bf5af584c11ffa22c452fb89dcbea70c03e018c (patch)
treebecd6175b6484edd75e3160c712d61324a8b8403 /test
parent46e77b57d51118278b2f224b4dd3cde0ad38aa8d (diff)
downloadnix-0bf5af584c11ffa22c452fb89dcbea70c03e018c.zip
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.
Diffstat (limited to 'test')
-rw-r--r--test/sys/mod.rs2
-rw-r--r--test/sys/test_ptrace.rs14
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));
+}