mirror of
https://github.com/rust-vmm/vhost-device.git
synced 2026-01-08 12:38:21 +00:00
vsock/tests: use vsock::VMADDR_CID_LOCAL
Instead of using the direct value (1), let's use the constant value provided by the vsock crate. VMADDR_CID_LOCAL is used for loopback communication, which is used in some of our test cases. Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
This commit is contained in:
parent
1406ca232b
commit
9b1cc25dc5
@ -518,7 +518,7 @@ mod tests {
|
||||
use tempfile::tempdir;
|
||||
use virtio_vsock::packet::{VsockPacket, PKT_HEADER_SIZE};
|
||||
#[cfg(feature = "backend_vsock")]
|
||||
use vsock::{VsockListener, VMADDR_CID_ANY};
|
||||
use vsock::{VsockListener, VMADDR_CID_ANY, VMADDR_CID_LOCAL};
|
||||
|
||||
const DATA_LEN: usize = 16;
|
||||
const CONN_TX_BUF_SIZE: u32 = 64 * 1024;
|
||||
@ -606,7 +606,7 @@ mod tests {
|
||||
fn test_vsock_thread_backend_vsock() {
|
||||
let _listener = VsockListener::bind_with_cid_port(VMADDR_CID_ANY, VSOCK_PEER_PORT).unwrap();
|
||||
let backend_info = BackendType::Vsock(VsockProxyInfo {
|
||||
forward_cid: 1,
|
||||
forward_cid: VMADDR_CID_LOCAL,
|
||||
listen_ports: vec![],
|
||||
});
|
||||
|
||||
|
||||
@ -816,7 +816,7 @@ mod tests {
|
||||
use vm_memory::GuestAddress;
|
||||
use vmm_sys_util::eventfd::EventFd;
|
||||
#[cfg(feature = "backend_vsock")]
|
||||
use vsock::VsockStream;
|
||||
use vsock::{VsockStream, VMADDR_CID_LOCAL};
|
||||
|
||||
const CONN_TX_BUF_SIZE: u32 = 64 * 1024;
|
||||
|
||||
@ -1046,7 +1046,7 @@ mod tests {
|
||||
|
||||
let t = VhostUserVsockThread::new(
|
||||
BackendType::Vsock(VsockProxyInfo {
|
||||
forward_cid: 1,
|
||||
forward_cid: VMADDR_CID_LOCAL,
|
||||
listen_ports: vec![9003, 9004],
|
||||
}),
|
||||
3,
|
||||
@ -1063,8 +1063,8 @@ mod tests {
|
||||
|
||||
t.mem = Some(mem.clone());
|
||||
|
||||
let mut vs1 = VsockStream::connect_with_cid_port(1, 9003).unwrap();
|
||||
let mut vs2 = VsockStream::connect_with_cid_port(1, 9004).unwrap();
|
||||
let mut vs1 = VsockStream::connect_with_cid_port(VMADDR_CID_LOCAL, 9003).unwrap();
|
||||
let mut vs2 = VsockStream::connect_with_cid_port(VMADDR_CID_LOCAL, 9004).unwrap();
|
||||
t.process_backend_evt(EventSet::empty());
|
||||
|
||||
vs1.write_all(b"some data").unwrap();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user