summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBryant Mairs <bryant@mai.rs>2017-07-17 16:12:40 -0700
committerBryant Mairs <bryant@mai.rs>2017-07-17 16:12:40 -0700
commit73ae9e012e65f631dd96f45cf7d25de678958600 (patch)
tree7d8bdcbe74f57b542a5285bc2b56836320ea8d30 /test
parent5d296505b597d29bf6b339904f7f1550febe863d (diff)
downloadnix-73ae9e012e65f631dd96f45cf7d25de678958600.zip
Fix UnsupportedOperation when using ptrace_* functions
Diffstat (limited to 'test')
-rw-r--r--test/sys/test_ptrace.rs36
1 files changed, 35 insertions, 1 deletions
diff --git a/test/sys/test_ptrace.rs b/test/sys/test_ptrace.rs
index 6318495a..57b452cb 100644
--- a/test/sys/test_ptrace.rs
+++ b/test/sys/test_ptrace.rs
@@ -3,7 +3,8 @@ use nix::errno::*;
use nix::unistd::*;
use nix::sys::ptrace::*;
use nix::sys::ptrace::ptrace::*;
-use std::ptr;
+
+use std::{mem, ptr};
#[test]
fn test_ptrace() {
@@ -12,3 +13,36 @@ fn test_ptrace() {
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));
}
+
+// Just make sure ptrace_setoptions can be called at all, for now.
+#[test]
+fn test_ptrace_setoptions() {
+ let err = ptrace_setoptions(getpid(), PTRACE_O_TRACESYSGOOD).unwrap_err();
+ assert!(err != Error::UnsupportedOperation);
+}
+
+// Just make sure ptrace_getevent can be called at all, for now.
+#[test]
+fn test_ptrace_getevent() {
+ let err = ptrace_getevent(getpid()).unwrap_err();
+ assert!(err != Error::UnsupportedOperation);
+}
+
+// Just make sure ptrace_getsiginfo can be called at all, for now.
+#[test]
+fn test_ptrace_getsiginfo() {
+ match ptrace_getsiginfo(getpid()) {
+ Err(Error::UnsupportedOperation) => panic!("ptrace_getsiginfo returns Error::UnsupportedOperation!"),
+ _ => (),
+ }
+}
+
+// Just make sure ptrace_setsiginfo can be called at all, for now.
+#[test]
+fn test_ptrace_setsiginfo() {
+ let siginfo = unsafe { mem::uninitialized() };
+ match ptrace_setsiginfo(getpid(), &siginfo) {
+ Err(Error::UnsupportedOperation) => panic!("ptrace_setsiginfo returns Error::UnsupportedOperation!"),
+ _ => (),
+ }
+}