block_util: Use vmm_sys_util::tempfile::Tempfile

This removes the requirement for an extra crate.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2021-02-22 11:37:20 +00:00 committed by Sebastien Boeuf
parent 0497a7c311
commit cf7a05ecb5
3 changed files with 2 additions and 5 deletions

1
Cargo.lock generated
View File

@ -164,7 +164,6 @@ dependencies = [
"serde", "serde",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"tempfile",
"thiserror", "thiserror",
"virtio-bindings", "virtio-bindings",
"vm-memory", "vm-memory",

View File

@ -22,5 +22,3 @@ vm-memory = { version = "0.5.0", features = ["backend-mmap", "backend-atomic"] }
vm-virtio = { path = "../vm-virtio" } vm-virtio = { path = "../vm-virtio" }
vmm-sys-util = ">=0.3.1" vmm-sys-util = ">=0.3.1"
[dev-dependencies]
tempfile = "3.2.0"

View File

@ -124,7 +124,7 @@ mod tests {
use super::{is_fixed_vhd, VhdFooter}; use super::{is_fixed_vhd, VhdFooter};
use std::fs::File; use std::fs::File;
use std::io::{Seek, SeekFrom, Write}; use std::io::{Seek, SeekFrom, Write};
use tempfile::tempfile; use vmm_sys_util::tempfile::TempFile;
fn valid_fixed_vhd_footer() -> Vec<u8> { fn valid_fixed_vhd_footer() -> Vec<u8> {
vec![ vec![
@ -172,7 +172,7 @@ mod tests {
where where
F: FnMut(File), F: FnMut(File),
{ {
let mut disk_file: File = tempfile().unwrap(); let mut disk_file: File = TempFile::new().unwrap().into_file();
disk_file.set_len(0x1000_0200).unwrap(); disk_file.set_len(0x1000_0200).unwrap();
disk_file.seek(SeekFrom::Start(0x1000_0000)).unwrap(); disk_file.seek(SeekFrom::Start(0x1000_0000)).unwrap();
disk_file.write_all(&footer).unwrap(); disk_file.write_all(&footer).unwrap();