diff --git a/tracing-flame/Cargo.toml b/tracing-flame/Cargo.toml index 3ec28fcc62..36ae88c79b 100644 --- a/tracing-flame/Cargo.toml +++ b/tracing-flame/Cargo.toml @@ -30,4 +30,4 @@ tracing = { path = "../tracing", version = "0.1.12", default-features = false, f lazy_static = "1.3.0" [dev-dependencies] -tempdir = "0.3.7" +tempfile = "3" diff --git a/tracing-flame/tests/collapsed.rs b/tracing-flame/tests/collapsed.rs index 575aa3b6a0..5433d981a0 100644 --- a/tracing-flame/tests/collapsed.rs +++ b/tracing-flame/tests/collapsed.rs @@ -1,6 +1,5 @@ use std::thread::sleep; use std::time::Duration; -use tempdir::TempDir; use tracing::{span, Level}; use tracing_flame::FlameLayer; use tracing_subscriber::{prelude::*, registry::Registry}; @@ -8,7 +7,10 @@ use tracing_subscriber::{prelude::*, registry::Registry}; #[test] fn capture_supported() { { - let tmp_dir = TempDir::new("flamegraphs").unwrap(); + let tmp_dir = tempfile::Builder::new() + .prefix("tracing-flamegraph-test-") + .tempdir() + .expect("failed to create tempdir"); let (flame_layer, _guard) = FlameLayer::with_file(tmp_dir.path().join("tracing.folded")).unwrap(); @@ -37,5 +39,7 @@ fn capture_supported() { } sleep(Duration::from_millis(500)); + + tmp_dir.close().expect("failed to delete tempdir"); } } diff --git a/tracing-flame/tests/concurrent.rs b/tracing-flame/tests/concurrent.rs index 272ad0f1ba..4cb4045279 100644 --- a/tracing-flame/tests/concurrent.rs +++ b/tracing-flame/tests/concurrent.rs @@ -1,13 +1,15 @@ use std::thread::sleep; use std::time::Duration; -use tempdir::TempDir; use tracing::{span, Level}; use tracing_flame::FlameLayer; use tracing_subscriber::{prelude::*, registry::Registry}; #[test] fn capture_supported() { - let tmp_dir = TempDir::new("flamegraphs").unwrap(); + let tmp_dir = tempfile::Builder::new() + .prefix("tracing-flamegraph-test-") + .tempdir() + .expect("failed to create tempdir"); let path = tmp_dir.path().join("tracing.folded"); let (flame_layer, flame_guard) = FlameLayer::with_file(&path).unwrap(); @@ -37,4 +39,6 @@ fn capture_supported() { let traces = std::fs::read_to_string(&path).unwrap(); println!("{}", traces); assert_eq!(5, traces.lines().count()); + + tmp_dir.close().expect("failed to delete tempdir"); }