diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/sys/test_ptrace.rs | 10 | ||||
-rw-r--r-- | test/test_mq.rs | 18 |
2 files changed, 13 insertions, 15 deletions
diff --git a/test/sys/test_ptrace.rs b/test/sys/test_ptrace.rs index 38cf408b..b9793b39 100644 --- a/test/sys/test_ptrace.rs +++ b/test/sys/test_ptrace.rs @@ -100,7 +100,7 @@ fn test_ptrace_cont() { ptrace::cont(child, Some(Signal::SIGKILL)).unwrap(); match waitpid(child, None) { Ok(WaitStatus::Signaled(pid, Signal::SIGKILL, _)) if pid == child => { - // FIXME It's been observed on some systems (apple) the + // FIXME It's been observed on some systems (apple) the // tracee may not be killed but remain as a zombie process // affecting other wait based tests. Add an extra kill just // to make sure there are no zombies. @@ -150,11 +150,11 @@ fn test_ptrace_syscall() { // set this option to recognize syscall-stops ptrace::setoptions(child, ptrace::Options::PTRACE_O_TRACESYSGOOD).unwrap(); - #[cfg(target_pointer_width = "64")] - let get_syscall_id = || ptrace::getregs(child).unwrap().orig_rax as i64; + #[cfg(target_arch = "x86_64")] + let get_syscall_id = || ptrace::getregs(child).unwrap().orig_rax as libc::c_long; - #[cfg(target_pointer_width = "32")] - let get_syscall_id = || ptrace::getregs(child).unwrap().orig_eax as i32; + #[cfg(target_arch = "x86")] + let get_syscall_id = || ptrace::getregs(child).unwrap().orig_eax as libc::c_long; // kill entry ptrace::syscall(child, None).unwrap(); diff --git a/test/test_mq.rs b/test/test_mq.rs index ecee2009..1667a35b 100644 --- a/test/test_mq.rs +++ b/test/test_mq.rs @@ -1,17 +1,15 @@ -use libc::c_long; - use std::ffi::CString; use std::str; use nix::errno::Errno::*; use nix::Error::Sys; -use nix::mqueue::{mq_open, mq_close, mq_send, mq_receive}; +use nix::mqueue::{mq_open, mq_close, mq_send, mq_receive, mq_attr_member_t}; use nix::mqueue::{MqAttr, MQ_OFlag}; use nix::sys::stat::Mode; #[test] fn test_mq_send_and_receive() { - const MSG_SIZE: c_long = 32; + const MSG_SIZE: mq_attr_member_t = 32; let attr = MqAttr::new(0, 10, MSG_SIZE, 0); let mq_name= &CString::new(b"/a_nix_test_queue".as_ref()).unwrap(); @@ -43,7 +41,7 @@ fn test_mq_send_and_receive() { #[cfg(not(any(target_os = "netbsd")))] fn test_mq_getattr() { use nix::mqueue::mq_getattr; - const MSG_SIZE: c_long = 32; + const MSG_SIZE: mq_attr_member_t = 32; let initial_attr = MqAttr::new(0, 10, MSG_SIZE, 0); let mq_name = &CString::new(b"/attr_test_get_attr".as_ref()).unwrap(); let oflag = MQ_OFlag::O_CREAT | MQ_OFlag::O_WRONLY; @@ -66,7 +64,7 @@ fn test_mq_getattr() { #[cfg_attr(any(target_arch = "mips", target_arch = "mips64"), ignore)] fn test_mq_setattr() { use nix::mqueue::{mq_getattr, mq_setattr}; - const MSG_SIZE: c_long = 32; + const MSG_SIZE: mq_attr_member_t = 32; let initial_attr = MqAttr::new(0, 10, MSG_SIZE, 0); let mq_name = &CString::new(b"/attr_test_get_attr".as_ref()).unwrap(); let oflag = MQ_OFlag::O_CREAT | MQ_OFlag::O_WRONLY; @@ -87,7 +85,7 @@ fn test_mq_setattr() { // O_NONBLOCK can be set (see tests below) assert_ne!(new_attr_get, new_attr); - let new_attr_non_blocking = MqAttr::new(MQ_OFlag::O_NONBLOCK.bits() as c_long, 10, MSG_SIZE, 0); + let new_attr_non_blocking = MqAttr::new(MQ_OFlag::O_NONBLOCK.bits() as mq_attr_member_t, 10, MSG_SIZE, 0); mq_setattr(mqd, &new_attr_non_blocking).unwrap(); let new_attr_get = mq_getattr(mqd).unwrap(); @@ -103,7 +101,7 @@ fn test_mq_setattr() { #[cfg_attr(any(target_arch = "mips", target_arch = "mips64"), ignore)] fn test_mq_set_nonblocking() { use nix::mqueue::{mq_getattr, mq_set_nonblock, mq_remove_nonblock}; - const MSG_SIZE: c_long = 32; + const MSG_SIZE: mq_attr_member_t = 32; let initial_attr = MqAttr::new(0, 10, MSG_SIZE, 0); let mq_name = &CString::new(b"/attr_test_get_attr".as_ref()).unwrap(); let oflag = MQ_OFlag::O_CREAT | MQ_OFlag::O_WRONLY; @@ -116,7 +114,7 @@ fn test_mq_set_nonblocking() { let mqd = r.unwrap(); mq_set_nonblock(mqd).unwrap(); let new_attr = mq_getattr(mqd); - assert_eq!(new_attr.unwrap().flags(), MQ_OFlag::O_NONBLOCK.bits() as c_long); + assert_eq!(new_attr.unwrap().flags(), MQ_OFlag::O_NONBLOCK.bits() as mq_attr_member_t); mq_remove_nonblock(mqd).unwrap(); let new_attr = mq_getattr(mqd); assert_eq!(new_attr.unwrap().flags(), 0); @@ -127,7 +125,7 @@ fn test_mq_set_nonblocking() { #[cfg(not(any(target_os = "netbsd")))] fn test_mq_unlink() { use nix::mqueue::mq_unlink; - const MSG_SIZE: c_long = 32; + const MSG_SIZE: mq_attr_member_t = 32; let initial_attr = MqAttr::new(0, 10, MSG_SIZE, 0); let mq_name_opened = &CString::new(b"/mq_unlink_test".as_ref()).unwrap(); let mq_name_not_opened = &CString::new(b"/mq_unlink_test".as_ref()).unwrap(); |