Skip to content

Commit 94c4fb5

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

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
@@ -279,7 +279,10 @@ end
279279
end
280280

281281
@testset "HeapSnapshot" begin
282-
fname = read(`$(Base.julia_cmd()) --startup-file=no -e "using Profile; print(Profile.take_heap_snapshot())"`, String)
282+
tmpdir = mktempdir()
283+
fname = cd(tmpdir) do
284+
read(`$(Base.julia_cmd()) --startup-file=no -e "using Profile; print(Profile.take_heap_snapshot())"`, String)
285+
end
283286

284287
@test isfile(fname)
285288

@@ -288,6 +291,7 @@ end
288291
end
289292

290293
rm(fname)
294+
rm(tmpdir, force = true, recursive = true)
291295
end
292296

293297
include("allocs.jl")

0 commit comments

Comments
 (0)