mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-05 13:05:45 +00:00
tests: Use vmm_sys_util::tempfile::Tempfile in integration tests
This removes the requirement for an extra crate and simplifies the dependency chain. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
946c484590
commit
d78b2ec8b5
28
Cargo.lock
generated
28
Cargo.lock
generated
@ -233,7 +233,6 @@ dependencies = [
|
|||||||
"signal-hook",
|
"signal-hook",
|
||||||
"ssh2",
|
"ssh2",
|
||||||
"tempdir",
|
"tempdir",
|
||||||
"tempfile",
|
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"vm-memory",
|
"vm-memory",
|
||||||
"vmm",
|
"vmm",
|
||||||
@ -760,7 +759,7 @@ dependencies = [
|
|||||||
"cfg-if 0.1.10",
|
"cfg-if 0.1.10",
|
||||||
"cloudabi",
|
"cloudabi",
|
||||||
"libc",
|
"libc",
|
||||||
"redox_syscall 0.1.57",
|
"redox_syscall",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
@ -1004,15 +1003,6 @@ version = "0.1.57"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
|
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "redox_syscall"
|
|
||||||
version = "0.2.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "05ec8ca9416c5ea37062b502703cd7fcb207736bc294f6e0cf367ac6fc234570"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 1.2.1",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redox_users"
|
name = "redox_users"
|
||||||
version = "0.3.5"
|
version = "0.3.5"
|
||||||
@ -1020,7 +1010,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d"
|
checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.1.16",
|
"getrandom 0.1.16",
|
||||||
"redox_syscall 0.1.57",
|
"redox_syscall",
|
||||||
"rust-argon2",
|
"rust-argon2",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1301,20 +1291,6 @@ dependencies = [
|
|||||||
"remove_dir_all",
|
"remove_dir_all",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tempfile"
|
|
||||||
version = "3.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if 1.0.0",
|
|
||||||
"libc",
|
|
||||||
"rand 0.8.3",
|
|
||||||
"redox_syscall 0.2.4",
|
|
||||||
"remove_dir_all",
|
|
||||||
"winapi 0.3.9",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "term"
|
name = "term"
|
||||||
version = "0.4.6"
|
version = "0.4.6"
|
||||||
|
@ -44,7 +44,6 @@ dirs = "3.0.1"
|
|||||||
credibility = "0.1.3"
|
credibility = "0.1.3"
|
||||||
tempdir = "0.3.7"
|
tempdir = "0.3.7"
|
||||||
lazy_static= "1.4.0"
|
lazy_static= "1.4.0"
|
||||||
tempfile = "3.2.0"
|
|
||||||
serde_json = "1.0.62"
|
serde_json = "1.0.62"
|
||||||
net_util = { path = "net_util" }
|
net_util = { path = "net_util" }
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ mod tests {
|
|||||||
use std::sync::{mpsc, Mutex};
|
use std::sync::{mpsc, Mutex};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use tempdir::TempDir;
|
use tempdir::TempDir;
|
||||||
use tempfile::NamedTempFile;
|
use vmm_sys_util::tempfile::TempFile;
|
||||||
#[cfg_attr(target_arch = "aarch64", allow(unused_imports))]
|
#[cfg_attr(target_arch = "aarch64", allow(unused_imports))]
|
||||||
use wait_timeout::ChildExt;
|
use wait_timeout::ChildExt;
|
||||||
|
|
||||||
@ -2008,11 +2008,11 @@ mod tests {
|
|||||||
|
|
||||||
let kernel_path = direct_kernel_boot_path();
|
let kernel_path = direct_kernel_boot_path();
|
||||||
|
|
||||||
let mut pmem_temp_file = NamedTempFile::new().unwrap();
|
let pmem_temp_file = TempFile::new().unwrap();
|
||||||
pmem_temp_file.as_file_mut().set_len(128 << 20).unwrap();
|
pmem_temp_file.as_file().set_len(128 << 20).unwrap();
|
||||||
|
|
||||||
std::process::Command::new("mkfs.ext4")
|
std::process::Command::new("mkfs.ext4")
|
||||||
.arg(pmem_temp_file.path())
|
.arg(pmem_temp_file.as_path())
|
||||||
.output()
|
.output()
|
||||||
.expect("Expect creating disk image to succeed");
|
.expect("Expect creating disk image to succeed");
|
||||||
|
|
||||||
@ -2027,7 +2027,7 @@ mod tests {
|
|||||||
"--pmem",
|
"--pmem",
|
||||||
format!(
|
format!(
|
||||||
"file={}{}{}",
|
"file={}{}{}",
|
||||||
pmem_temp_file.path().to_str().unwrap(),
|
pmem_temp_file.as_path().to_str().unwrap(),
|
||||||
if specify_size { ",size=128M" } else { "" },
|
if specify_size { ",size=128M" } else { "" },
|
||||||
if discard_writes {
|
if discard_writes {
|
||||||
",discard_writes=on"
|
",discard_writes=on"
|
||||||
@ -5314,14 +5314,14 @@ mod tests {
|
|||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut pmem_temp_file = NamedTempFile::new().unwrap();
|
let pmem_temp_file = TempFile::new().unwrap();
|
||||||
pmem_temp_file.as_file_mut().set_len(128 << 20).unwrap();
|
pmem_temp_file.as_file().set_len(128 << 20).unwrap();
|
||||||
let (cmd_success, cmd_output) = remote_command_w_output(
|
let (cmd_success, cmd_output) = remote_command_w_output(
|
||||||
&api_socket,
|
&api_socket,
|
||||||
"add-pmem",
|
"add-pmem",
|
||||||
Some(&format!(
|
Some(&format!(
|
||||||
"file={},id=test0",
|
"file={},id=test0",
|
||||||
pmem_temp_file.path().to_str().unwrap()
|
pmem_temp_file.as_path().to_str().unwrap()
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
assert!(cmd_success);
|
assert!(cmd_success);
|
||||||
|
Loading…
Reference in New Issue
Block a user