summaryrefslogtreecommitdiff
path: root/test/sys
diff options
context:
space:
mode:
Diffstat (limited to 'test/sys')
-rw-r--r--test/sys/mod.rs1
-rw-r--r--test/sys/test_epoll.rs20
2 files changed, 21 insertions, 0 deletions
diff --git a/test/sys/mod.rs b/test/sys/mod.rs
index 6176eb32..b073ccf7 100644
--- a/test/sys/mod.rs
+++ b/test/sys/mod.rs
@@ -6,3 +6,4 @@ mod test_ioctl;
mod test_wait;
mod test_select;
mod test_uio;
+mod test_epoll;
diff --git a/test/sys/test_epoll.rs b/test/sys/test_epoll.rs
new file mode 100644
index 00000000..965c7d06
--- /dev/null
+++ b/test/sys/test_epoll.rs
@@ -0,0 +1,20 @@
+use nix::sys::epoll::{EpollCreateFlags, EpollFlags, EpollOp, EpollEvent};
+use nix::sys::epoll::{EPOLLIN, EPOLLERR};
+use nix::sys::epoll::{epoll_create1, epoll_ctl};
+use nix::{Error, Errno};
+
+#[test]
+pub fn test_epoll_errno() {
+ let efd = epoll_create1(EpollCreateFlags::empty()).unwrap();
+ let result = epoll_ctl(efd, EpollOp::EpollCtlDel, 1, None);
+ assert!(result.is_err());
+ assert_eq!(result.unwrap_err(), Error::Sys(Errno::ENOENT));
+}
+
+#[test]
+pub fn test_epoll_ctl() {
+ let efd = epoll_create1(EpollCreateFlags::empty()).unwrap();
+ let mut event = EpollEvent::new(EPOLLIN | EPOLLERR, 1);
+ epoll_ctl(efd, EpollOp::EpollCtlAdd, 1, &mut event).unwrap();
+ epoll_ctl(efd, EpollOp::EpollCtlDel, 1, None).unwrap();
+}