summaryrefslogtreecommitdiff
path: root/test/sys
diff options
context:
space:
mode:
authorAlan Somers <asomers@gmail.com>2021-04-04 09:21:58 -0600
committerAlan Somers <asomers@gmail.com>2021-04-04 19:32:54 -0600
commit2ba6999e2e25260693f476e9629a574f196abb17 (patch)
tree762fd8dd42a18266e11c8de1ea04b8a5d2b591f7 /test/sys
parent6af11c1e70b02e1af36fdc339238d3a117fd3a94 (diff)
downloadnix-2ba6999e2e25260693f476e9629a574f196abb17.zip
Check all tests in CI
Travis didn't compile check tests on platforms that couldn't run tests in CI, so they bitrotted. Let's see how bad they are. Most annoyingly, 32-bit Android defines mode_t as 16 bits, but stat.st_mode as 32-bits.
Diffstat (limited to 'test/sys')
-rw-r--r--test/sys/mod.rs2
-rw-r--r--test/sys/test_socket.rs25
2 files changed, 19 insertions, 8 deletions
diff --git a/test/sys/mod.rs b/test/sys/mod.rs
index 14b03784..4f5316ff 100644
--- a/test/sys/mod.rs
+++ b/test/sys/mod.rs
@@ -41,5 +41,5 @@ mod test_pthread;
target_os = "netbsd",
target_os = "openbsd"))]
mod test_ptrace;
-#[cfg(any(target_os = "android", target_os = "linux"))]
+#[cfg(target_os = "linux")]
mod test_timerfd;
diff --git a/test/sys/test_socket.rs b/test/sys/test_socket.rs
index 2b89a453..43f9b5a3 100644
--- a/test/sys/test_socket.rs
+++ b/test/sys/test_socket.rs
@@ -757,6 +757,7 @@ pub fn test_af_alg_aead() {
target_os = "netbsd"))]
#[test]
pub fn test_sendmsg_ipv4packetinfo() {
+ use cfg_if::cfg_if;
use nix::sys::uio::IoVec;
use nix::sys::socket::{socket, sendmsg, bind,
AddressFamily, SockType, SockFlag, SockAddr,
@@ -778,11 +779,21 @@ pub fn test_sendmsg_ipv4packetinfo() {
let iov = [IoVec::from_slice(&slice)];
if let InetAddr::V4(sin) = inet_addr {
- let pi = libc::in_pktinfo {
- ipi_ifindex: 0, /* Unspecified interface */
- ipi_addr: libc::in_addr { s_addr: 0 },
- ipi_spec_dst: sin.sin_addr,
- };
+ cfg_if! {
+ if #[cfg(target_os = "netbsd")] {
+ drop(sin);
+ let pi = libc::in_pktinfo {
+ ipi_ifindex: 0, /* Unspecified interface */
+ ipi_addr: libc::in_addr { s_addr: 0 },
+ };
+ } else {
+ let pi = libc::in_pktinfo {
+ ipi_ifindex: 0, /* Unspecified interface */
+ ipi_addr: libc::in_addr { s_addr: 0 },
+ ipi_spec_dst: sin.sin_addr,
+ };
+ }
+ }
let cmsg = [ControlMessage::Ipv4PacketInfo(&pi)];
@@ -1472,13 +1483,13 @@ pub fn test_recv_ipv6pktinfo() {
Some(ControlMessageOwned::Ipv6PacketInfo(pktinfo)) => {
let i = if_nametoindex(lo_name.as_bytes()).expect("if_nametoindex");
assert_eq!(
- pktinfo.ipi6_ifindex,
+ pktinfo.ipi6_ifindex as libc::c_uint,
i,
"unexpected ifindex (expected {}, got {})",
i,
pktinfo.ipi6_ifindex
);
- }
+ },
_ => (),
}
assert!(cmsgs.next().is_none(), "unexpected additional control msg");