Skip to content

Fix test_vsock failure on VMADDR_CID_LOCAL testing and re-enable it #1407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions test/sys/test_socket.rs
Original file line number Diff line number Diff line change
@@ -1491,7 +1491,6 @@ pub fn test_recv_ipv6pktinfo() {
}

#[cfg(any(target_os = "android", target_os = "linux"))]
#[cfg_attr(not(target_arch = "x86_64"), ignore)]
#[test]
pub fn test_vsock() {
use libc;
@@ -1508,17 +1507,11 @@ pub fn test_vsock() {
SockFlag::empty(), None)
.expect("socket failed");

// VMADDR_CID_HYPERVISOR and VMADDR_CID_LOCAL are reserved, so we expect
// an EADDRNOTAVAIL error.
// VMADDR_CID_HYPERVISOR is reserved, so we expect an EADDRNOTAVAIL error.
let sockaddr = SockAddr::new_vsock(libc::VMADDR_CID_HYPERVISOR, port);
assert_eq!(bind(s1, &sockaddr).err(),
Some(Error::Sys(Errno::EADDRNOTAVAIL)));

let sockaddr = SockAddr::new_vsock(libc::VMADDR_CID_LOCAL, port);
assert_eq!(bind(s1, &sockaddr).err(),
Some(Error::Sys(Errno::EADDRNOTAVAIL)));


let sockaddr = SockAddr::new_vsock(libc::VMADDR_CID_ANY, port);
assert_eq!(bind(s1, &sockaddr), Ok(()));
listen(s1, 10).expect("listen failed");