Skip to content

Commit

Permalink
vsock: Skip tests causing CI failure
Browse files Browse the repository at this point in the history
Some new tests added in the previous commit fail in CI due to missing
support for AF_VSOCK. The tests are now skipped when we detect that
AF_VSOCK is not available.

Signed-off-by: Dorjoy Chowdhury <[email protected]>
  • Loading branch information
dorjoy03 authored and stefano-garzarella committed Sep 5, 2024
1 parent 8646373 commit cec57c9
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
8 changes: 8 additions & 0 deletions vhost-device-vsock/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,8 @@ mod tests {
use std::fs::File;
use std::io::Write;
use tempfile::tempdir;
#[cfg(feature = "backend_vsock")]
use vsock::VsockListener;

impl VsockArgs {
fn from_args_unix(
Expand Down Expand Up @@ -1045,6 +1047,12 @@ mod tests {
#[cfg(feature = "backend_vsock")]
#[test]
fn test_vsock_server_vsock() {
if VsockListener::bind_with_cid_port(libc::VMADDR_CID_LOCAL, libc::VMADDR_PORT_ANY).is_err()
{
println!(" SKIPPED: AF_VSOCK is not available.");
return;
}

const CID: u64 = 3;
const CONN_TX_BUF_SIZE: u32 = 64 * 1024;
const QUEUE_SIZE: usize = 1024;
Expand Down
6 changes: 6 additions & 0 deletions vhost-device-vsock/src/thread_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,12 @@ mod tests {
#[cfg(feature = "backend_vsock")]
#[test]
fn test_vsock_thread_backend_vsock() {
if VsockListener::bind_with_cid_port(libc::VMADDR_CID_LOCAL, libc::VMADDR_PORT_ANY).is_err()
{
println!(" SKIPPED: AF_VSOCK is not available.");
return;
}

let _listener = VsockListener::bind_with_cid_port(VMADDR_CID_ANY, VSOCK_PEER_PORT).unwrap();
let backend_info = BackendType::Vsock(VsockProxyInfo {
forward_cid: 1,
Expand Down
8 changes: 8 additions & 0 deletions vhost-device-vsock/src/vhu_vsock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ mod tests {
use tempfile::tempdir;
use vhost_user_backend::VringT;
use vm_memory::GuestAddress;
#[cfg(feature = "backend_vsock")]
use vsock::VsockListener;

const CONN_TX_BUF_SIZE: u32 = 64 * 1024;
const QUEUE_SIZE: usize = 1024;
Expand Down Expand Up @@ -502,6 +504,12 @@ mod tests {
#[cfg(feature = "backend_vsock")]
#[test]
fn test_vsock_backend_vsock() {
if VsockListener::bind_with_cid_port(libc::VMADDR_CID_LOCAL, libc::VMADDR_PORT_ANY).is_err()
{
println!(" SKIPPED: AF_VSOCK is not available.");
return;
}

const CID: u64 = 3;

let groups_list: Vec<String> = vec![String::from("default")];
Expand Down
6 changes: 6 additions & 0 deletions vhost-device-vsock/src/vhu_vsock_thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,12 @@ mod tests {
#[cfg(feature = "backend_vsock")]
#[test]
fn test_vsock_thread_vsock_backend() {
if VsockListener::bind_with_cid_port(libc::VMADDR_CID_LOCAL, libc::VMADDR_PORT_ANY).is_err()
{
println!(" SKIPPED: AF_VSOCK is not available.");
return;
}

let groups: Vec<String> = vec![String::from("default")];
let cid_map: Arc<RwLock<CidMap>> = Arc::new(RwLock::new(HashMap::new()));

Expand Down

0 comments on commit cec57c9

Please sign in to comment.