Skip to content

Commit b6b3b07

Browse files
fix tests not including the stdlib cache depots
1 parent eff9f2b commit b6b3b07

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

test/distributed_exec.jl

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ else
1010
@test startswith(pathof(Distributed), sharedir)
1111
end
1212

13+
pathsep = Sys.iswindows() ? ";" : ":"
14+
1315
@test cluster_cookie() isa String
1416

1517
include(joinpath(Sys.BINDIR, "..", "share", "julia", "test", "testenv.jl"))
@@ -1818,9 +1820,11 @@ let julia = `$(Base.julia_cmd()) --startup-file=no`; mktempdir() do tmp
18181820
project = mkdir(joinpath(tmp, "project"))
18191821
depots = [mkdir(joinpath(tmp, "depot1")), mkdir(joinpath(tmp, "depot2"))]
18201822
load_path = [mkdir(joinpath(tmp, "load_path")), "@stdlib", "@"]
1821-
pathsep = Sys.iswindows() ? ";" : ":"
1823+
shipped_depots = DEPOT_PATH[2:end] # stdlib caches
1824+
18221825
env = Dict(
1823-
"JULIA_DEPOT_PATH" => join(depots, pathsep),
1826+
# needs a trailing pathsep to access the stdlib depot
1827+
"JULIA_DEPOT_PATH" => join(depots, pathsep) * pathsep,
18241828
"JULIA_LOAD_PATH" => join(load_path, pathsep),
18251829
# Explicitly propagate `TMPDIR`, in the event that we're running on a
18261830
# CI system where `TMPDIR` is special.
@@ -1874,8 +1878,14 @@ let julia = `$(Base.julia_cmd()) --startup-file=no`; mktempdir() do tmp
18741878
@test success(pipeline(cmd; stdout, stderr))
18751879
# JULIA_(LOAD|DEPOT)_PATH
18761880
shufflecode = """
1877-
d = reverse(DEPOT_PATH)
1878-
append!(empty!(DEPOT_PATH), d)
1881+
function reverse_first_two(depots)
1882+
custom_depots = depots[1:2]
1883+
standard_depots = depots[3:end]
1884+
custom_depots = reverse(custom_depots)
1885+
return append!(custom_depots, standard_depots)
1886+
end
1887+
new_depots = reverse_first_two(DEPOT_PATH)
1888+
append!(empty!(DEPOT_PATH), new_depots)
18791889
l = reverse(LOAD_PATH)
18801890
append!(empty!(LOAD_PATH), l)
18811891
"""
@@ -1886,7 +1896,7 @@ let julia = `$(Base.julia_cmd()) --startup-file=no`; mktempdir() do tmp
18861896
extracode = """
18871897
for w in workers()
18881898
@test remotecall_fetch(load_path, w) == $(repr(reverse(load_path)))
1889-
@test remotecall_fetch(depot_path, w) == $(repr(reverse(depots)))
1899+
@test remotecall_fetch(depot_path, w) == $(repr(vcat(reverse(depots), shipped_depots)))
18901900
end
18911901
"""
18921902
cmd = setenv(`$(julia) -e $(shufflecode * addcode * testcode * extracode)`, env)
@@ -1895,7 +1905,7 @@ let julia = `$(Base.julia_cmd()) --startup-file=no`; mktempdir() do tmp
18951905
failcode = shufflecode * setupcode * """
18961906
for w in workers()
18971907
@test remotecall_fetch(load_path, w) == reverse(LOAD_PATH) == $(repr(load_path))
1898-
@test remotecall_fetch(depot_path, w) == reverse(DEPOT_PATH) == $(repr(depots))
1908+
@test remotecall_fetch(depot_path, w) == reverse_first_two(DEPOT_PATH) == $(repr(vcat(depots, shipped_depots)))
18991909
end
19001910
"""
19011911
cmd = setenv(`$(julia) -p1 -e $(failcode)`, env)
@@ -1906,15 +1916,15 @@ let julia = `$(Base.julia_cmd()) --startup-file=no`; mktempdir() do tmp
19061916
project = mktempdir()
19071917
env = Dict(
19081918
"JULIA_LOAD_PATH" => string(LOAD_PATH[1], $(repr(pathsep)), "@stdlib"),
1909-
"JULIA_DEPOT_PATH" => DEPOT_PATH[1],
1919+
"JULIA_DEPOT_PATH" => DEPOT_PATH[1] * $(repr(pathsep)),
19101920
"TMPDIR" => ENV["TMPDIR"],
19111921
)
19121922
addprocs(1; env = env, exeflags = `--project=\$(project)`)
19131923
env["JULIA_PROJECT"] = project
19141924
addprocs(1; env = env)
19151925
""" * setupcode * """
19161926
for w in workers()
1917-
@test remotecall_fetch(depot_path, w) == [DEPOT_PATH[1]]
1927+
@test remotecall_fetch(depot_path, w) == vcat(DEPOT_PATH[1], $(repr(shipped_depots)))
19181928
@test remotecall_fetch(load_path, w) == [LOAD_PATH[1], "@stdlib"]
19191929
@test remotecall_fetch(active_project, w) == project
19201930
@test remotecall_fetch(Base.active_project, w) == joinpath(project, "Project.toml")

0 commit comments

Comments
 (0)