Skip to content

Commit de89a2c

Browse files
prevent heap snapshot test to write to julia dir (#48458)
Co-authored-by: Ian <i.r.butterworth@gmail.com> (cherry picked from commit 94c4fb5)
1 parent 775c97f commit de89a2c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

stdlib/Profile/test/runtests.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,10 @@ end
272272
end
273273

274274
@testset "HeapSnapshot" begin
275-
fname = read(`$(Base.julia_cmd()) --startup-file=no -e "using Profile; print(Profile.take_heap_snapshot())"`, String)
275+
tmpdir = mktempdir()
276+
fname = cd(tmpdir) do
277+
read(`$(Base.julia_cmd()) --startup-file=no -e "using Profile; print(Profile.take_heap_snapshot())"`, String)
278+
end
276279

277280
@test isfile(fname)
278281

@@ -281,6 +284,7 @@ end
281284
end
282285

283286
rm(fname)
287+
rm(tmpdir, force = true, recursive = true)
284288
end
285289

286290
include("allocs.jl")

0 commit comments

Comments
 (0)