mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-21 19:02:30 +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",
|
||||
"ssh2",
|
||||
"tempdir",
|
||||
"tempfile",
|
||||
"thiserror",
|
||||
"vm-memory",
|
||||
"vmm",
|
||||
@ -760,7 +759,7 @@ dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"cloudabi",
|
||||
"libc",
|
||||
"redox_syscall 0.1.57",
|
||||
"redox_syscall",
|
||||
"smallvec",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
@ -1004,15 +1003,6 @@ version = "0.1.57"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
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]]
|
||||
name = "redox_users"
|
||||
version = "0.3.5"
|
||||
@ -1020,7 +1010,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d"
|
||||
dependencies = [
|
||||
"getrandom 0.1.16",
|
||||
"redox_syscall 0.1.57",
|
||||
"redox_syscall",
|
||||
"rust-argon2",
|
||||
]
|
||||
|
||||
@ -1301,20 +1291,6 @@ dependencies = [
|
||||
"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]]
|
||||
name = "term"
|
||||
version = "0.4.6"
|
||||
|
@ -44,7 +44,6 @@ dirs = "3.0.1"
|
||||
credibility = "0.1.3"
|
||||
tempdir = "0.3.7"
|
||||
lazy_static= "1.4.0"
|
||||
tempfile = "3.2.0"
|
||||
serde_json = "1.0.62"
|
||||
net_util = { path = "net_util" }
|
||||
|
||||
|
@ -31,7 +31,7 @@ mod tests {
|
||||
use std::sync::{mpsc, Mutex};
|
||||
use std::thread;
|
||||
use tempdir::TempDir;
|
||||
use tempfile::NamedTempFile;
|
||||
use vmm_sys_util::tempfile::TempFile;
|
||||
#[cfg_attr(target_arch = "aarch64", allow(unused_imports))]
|
||||
use wait_timeout::ChildExt;
|
||||
|
||||
@ -2008,11 +2008,11 @@ mod tests {
|
||||
|
||||
let kernel_path = direct_kernel_boot_path();
|
||||
|
||||
let mut pmem_temp_file = NamedTempFile::new().unwrap();
|
||||
pmem_temp_file.as_file_mut().set_len(128 << 20).unwrap();
|
||||
let pmem_temp_file = TempFile::new().unwrap();
|
||||
pmem_temp_file.as_file().set_len(128 << 20).unwrap();
|
||||
|
||||
std::process::Command::new("mkfs.ext4")
|
||||
.arg(pmem_temp_file.path())
|
||||
.arg(pmem_temp_file.as_path())
|
||||
.output()
|
||||
.expect("Expect creating disk image to succeed");
|
||||
|
||||
@ -2027,7 +2027,7 @@ mod tests {
|
||||
"--pmem",
|
||||
format!(
|
||||
"file={}{}{}",
|
||||
pmem_temp_file.path().to_str().unwrap(),
|
||||
pmem_temp_file.as_path().to_str().unwrap(),
|
||||
if specify_size { ",size=128M" } else { "" },
|
||||
if discard_writes {
|
||||
",discard_writes=on"
|
||||
@ -5314,14 +5314,14 @@ mod tests {
|
||||
0
|
||||
);
|
||||
|
||||
let mut pmem_temp_file = NamedTempFile::new().unwrap();
|
||||
pmem_temp_file.as_file_mut().set_len(128 << 20).unwrap();
|
||||
let pmem_temp_file = TempFile::new().unwrap();
|
||||
pmem_temp_file.as_file().set_len(128 << 20).unwrap();
|
||||
let (cmd_success, cmd_output) = remote_command_w_output(
|
||||
&api_socket,
|
||||
"add-pmem",
|
||||
Some(&format!(
|
||||
"file={},id=test0",
|
||||
pmem_temp_file.path().to_str().unwrap()
|
||||
pmem_temp_file.as_path().to_str().unwrap()
|
||||
)),
|
||||
);
|
||||
assert!(cmd_success);
|
||||
|
Loading…
x
Reference in New Issue
Block a user