-
Notifications
You must be signed in to change notification settings - Fork 677
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #480 and add simple test cases for that.
r? @fiveop
- Loading branch information
Showing
3 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ mod test_ioctl; | |
mod test_wait; | ||
mod test_select; | ||
mod test_uio; | ||
mod test_epoll; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} |