summary refs log tree commit diff
path: root/sys_util/src/write_zeroes.rs
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@chromium.org>2019-04-17 21:09:41 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-07-11 16:15:38 -0700
commite33b55c4298c8f0d3dff7f04343e765559463d3a (patch)
tree6bde0d2e529f9b650270a95526a3a1a4186f7a63 /sys_util/src/write_zeroes.rs
parent8f94a9ff71ce766c9e91fb2284d40f327148e708 (diff)
downloadcrosvm-e33b55c4298c8f0d3dff7f04343e765559463d3a.tar
crosvm-e33b55c4298c8f0d3dff7f04343e765559463d3a.tar.gz
crosvm-e33b55c4298c8f0d3dff7f04343e765559463d3a.tar.bz2
crosvm-e33b55c4298c8f0d3dff7f04343e765559463d3a.tar.lz
crosvm-e33b55c4298c8f0d3dff7f04343e765559463d3a.tar.xz
crosvm-e33b55c4298c8f0d3dff7f04343e765559463d3a.tar.zst
crosvm-e33b55c4298c8f0d3dff7f04343e765559463d3a.zip
tempfile: Unify the two tempdir implementations
Looks like we ended up with two totally different tempdir
implementations: one from CL:520706 and the other from CL:1409705.

This CL consolidates them into one implementation.

BUG=chromium:974059
TEST=tempfile: cargo test
TEST=crosvm: cargo check --all-features
TEST=devices: cargo check --tests
TEST=sys_util: cargo check --tests
TEST=local kokoro
TEST=./build_test

Cq-Depend: chromium:1574668
Change-Id: Id70e963c9986ed2fc5f160819c4a7f9f16092b3b
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1573227
Tested-by: kokoro <noreply+kokoro@google.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Diffstat (limited to 'sys_util/src/write_zeroes.rs')
-rw-r--r--sys_util/src/write_zeroes.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/sys_util/src/write_zeroes.rs b/sys_util/src/write_zeroes.rs
index 51f0dbe..e3b531e 100644
--- a/sys_util/src/write_zeroes.rs
+++ b/sys_util/src/write_zeroes.rs
@@ -59,14 +59,12 @@ mod tests {
     use super::*;
     use std::fs::OpenOptions;
     use std::io::{Read, Seek, SeekFrom};
-    use std::path::PathBuf;
-
-    use crate::TempDir;
+    use tempfile::TempDir;
 
     #[test]
     fn simple_test() {
-        let tempdir = TempDir::new("/tmp/write_zeroes_test").unwrap();
-        let mut path = PathBuf::from(tempdir.as_path().unwrap());
+        let tempdir = TempDir::new().unwrap();
+        let mut path = tempdir.path().to_owned();
         path.push("file");
         let mut f = OpenOptions::new()
             .read(true)
@@ -131,8 +129,8 @@ mod tests {
 
     #[test]
     fn large_write_zeroes() {
-        let tempdir = TempDir::new("/tmp/write_zeroes_test").unwrap();
-        let mut path = PathBuf::from(tempdir.as_path().unwrap());
+        let tempdir = TempDir::new().unwrap();
+        let mut path = tempdir.path().to_owned();
         path.push("file");
         let mut f = OpenOptions::new()
             .read(true)