Skip to content

Commit 7dae29d

Browse files
committed
[Artifacts]: Download to temporary directories, not stdlib
We can't assume that `stdlib` is in a writable location; always download temporary testing files to `$TMPDIR`.
1 parent 5ee2d60 commit 7dae29d

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

stdlib/Artifacts/test/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

stdlib/Artifacts/test/refresh_artifacts.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
# This file is a part of Julia. License is MIT: https://julialang.org/license
22

33
using Artifacts: with_artifacts_directory
4-
# using Pkg.Artifacts: ensure_all_artifacts_installed
54
using Pkg.Artifacts: load_artifacts_toml, ensure_artifact_installed
65
let
7-
tempdir = joinpath(@__DIR__, "artifacts")
86
toml = joinpath(@__DIR__, "Artifacts.toml")
97
unused = Base.BinaryPlatforms.Platform(string(Sys.ARCH), "linux")
10-
with_artifacts_directory(tempdir) do
8+
with_artifacts_directory(ARGS[1]) do
119
# ensure_all_artifacts_installed(toml; include_lazy=false)
1210
dict = load_artifacts_toml(toml)
1311
for (name, meta) in dict

stdlib/Artifacts/test/runtests.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ using Artifacts, Test, Base.BinaryPlatforms
44
using Artifacts: with_artifacts_directory, pack_platform!, unpack_platform
55

66
# prepare for the package tests by ensuring the required artifacts are downloaded now
7-
run(addenv(`$(Base.julia_cmd()) --color=no $(joinpath(@__DIR__, "refresh_artifacts.jl"))`, "TERM"=>"dumb"))
7+
artifacts_dir = mktempdir()
8+
run(addenv(`$(Base.julia_cmd()) --color=no $(joinpath(@__DIR__, "refresh_artifacts.jl")) $(artifacts_dir)`, "TERM"=>"dumb"))
89

910
@testset "Artifact Paths" begin
1011
mktempdir() do tempdir
@@ -81,8 +82,7 @@ end
8182
end
8283

8384
@testset "Artifact Slash-indexing" begin
84-
tempdir = joinpath(@__DIR__, "artifacts")
85-
with_artifacts_directory(tempdir) do
85+
with_artifacts_directory(artifacts_dir) do
8686
exeext = Sys.iswindows() ? ".exe" : ""
8787

8888
# simple lookup, gives us the directory for `c_simple` for the current architecture
@@ -112,8 +112,7 @@ end
112112
end
113113

114114
@testset "@artifact_str Platform passing" begin
115-
tempdir = joinpath(@__DIR__, "artifacts")
116-
with_artifacts_directory(tempdir) do
115+
with_artifacts_directory(artifacts_dir) do
117116
win64 = Platform("x86_64", "windows")
118117
mac64 = Platform("x86_64", "macos")
119118
@test basename(@artifact_str("c_simple", win64)) == "444cecb70ff39e8961dd33e230e151775d959f37"

0 commit comments

Comments
 (0)