mirror of
https://github.com/rust-vmm/vhost-device.git
synced 2025-12-27 07:29:24 +00:00
vsock/tests: panic if vsock_loopback is not available
test_vsock_thread_backend_vsock() and test_vsock_thread_vsock_backend() tests use VMADDR_CID_LOCAL which is provided by the `vsock_loopback` kernel module. If `vsock_loopback` kernel module is not loaded, these tests will fail later with unclear messages, so it can be hard to debug. Let's fail early and print a message with the requirement. Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
This commit is contained in:
parent
9b1cc25dc5
commit
0cd34a69ab
@ -604,6 +604,10 @@ mod tests {
|
||||
#[cfg(feature = "backend_vsock")]
|
||||
#[test]
|
||||
fn test_vsock_thread_backend_vsock() {
|
||||
VsockListener::bind_with_cid_port(VMADDR_CID_LOCAL, libc::VMADDR_PORT_ANY).expect(
|
||||
"This test uses VMADDR_CID_LOCAL, so the vsock_loopback kernel module must be loaded",
|
||||
);
|
||||
|
||||
let _listener = VsockListener::bind_with_cid_port(VMADDR_CID_ANY, VSOCK_PEER_PORT).unwrap();
|
||||
let backend_info = BackendType::Vsock(VsockProxyInfo {
|
||||
forward_cid: VMADDR_CID_LOCAL,
|
||||
|
||||
@ -1041,6 +1041,10 @@ mod tests {
|
||||
#[cfg(feature = "backend_vsock")]
|
||||
#[test]
|
||||
fn test_vsock_thread_vsock_backend() {
|
||||
VsockListener::bind_with_cid_port(VMADDR_CID_LOCAL, libc::VMADDR_PORT_ANY).expect(
|
||||
"This test uses VMADDR_CID_LOCAL, so the vsock_loopback kernel module must be loaded",
|
||||
);
|
||||
|
||||
let groups: Vec<String> = vec![String::from("default")];
|
||||
let cid_map: Arc<RwLock<CidMap>> = Arc::new(RwLock::new(HashMap::new()));
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user