diff options
author | Vincent Dagonneau <vincentdagonneau@gmail.com> | 2019-04-27 18:45:39 +0200 |
---|---|---|
committer | Vincent Dagonneau <vincentdagonneau@gmail.com> | 2019-04-29 18:52:51 +0200 |
commit | cffb4b33f584bcc1fa6249795cd9160ae95291d2 (patch) | |
tree | 99336681f8c43aa62e7adc772bf3c996014d4331 /test | |
parent | 71b35a07cc1cdd9a367773d391848a3cd314c388 (diff) | |
download | nix-cffb4b33f584bcc1fa6249795cd9160ae95291d2.zip |
Restored the bytes field on RecvMsg in order to know the amount of bytes received using recvmsg.
Diffstat (limited to 'test')
-rw-r--r-- | test/sys/test_socket.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/sys/test_socket.rs b/test/sys/test_socket.rs index 2790f681..9cbf0257 100644 --- a/test/sys/test_socket.rs +++ b/test/sys/test_socket.rs @@ -172,6 +172,7 @@ pub fn test_scm_rights() { panic!("unexpected cmsg"); } } + assert_eq!(msg.bytes, 5); assert!(!msg.flags.intersects(MsgFlags::MSG_TRUNC | MsgFlags::MSG_CTRUNC)); close(fd2).unwrap(); } @@ -373,6 +374,7 @@ fn test_scm_rights_single_cmsg_multiple_fds() { } assert!(cmsgs.next().is_none(), "unexpected control msg"); + assert_eq!(msg.bytes, 8); assert_eq!(iovec[0].as_slice(), [1u8, 2, 3, 4, 5, 6, 7, 8]); }); @@ -414,6 +416,7 @@ pub fn test_sendmsg_empty_cmsgs() { panic!("unexpected cmsg"); } assert!(!msg.flags.intersects(MsgFlags::MSG_TRUNC | MsgFlags::MSG_CTRUNC)); + assert_eq!(msg.bytes, 5); close(fd2).unwrap(); } } @@ -464,6 +467,7 @@ fn test_scm_credentials() { } } received_cred.expect("no creds received"); + assert_eq!(msg.bytes, 5); assert!(!msg.flags.intersects(MsgFlags::MSG_TRUNC | MsgFlags::MSG_CTRUNC)); close(recv).unwrap(); } @@ -555,6 +559,7 @@ fn test_impl_scm_credentials_and_rights(mut space: Vec<u8>) { } } received_cred.expect("no creds received"); + assert_eq!(msg.bytes, 5); assert!(!msg.flags.intersects(MsgFlags::MSG_TRUNC | MsgFlags::MSG_CTRUNC)); close(recv).unwrap(); } @@ -754,6 +759,7 @@ pub fn test_recv_ipv4pktinfo() { _ => (), } assert!(cmsgs.next().is_none(), "unexpected additional control msg"); + assert_eq!(msg.bytes, 8); assert_eq!( iovec[0].as_slice(), [1u8, 2, 3, 4, 5, 6, 7, 8] @@ -862,6 +868,7 @@ pub fn test_recvif() { } assert_eq!(rx_recvif, true); assert_eq!(rx_recvdstaddr, true); + assert_eq!(msg.bytes, 8); assert_eq!( iovec[0].as_slice(), [1u8, 2, 3, 4, 5, 6, 7, 8] @@ -953,6 +960,7 @@ pub fn test_recv_ipv6pktinfo() { _ => (), } assert!(cmsgs.next().is_none(), "unexpected additional control msg"); + assert_eq!(msg.bytes, 8); assert_eq!( iovec[0].as_slice(), [1u8, 2, 3, 4, 5, 6, 7, 8] |