Skip to content

Commit 79da01d

Browse files
committed
more cfg
1 parent 47009e3 commit 79da01d

File tree

1 file changed

+10
-42
lines changed

1 file changed

+10
-42
lines changed

test/sys/test_socket.rs

+10-42
Original file line numberDiff line numberDiff line change
@@ -618,12 +618,7 @@ mod recvfrom {
618618
assert_eq!(AddressFamily::Inet, from.unwrap().family().unwrap());
619619
}
620620

621-
#[cfg(any(
622-
target_os = "linux",
623-
target_os = "android",
624-
target_os = "freebsd",
625-
target_os = "netbsd",
626-
))]
621+
#[cfg(any(linux_android, target_os = "freebsd", target_os = "netbsd"))]
627622
#[test]
628623
pub fn udp_recvmmsg() {
629624
use nix::sys::socket::{recvmmsg, MsgFlags};
@@ -699,12 +694,7 @@ mod recvfrom {
699694
send_thread.join().unwrap();
700695
}
701696

702-
#[cfg(any(
703-
target_os = "linux",
704-
target_os = "android",
705-
target_os = "freebsd",
706-
target_os = "netbsd",
707-
))]
697+
#[cfg(any(linux_android, target_os = "freebsd", target_os = "netbsd"))]
708698
#[test]
709699
pub fn udp_recvmmsg_dontwait_short_read() {
710700
use nix::sys::socket::{recvmmsg, MsgFlags};
@@ -1270,12 +1260,7 @@ pub fn test_sendmsg_ipv6packetinfo() {
12701260
//
12711261
// Note that binding to 0.0.0.0 is *required* on FreeBSD; sendmsg
12721262
// returns EINVAL otherwise. (See FreeBSD's ip(4) man page.)
1273-
#[cfg(any(
1274-
target_os = "netbsd",
1275-
target_os = "freebsd",
1276-
target_os = "openbsd",
1277-
target_os = "dragonfly",
1278-
))]
1263+
#[cfg(any(freebsdlike, netbsdlike))]
12791264
#[test]
12801265
pub fn test_sendmsg_ipv4sendsrcaddr() {
12811266
use nix::sys::socket::{
@@ -1424,12 +1409,7 @@ pub fn test_sendmsg_empty_cmsgs() {
14241409
}
14251410
}
14261411

1427-
#[cfg(any(
1428-
target_os = "android",
1429-
target_os = "linux",
1430-
target_os = "freebsd",
1431-
target_os = "dragonfly",
1432-
))]
1412+
#[cfg(any(linux_android, freebsdlike))]
14331413
#[test]
14341414
fn test_scm_credentials() {
14351415
use nix::sys::socket::{
@@ -1772,12 +1752,7 @@ fn loopback_address(
17721752
})
17731753
}
17741754

1775-
#[cfg(any(
1776-
target_os = "android",
1777-
apple_targets,
1778-
target_os = "linux",
1779-
target_os = "netbsd",
1780-
))]
1755+
#[cfg(any(linux_android, apple_targets, target_os = "netbsd"))]
17811756
// qemu doesn't seem to be emulating this correctly in these architectures
17821757
#[cfg_attr(
17831758
all(
@@ -1982,7 +1957,7 @@ pub fn test_recvif() {
19821957
}
19831958
}
19841959

1985-
#[cfg(any(target_os = "android", target_os = "freebsd", target_os = "linux"))]
1960+
#[cfg(any(linux_android, target_os = "freebsd"))]
19861961
#[cfg_attr(qemu, ignore)]
19871962
#[test]
19881963
pub fn test_recvif_ipv4() {
@@ -2068,7 +2043,7 @@ pub fn test_recvif_ipv4() {
20682043
}
20692044
}
20702045

2071-
#[cfg(any(target_os = "android", target_os = "freebsd", target_os = "linux"))]
2046+
#[cfg(any(linux_android, target_os = "freebsd"))]
20722047
#[cfg_attr(qemu, ignore)]
20732048
#[test]
20742049
pub fn test_recvif_ipv6() {
@@ -2154,14 +2129,7 @@ pub fn test_recvif_ipv6() {
21542129
}
21552130
}
21562131

2157-
#[cfg(any(
2158-
target_os = "android",
2159-
target_os = "freebsd",
2160-
apple_targets,
2161-
target_os = "linux",
2162-
target_os = "netbsd",
2163-
target_os = "openbsd",
2164-
))]
2132+
#[cfg(any(linux_android, target_os = "freebsd", apple_targets, netbsdlike))]
21652133
// qemu doesn't seem to be emulating this correctly in these architectures
21662134
#[cfg_attr(
21672135
all(
@@ -2458,7 +2426,7 @@ fn test_recvmmsg_timestampns() {
24582426
// Disable the test on emulated platforms because it fails in Cirrus-CI. Lack
24592427
// of QEMU support is suspected.
24602428
#[cfg_attr(qemu, ignore)]
2461-
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
2429+
#[cfg(any(linux_android, target_os = "fuchsia"))]
24622430
#[test]
24632431
fn test_recvmsg_rxq_ovfl() {
24642432
use nix::sys::socket::sockopt::{RcvBuf, RxqOvfl};
@@ -2552,7 +2520,7 @@ fn test_recvmsg_rxq_ovfl() {
25522520
assert_eq!(drop_counter, 1);
25532521
}
25542522

2555-
#[cfg(any(target_os = "linux", target_os = "android",))]
2523+
#[cfg(linux_android)]
25562524
mod linux_errqueue {
25572525
use super::FromStr;
25582526
use nix::sys::socket::*;

0 commit comments

Comments
 (0)