diff options
author | Bryant Mairs <bryantmairs@google.com> | 2017-11-21 22:27:15 -0800 |
---|---|---|
committer | Bryant Mairs <bryantmairs@google.com> | 2017-12-02 10:46:34 -0800 |
commit | e1baab9dc132f18e13f446df0271a5e46723848d (patch) | |
tree | 3e4e6714d843edc493dfc3cf879d659bbd264e65 /test/test_poll.rs | |
parent | d374a1ecd3f69027a2ce28e87806f459ef3f9105 (diff) | |
download | nix-e1baab9dc132f18e13f446df0271a5e46723848d.zip |
Upgrade to Bitflags 1.0
The libc_bitflags! macro was replaced with a non-recursive one supporting
only public structs. I could not figure out how to make the old macro work
with the upgrade, so I reworked part of the bitflags! macro directly to suit
our needs, much as the original recursive macro was made. There are no uses
of this macro for non-public structs, so this is not a problem for internal code.
Diffstat (limited to 'test/test_poll.rs')
-rw-r--r-- | test/test_poll.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/test/test_poll.rs b/test/test_poll.rs index a48604f9..c28c8fd8 100644 --- a/test/test_poll.rs +++ b/test/test_poll.rs @@ -1,4 +1,4 @@ -use nix::poll::*; +use nix::poll::{EventFlags, poll, PollFd}; use nix::sys::signal::SigSet; use nix::sys::time::{TimeSpec, TimeValLike}; use nix::unistd::{write, pipe}; @@ -6,19 +6,19 @@ use nix::unistd::{write, pipe}; #[test] fn test_poll() { let (r, w) = pipe().unwrap(); - let mut fds = [PollFd::new(r, POLLIN)]; + let mut fds = [PollFd::new(r, EventFlags::POLLIN)]; // Poll an idle pipe. Should timeout let nfds = poll(&mut fds, 100).unwrap(); assert_eq!(nfds, 0); - assert!(!fds[0].revents().unwrap().contains(POLLIN)); + assert!(!fds[0].revents().unwrap().contains(EventFlags::POLLIN)); write(w, b".").unwrap(); // Poll a readable pipe. Should return an event. let nfds = poll(&mut fds, 100).unwrap(); assert_eq!(nfds, 1); - assert!(fds[0].revents().unwrap().contains(POLLIN)); + assert!(fds[0].revents().unwrap().contains(EventFlags::POLLIN)); } // ppoll(2) is the same as poll except for how it handles timeouts and signals. @@ -30,19 +30,20 @@ fn test_poll() { target_os = "linux"))] #[test] fn test_ppoll() { + use nix::poll::ppoll; let timeout = TimeSpec::milliseconds(1); let (r, w) = pipe().unwrap(); - let mut fds = [PollFd::new(r, POLLIN)]; + let mut fds = [PollFd::new(r, EventFlags::POLLIN)]; // Poll an idle pipe. Should timeout let nfds = ppoll(&mut fds, timeout, SigSet::empty()).unwrap(); assert_eq!(nfds, 0); - assert!(!fds[0].revents().unwrap().contains(POLLIN)); + assert!(!fds[0].revents().unwrap().contains(EventFlags::POLLIN)); write(w, b".").unwrap(); // Poll a readable pipe. Should return an event. let nfds = ppoll(&mut fds, timeout, SigSet::empty()).unwrap(); assert_eq!(nfds, 1); - assert!(fds[0].revents().unwrap().contains(POLLIN)); + assert!(fds[0].revents().unwrap().contains(EventFlags::POLLIN)); } |