tests: Move tests from vhost_user_fs to virtiofsd-rs

Download and build virtiofsd-rs and then use that in the integration
test suite.

Fixes: #2013

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2020-11-27 15:04:01 +00:00 committed by Samuel Ortiz
parent 593a958fe5
commit 1908f488c3
3 changed files with 46 additions and 12 deletions

View File

@ -142,6 +142,19 @@ update_workloads() {
popd popd
fi fi
VIRTIOFSD_RS="$WORKLOADS_DIR/virtiofsd-rs"
VIRTIOFSD_RS_DIR="virtiofsd_rs_build"
if [ ! -f "$VIRTIOFSD_RS" ]; then
pushd $WORKLOADS_DIR
git clone --depth 1 "https://gitlab.com/virtio-fs/virtiofsd-rs.git" $VIRTIOFSD_RS_DIR
pushd $VIRTIOFSD_RS_DIR
time cargo build --release
cp target/release/virtiofsd-rs $VIRTIOFSD_RS || exit 1
popd
rm -rf $VIRTIOFSD_RS_DIR
popd
fi
BLK_IMAGE="$WORKLOADS_DIR/blk.img" BLK_IMAGE="$WORKLOADS_DIR/blk.img"
MNT_DIR="mount_image" MNT_DIR="mount_image"
if [ ! -f "$BLK_IMAGE" ]; then if [ ! -f "$BLK_IMAGE" ]; then

View File

@ -137,6 +137,20 @@ if [ ! -f "$VIRTIOFSD" ]; then
popd popd
fi fi
VIRTIOFSD_RS="$WORKLOADS_DIR/virtiofsd-rs"
VIRTIOFSD_RS_DIR="virtiofsd_rs_build"
if [ ! -f "$VIRTIOFSD_RS" ]; then
pushd $WORKLOADS_DIR
git clone --depth 1 "https://gitlab.com/virtio-fs/virtiofsd-rs.git" $VIRTIOFSD_RS_DIR
pushd $VIRTIOFSD_RS_DIR
time cargo build --release
cp target/release/virtiofsd-rs $VIRTIOFSD_RS || exit 1
popd
rm -rf $VIRTIOFSD_RS_DIR
popd
fi
BLK_IMAGE="$WORKLOADS_DIR/blk.img" BLK_IMAGE="$WORKLOADS_DIR/blk.img"
MNT_DIR="mount_image" MNT_DIR="mount_image"
if [ ! -f "$BLK_IMAGE" ]; then if [ ! -f "$BLK_IMAGE" ]; then

View File

@ -349,16 +349,23 @@ mod tests {
(child, virtiofsd_socket_path) (child, virtiofsd_socket_path)
} }
fn prepare_vhost_user_fs_daemon( fn prepare_virtofsd_rs_daemon(
tmp_dir: &TempDir, tmp_dir: &TempDir,
shared_dir: &str, shared_dir: &str,
_cache: &str, _cache: &str,
) -> (std::process::Child, String) { ) -> (std::process::Child, String) {
let mut workload_path = dirs::home_dir().unwrap();
workload_path.push("workloads");
let mut virtiofsd_path = workload_path;
virtiofsd_path.push("virtiofsd-rs");
let virtiofsd_path = String::from(virtiofsd_path.to_str().unwrap());
let virtiofsd_socket_path = let virtiofsd_socket_path =
String::from(tmp_dir.path().join("virtiofs.sock").to_str().unwrap()); String::from(tmp_dir.path().join("virtiofs.sock").to_str().unwrap());
// Start the daemon // Start the daemon
let child = Command::new(clh_command("vhost_user_fs")) let child = Command::new(virtiofsd_path.as_str())
.args(&["--shared-dir", shared_dir]) .args(&["--shared-dir", shared_dir])
.args(&["--socket", virtiofsd_socket_path.as_str()]) .args(&["--socket", virtiofsd_socket_path.as_str()])
.spawn() .spawn()
@ -3080,24 +3087,24 @@ mod tests {
} }
#[test] #[test]
fn test_virtio_fs_dax_on_default_cache_size_w_vhost_user_fs_daemon() { fn test_virtio_fs_dax_on_default_cache_size_w_virtiofsd_rs_daemon() {
test_virtio_fs(true, None, "none", &prepare_vhost_user_fs_daemon, false) test_virtio_fs(true, None, "none", &prepare_virtofsd_rs_daemon, false)
} }
#[test] #[test]
fn test_virtio_fs_dax_on_cache_size_1_gib_w_vhost_user_fs_daemon() { fn test_virtio_fs_dax_on_cache_size_1_gib_w_virtiofsd_rs_daemon() {
test_virtio_fs( test_virtio_fs(
true, true,
Some(0x4000_0000), Some(0x4000_0000),
"none", "none",
&prepare_vhost_user_fs_daemon, &prepare_virtofsd_rs_daemon,
false, false,
) )
} }
#[test] #[test]
fn test_virtio_fs_dax_off_w_vhost_user_fs_daemon() { fn test_virtio_fs_dax_off_w_virtiofsd_rs_daemon() {
test_virtio_fs(false, None, "none", &prepare_vhost_user_fs_daemon, false) test_virtio_fs(false, None, "none", &prepare_virtofsd_rs_daemon, false)
} }
#[test] #[test]
@ -3114,14 +3121,14 @@ mod tests {
#[test] #[test]
#[cfg(target_arch = "x86_64")] #[cfg(target_arch = "x86_64")]
fn test_virtio_fs_hotplug_dax_on_w_vhost_user_fs_daemon() { fn test_virtio_fs_hotplug_dax_on_w_virtiofsd_rs_daemon() {
test_virtio_fs(true, None, "none", &prepare_vhost_user_fs_daemon, true) test_virtio_fs(true, None, "none", &prepare_virtofsd_rs_daemon, true)
} }
#[test] #[test]
#[cfg(target_arch = "x86_64")] #[cfg(target_arch = "x86_64")]
fn test_virtio_fs_hotplug_dax_off_w_vhost_user_fs_daemon() { fn test_virtio_fs_hotplug_dax_off_w_virtiofsd_rs_daemon() {
test_virtio_fs(false, None, "none", &prepare_vhost_user_fs_daemon, true) test_virtio_fs(false, None, "none", &prepare_virtofsd_rs_daemon, true)
} }
#[test] #[test]