Skip to content

Commit e6eafce

Browse files
authored
Revise-test: make sure all workers load Revise (#36124)
This fixes the errors ``` julia> Base.runtests(["REPL", "cartesian"]; revise=true) ERROR: LoadError: On worker 2: UndefVarError: Revise not defined ``` and then later ``` julia> Base.runtests(["REPL", "cartesian"]; revise=true) ERROR: LoadError: On worker 2: UndefVarError: STDLIBS not defined ```
1 parent a99a87c commit e6eafce

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

test/runtests.jl

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ tests = unique(tests)
1515

1616
if use_revise
1717
using Revise
18+
# Remote-eval the following to initialize Revise in workers
19+
const revise_init_expr = quote
20+
using Revise
21+
const STDLIBS = $STDLIBS
22+
revise_trackall()
23+
end
1824
end
1925

2026
const max_worker_rss = if haskey(ENV, "JULIA_TEST_MAXRSS_MB")
@@ -84,16 +90,8 @@ cd(@__DIR__) do
8490
@everywhere include("testdefs.jl")
8591

8692
if use_revise
87-
@everywhere begin
88-
Revise.track(Core.Compiler)
89-
Revise.track(Base)
90-
for (id, mod) in Base.loaded_modules
91-
if id.name in STDLIBS
92-
Revise.track(mod)
93-
end
94-
end
95-
Revise.revise()
96-
end
93+
Base.invokelatest(revise_trackall)
94+
Distributed.remotecall_eval(Main, workers(), revise_init_expr)
9795
end
9896

9997
#pretty print the information about gc and mem usage
@@ -223,6 +221,9 @@ cd(@__DIR__) do
223221
rmprocs(wrkr, waitfor=30)
224222
p = addprocs_with_testenv(1)[1]
225223
remotecall_fetch(include, p, "testdefs.jl")
224+
if use_revise
225+
Distributed.remotecall_eval(Main, p, revise_init_expr)
226+
end
226227
end
227228
else
228229
print_testworker_stats(test, wrkr, resp)
@@ -233,6 +234,9 @@ cd(@__DIR__) do
233234
rmprocs(wrkr, waitfor=30)
234235
p = addprocs_with_testenv(1)[1]
235236
remotecall_fetch(include, p, "testdefs.jl")
237+
if use_revise
238+
Distributed.remotecall_eval(Main, p, revise_init_expr)
239+
end
236240
else # single process testing
237241
error("Halting tests. Memory limit reached : $resp > $max_worker_rss")
238242
end

test/testdefs.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,16 @@ end
4646
# looking in . messes things up badly
4747
filter!(x->x!=".", LOAD_PATH)
4848

49+
# Support for Revise
50+
function revise_trackall()
51+
Revise.track(Core.Compiler)
52+
Revise.track(Base)
53+
for (id, mod) in Base.loaded_modules
54+
if id.name in STDLIBS
55+
Revise.track(mod)
56+
end
57+
end
58+
Revise.revise()
59+
end
60+
4961
nothing # File is loaded via a remotecall to "include". Ensure it returns "nothing".

0 commit comments

Comments
 (0)