Skip to content

Commit 08b17fb

Browse files
committed
fix: some tests for cygwin
1 parent 08120c7 commit 08b17fb

File tree

7 files changed

+26
-10
lines changed

7 files changed

+26
-10
lines changed

src/sys/socket/addr.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,8 @@ impl SockaddrLike for UnixAddr {
530530
linux_android,
531531
target_os = "fuchsia",
532532
solarish,
533-
target_os = "redox"
533+
target_os = "redox",
534+
target_os = "cygwin",
534535
))]
535536
fn len(&self) -> libc::socklen_t {
536537
self.sun_len.into()
@@ -1171,6 +1172,7 @@ impl SockaddrLike for SockaddrStorage {
11711172
linux_android,
11721173
target_os = "fuchsia",
11731174
solarish,
1175+
target_os = "cygwin",
11741176
))]
11751177
if i32::from(ss.ss_family) == libc::AF_UNIX {
11761178
// Safe because we UnixAddr is strictly smaller than
@@ -1227,7 +1229,7 @@ impl SockaddrLike for SockaddrStorage {
12271229
}
12281230
}
12291231

1230-
#[cfg(any(linux_android, target_os = "fuchsia", solarish))]
1232+
#[cfg(any(linux_android, target_os = "fuchsia", solarish, target_os = "cygwin"))]
12311233
fn len(&self) -> libc::socklen_t {
12321234
match self.as_unix_addr() {
12331235
// The UnixAddr type knows its own length
@@ -1289,6 +1291,7 @@ impl SockaddrStorage {
12891291
if #[cfg(any(linux_android,
12901292
target_os = "fuchsia",
12911293
solarish,
1294+
target_os = "cygwin",
12921295
))]
12931296
{
12941297
let p = unsafe{ &self.ss as *const libc::sockaddr_storage };
@@ -1318,6 +1321,7 @@ impl SockaddrStorage {
13181321
if #[cfg(any(linux_android,
13191322
target_os = "fuchsia",
13201323
solarish,
1324+
target_os = "cygwin",
13211325
))]
13221326
{
13231327
let p = unsafe{ &self.ss as *const libc::sockaddr_storage };
@@ -2193,7 +2197,7 @@ mod tests {
21932197
}
21942198
}
21952199

2196-
#[cfg(not(any(target_os = "hurd", target_os = "redox")))]
2200+
#[cfg(not(any(target_os = "hurd", target_os = "redox", target_os = "cygwin")))]
21972201
#[allow(clippy::cast_ptr_alignment)]
21982202
mod link {
21992203
#[cfg(any(apple_targets, solarish))]

test/sys/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ mod test_aio;
1919
target_os = "redox",
2020
target_os = "fuchsia",
2121
target_os = "haiku",
22-
target_os = "hurd"
22+
target_os = "hurd",
23+
target_os = "cygwin"
2324
)))]
2425
mod test_ioctl;
2526
#[cfg(not(target_os = "redox"))]

test/sys/test_pthread.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
use nix::sys::pthread::*;
22

3-
#[cfg(any(target_env = "musl", target_os = "redox", target_env = "ohos"))]
3+
#[cfg(any(
4+
target_env = "musl",
5+
target_os = "redox",
6+
target_env = "ohos",
7+
target_os = "cygwin"
8+
))]
49
#[test]
510
fn test_pthread_self() {
611
let tid = pthread_self();
@@ -10,7 +15,8 @@ fn test_pthread_self() {
1015
#[cfg(not(any(
1116
target_env = "musl",
1217
target_os = "redox",
13-
target_env = "ohos"
18+
target_env = "ohos",
19+
target_os = "cygwin"
1420
)))]
1521
#[test]
1622
fn test_pthread_self() {

test/sys/test_resource.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use nix::sys::resource::{getrusage, UsageWho};
1010
/// to put the new soft limit in effect, and then getrlimit() once more to ensure the limits have
1111
/// been updated.
1212
#[test]
13+
#[cfg_attr(target_os = "cygwin", ignore)]
1314
pub fn test_resource_limits_nofile() {
1415
let (mut soft_limit, hard_limit) =
1516
getrlimit(Resource::RLIMIT_NOFILE).unwrap();

test/sys/test_socket.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1707,6 +1707,7 @@ pub fn test_listen_maxbacklog() {
17071707
pub fn test_listen_wrongbacklog() {
17081708
use nix::sys::socket::Backlog;
17091709

1710+
#[cfg(not(target_os = "cygwin"))]
17101711
assert!(Backlog::new(libc::SOMAXCONN + 1).is_err());
17111712
assert!(Backlog::new(-2).is_err());
17121713
}
@@ -3152,7 +3153,7 @@ fn can_use_cmsg_space() {
31523153
let _ = cmsg_space!(u8);
31533154
}
31543155

3155-
#[cfg(not(any(linux_android, target_os = "redox", target_os = "haiku")))]
3156+
#[cfg(not(any(linux_android, target_os = "redox", target_os = "haiku", target_os = "cygwin")))]
31563157
#[test]
31573158
fn can_open_routing_socket() {
31583159
use nix::sys::socket::{socket, AddressFamily, SockFlag, SockType};

test/sys/test_uio.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ fn test_pread() {
144144
#[cfg(not(any(
145145
target_os = "redox",
146146
target_os = "haiku",
147-
target_os = "solaris"
147+
target_os = "solaris",
148+
target_os = "cygwin"
148149
)))]
149150
fn test_pwritev() {
150151
use std::io::Read;
@@ -183,7 +184,8 @@ fn test_pwritev() {
183184
#[cfg(not(any(
184185
target_os = "redox",
185186
target_os = "haiku",
186-
target_os = "solaris"
187+
target_os = "solaris",
188+
target_os = "cygwin"
187189
)))]
188190
fn test_preadv() {
189191
use std::io::Write;

test/test_unistd.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,8 @@ cfg_if! {
631631
#[cfg(not(any(
632632
target_os = "redox",
633633
target_os = "fuchsia",
634-
target_os = "haiku"
634+
target_os = "haiku",
635+
target_os = "cygwin"
635636
)))]
636637
fn test_acct() {
637638
use std::process::Command;

0 commit comments

Comments
 (0)