From ab6a8f19f016aa74da98869bbefb0736647d179b Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Thu, 15 Aug 2019 07:30:07 -0700 Subject: [PATCH] tests: Fix virtio-fs with dax=off integration test When virtio-fs is being tested through the integration tests, there is one specific test where DAX and cache region are disabled. In this case the virtiofsd daemon should be used with the correct option cache=none instead of cache=always. Signed-off-by: Sebastien Boeuf --- src/main.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index c11c5933f..cec1df5c2 100755 --- a/src/main.rs +++ b/src/main.rs @@ -519,7 +519,7 @@ mod tests { } } - fn prepare_virtiofsd(tmp_dir: &TempDir) -> (std::process::Child, String) { + fn prepare_virtiofsd(tmp_dir: &TempDir, cache: &str) -> (std::process::Child, String) { let mut workload_path = dirs::home_dir().unwrap(); workload_path.push("workloads"); @@ -541,7 +541,7 @@ mod tests { format!("vhost_user_socket={}", virtiofsd_socket_path).as_str(), ]) .args(&["-o", format!("source={}", shared_dir_path).as_str()]) - .args(&["-o", "cache=always"]) + .args(&["-o", format!("cache={}", cache).as_str()]) .spawn() .unwrap(); @@ -1103,11 +1103,12 @@ mod tests { }); } - fn test_virtio_fs(dax: bool, cache_size: Option) { + fn test_virtio_fs(dax: bool, cache_size: Option, virtiofsd_cache: &str) { test_block!(tb, "", { let mut clear = ClearDiskConfig::new(); let guest = Guest::new(&mut clear); - let (mut daemon_child, virtiofsd_socket_path) = prepare_virtiofsd(&guest.tmp_dir); + let (mut daemon_child, virtiofsd_socket_path) = + prepare_virtiofsd(&guest.tmp_dir, virtiofsd_cache); let mut workload_path = dirs::home_dir().unwrap(); workload_path.push("workloads"); @@ -1191,17 +1192,17 @@ mod tests { #[test] fn test_virtio_fs_dax_on_default_cache_size() { - test_virtio_fs(true, None) + test_virtio_fs(true, None, "always") } #[test] fn test_virtio_fs_dax_on_cache_size_1_gib() { - test_virtio_fs(true, Some(0x4000_0000)) + test_virtio_fs(true, Some(0x4000_0000), "always") } #[test] fn test_virtio_fs_dax_off() { - test_virtio_fs(false, None) + test_virtio_fs(false, None, "none") } #[test]