From e261dcf93e37b11b022b46fcc5eed699f0c3bcb7 Mon Sep 17 00:00:00 2001 From: Bryant Mairs Date: Fri, 1 Jun 2018 20:18:18 -0700 Subject: [PATCH] Remove tests that weren't mine --- test/sys/test_socket.rs | 62 ----------------------------------------- 1 file changed, 62 deletions(-) diff --git a/test/sys/test_socket.rs b/test/sys/test_socket.rs index 5d57ac174b..a997fbca9e 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); -}