summaryrefslogtreecommitdiff
path: root/test/sys/test_ptrace.rs
diff options
context:
space:
mode:
Diffstat (limited to 'test/sys/test_ptrace.rs')
-rw-r--r--test/sys/test_ptrace.rs14
1 files changed, 14 insertions, 0 deletions
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));
+}