From 94c4fb5e8221a9382a461f0206354445af040598 Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Tue, 31 Jan 2023 05:48:12 +0100 Subject: [PATCH] prevent heap snapshot test to write to julia dir (#48458) Co-authored-by: Ian --- stdlib/Profile/test/runtests.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stdlib/Profile/test/runtests.jl b/stdlib/Profile/test/runtests.jl index 8c2031a9797f2..2d6df81b1015d 100644 --- a/stdlib/Profile/test/runtests.jl +++ b/stdlib/Profile/test/runtests.jl @@ -279,7 +279,10 @@ end end @testset "HeapSnapshot" begin - fname = read(`$(Base.julia_cmd()) --startup-file=no -e "using Profile; print(Profile.take_heap_snapshot())"`, String) + tmpdir = mktempdir() + fname = cd(tmpdir) do + read(`$(Base.julia_cmd()) --startup-file=no -e "using Profile; print(Profile.take_heap_snapshot())"`, String) + end @test isfile(fname) @@ -288,6 +291,7 @@ end end rm(fname) + rm(tmpdir, force = true, recursive = true) end include("allocs.jl")