mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-21 19:02:30 +00:00
ci: Add integration test for vhost_user_fs daemon
In order to validate the new virtio-fs daemon written in Rust is behaving correctly, a new integration test has been added. Important to note that for now, only a test with cache=none and dax=off can be added since the daemon does not support shared memory region yet. The long term goal being to replace virtiofsd with vhost_user_daemon once it will reach parity regarding the supported features. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
50b0e58c88
commit
f1c7f0c0b8
@ -148,6 +148,7 @@ sudo ip link set vfio-tap1 up
|
||||
cargo build --release
|
||||
sudo setcap cap_net_admin+ep target/release/cloud-hypervisor
|
||||
sudo setcap cap_net_admin+ep target/release/vhost_user_net
|
||||
sudo setcap cap_dac_override,cap_sys_admin+epi target/release/vhost_user_fs
|
||||
|
||||
# We always copy a fresh version of our binary for our L2 guest.
|
||||
cp target/release/cloud-hypervisor $VFIO_DIR
|
||||
|
40
src/main.rs
40
src/main.rs
@ -709,6 +709,26 @@ mod tests {
|
||||
(child, virtiofsd_socket_path)
|
||||
}
|
||||
|
||||
fn prepare_vhost_user_fs_daemon(
|
||||
tmp_dir: &TempDir,
|
||||
shared_dir: &str,
|
||||
_cache: &str,
|
||||
) -> (std::process::Child, String) {
|
||||
let virtiofsd_socket_path =
|
||||
String::from(tmp_dir.path().join("virtiofs.sock").to_str().unwrap());
|
||||
|
||||
// Start the daemon
|
||||
let child = Command::new("target/release/vhost_user_fs")
|
||||
.args(&["--shared-dir", shared_dir])
|
||||
.args(&["--sock", virtiofsd_socket_path.as_str()])
|
||||
.spawn()
|
||||
.unwrap();
|
||||
|
||||
thread::sleep(std::time::Duration::new(10, 0));
|
||||
|
||||
(child, virtiofsd_socket_path)
|
||||
}
|
||||
|
||||
fn prepare_vubd(tmp_dir: &TempDir, blk_img: &str) -> (std::process::Child, String) {
|
||||
let mut workload_path = dirs::home_dir().unwrap();
|
||||
workload_path.push("workloads");
|
||||
@ -1650,7 +1670,12 @@ mod tests {
|
||||
});
|
||||
}
|
||||
|
||||
fn test_virtio_fs(dax: bool, cache_size: Option<u64>, virtiofsd_cache: &str) {
|
||||
fn test_virtio_fs(
|
||||
dax: bool,
|
||||
cache_size: Option<u64>,
|
||||
virtiofsd_cache: &str,
|
||||
prepare_daemon: &dyn Fn(&TempDir, &str, &str) -> (std::process::Child, String),
|
||||
) {
|
||||
test_block!(tb, "", {
|
||||
let mut clear = ClearDiskConfig::new();
|
||||
let guest = Guest::new(&mut clear);
|
||||
@ -1671,7 +1696,7 @@ mod tests {
|
||||
"".to_string()
|
||||
};
|
||||
|
||||
let (mut daemon_child, virtiofsd_socket_path) = prepare_virtiofsd(
|
||||
let (mut daemon_child, virtiofsd_socket_path) = prepare_daemon(
|
||||
&guest.tmp_dir,
|
||||
shared_dir.to_str().unwrap(),
|
||||
virtiofsd_cache,
|
||||
@ -1777,17 +1802,22 @@ mod tests {
|
||||
|
||||
#[cfg_attr(not(feature = "mmio"), test)]
|
||||
fn test_virtio_fs_dax_on_default_cache_size() {
|
||||
test_virtio_fs(true, None, "always")
|
||||
test_virtio_fs(true, None, "always", &prepare_virtiofsd)
|
||||
}
|
||||
|
||||
#[cfg_attr(not(feature = "mmio"), test)]
|
||||
fn test_virtio_fs_dax_on_cache_size_1_gib() {
|
||||
test_virtio_fs(true, Some(0x4000_0000), "always")
|
||||
test_virtio_fs(true, Some(0x4000_0000), "always", &prepare_virtiofsd)
|
||||
}
|
||||
|
||||
#[cfg_attr(not(feature = "mmio"), test)]
|
||||
fn test_virtio_fs_dax_off() {
|
||||
test_virtio_fs(false, None, "none")
|
||||
test_virtio_fs(false, None, "none", &prepare_virtiofsd)
|
||||
}
|
||||
|
||||
#[cfg_attr(not(feature = "mmio"), test)]
|
||||
fn test_virtio_fs_dax_off_w_vhost_user_fs_daemon() {
|
||||
test_virtio_fs(false, None, "none", &prepare_vhost_user_fs_daemon)
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
x
Reference in New Issue
Block a user