summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/sys/test_socket.rs62
1 files changed, 0 insertions, 62 deletions
diff --git a/test/sys/test_socket.rs b/test/sys/test_socket.rs
index 5d57ac17..a997fbca 100644
--- a/test/sys/test_socket.rs
+++ b/test/sys/test_socket.rs
@@ -255,65 +255,3 @@ pub fn test_syscontrol() {
// requires root privileges
// connect(fd, &sockaddr).expect("connect failed");
}
-
-/// Test non-blocking mode on new sockets via SockFlag::O_NONBLOCK
-#[cfg(any(target_os = "android",
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "linux",
- target_os = "netbsd",
- target_os = "openbsd"))]
-#[test]
-pub fn test_sockflag_nonblock() {
- use libc;
- use nix::fcntl::{fcntl};
- use nix::fcntl::FcntlArg::{F_GETFL};
- use nix::sys::socket::{socket, AddressFamily, SockType, SockFlag};
-
- /* first, try without SockFlag::SOCK_NONBLOCK */
- let sock = socket(AddressFamily::Unix, SockType::Stream, SockFlag::empty(), None)
- .expect("socket failed");
-
- let fcntl_res = fcntl(sock, F_GETFL).expect("fcntl failed");
-
- assert!(fcntl_res & libc::O_NONBLOCK == 0);
-
- /* next, try with SockFlag::SOCK_NONBLOCK */
- let sock = socket(AddressFamily::Unix, SockType::Stream, SockFlag::SOCK_NONBLOCK, None)
- .expect("socket failed");
-
- let fcntl_res = fcntl(sock, F_GETFL).expect("fcntl failed");
-
- assert!(fcntl_res & libc::O_NONBLOCK == libc::O_NONBLOCK);
-}
-
-/// Test close-on-exec on new sockets via SockFlag::SOCK_CLOEXEC
-#[cfg(any(target_os = "android",
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "linux",
- target_os = "netbsd",
- target_os = "openbsd"))]
-#[test]
-pub fn test_sockflag_cloexec() {
- use libc;
- use nix::fcntl::{fcntl};
- use nix::fcntl::FcntlArg::{F_GETFD};
- use nix::sys::socket::{socket, AddressFamily, SockType, SockFlag};
-
- /* first, test without SockFlag::SOCK_CLOEXEC */
- let sock = socket(AddressFamily::Unix, SockType::Stream, SockFlag::empty(), None)
- .expect("socket failed");
-
- let fcntl_res = fcntl(sock, F_GETFD).expect("fcntl failed");
-
- assert!(fcntl_res & libc::FD_CLOEXEC == 0);
-
- /* next, test without SockFlag::SOCK_CLOEXEC */
- let sock = socket(AddressFamily::Unix, SockType::Stream, SockFlag::SOCK_CLOEXEC, None)
- .expect("socket failed");
-
- let fcntl_res = fcntl(sock, F_GETFD).expect("fcntl failed");
-
- assert!(fcntl_res & libc::FD_CLOEXEC == libc::FD_CLOEXEC);
-}