From 14d3e9865bb4f79e36a41fd0a00ae0b55922211a Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou Date: Wed, 19 Aug 2020 13:49:36 +0200 Subject: [PATCH] switch from tempdir to tempfile Uses a more recent version of rand Signed-off-by: Marc-Antoine Perennou --- Cargo.toml | 2 +- tests/uds.rs | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 71b031f5..82128b4d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -102,7 +102,7 @@ optional = true [dev-dependencies] femme = "1.3.0" rand = "0.7.3" -tempdir = "0.3.7" +tempfile = "3.1.0" futures = "0.3.4" rand_xorshift = "0.2.0" diff --git a/tests/uds.rs b/tests/uds.rs index d081bdae..e19b41e4 100644 --- a/tests/uds.rs +++ b/tests/uds.rs @@ -5,8 +5,6 @@ use async_std::os::unix::net::{UnixDatagram, UnixListener, UnixStream}; use async_std::prelude::*; use async_std::task; -use tempdir::TempDir; - use std::time::Duration; const JULIUS_CAESAR: &[u8] = b" @@ -51,7 +49,10 @@ const TEST_TIMEOUT: Duration = Duration::from_secs(3); #[test] fn socket_ping_pong() { - let tmp_dir = TempDir::new("socket_ping_pong").expect("Temp dir not created"); + let tmp_dir = tempfile::Builder::new() + .prefix("socket_ping_pong") + .tempdir() + .expect("Temp dir not created"); let sock_path = tmp_dir.as_ref().join("sock"); let iter_cnt = 16; @@ -98,7 +99,10 @@ async fn ping_pong_client(socket: &std::path::PathBuf, iterations: u32) -> std:: #[test] fn uds_clone() -> io::Result<()> { task::block_on(async { - let tmp_dir = TempDir::new("socket_ping_pong").expect("Temp dir not created"); + let tmp_dir = tempfile::Builder::new() + .prefix("socket_ping_pong") + .tempdir() + .expect("Temp dir not created"); let sock_path = tmp_dir.as_ref().join("sock"); let input = UnixListener::bind(&sock_path).await?;