Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions testprocess/TestItemServer/src/TestItemServer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@
setup_details = state.test_setups[(params.packageUri, Symbol(i))]

if setup_details.kind==:module && !setup_details.evaled
mod = Core.eval(Main.Testsetups, :(module $(Symbol(i)) end))

Check warning on line 593 in testprocess/TestItemServer/src/TestItemServer.jl

View workflow job for this annotation

GitHub Actions / julia-ci / lint

missing_reference

Missing reference: Testsetups

code = string('\n'^(setup_details.line-1), ' '^(setup_details.column-1), setup_details.code)

Expand Down Expand Up @@ -1089,6 +1089,34 @@
TestEnv.activate(params.packageName)
end

# The controller serializes this request: one test process is nominated to activate
# while every other one waits, and they are released when it reports back. The point
# of that is to build the test environment's precompile caches exactly once, because
# Julia has no cache file locking before 1.10 — two processes precompiling the same
# package race, and on Windows the loser cannot replace a `.ji` the winner holds
# open, so it dies with "Cannot write cache file".
#
# From Julia 1.9 on, `TestEnv.activate` finishes with `Pkg._auto_precompile` on the
# sandbox environment, so the caches really are built inside that window. The older
# variants stop at `Pkg.activate`, and `Pkg.instantiate` did not precompile before
# Julia 1.6 either — so nothing was compiled until the first `using` inside a test
# item, which happens in every test process at once, after the gate has let them all
# go. Precompiling here puts that work back inside the serialized window.
@static if VERSION < v"1.9"
try
# `Pkg.precompile` does not exist before Julia 1.4 — it only became a
# forwarder to `Pkg.API.precompile` then, and before that the name resolved
# to `Base.precompile` through the implicit `using Base` and threw a
# MethodError. `Pkg.API.precompile()` has a zero-argument method in every
# version this branch runs on.
Pkg.API.precompile()
catch err
# Not worth failing activation over: whatever is wrong will come back with a
# better message when a test item loads the package.
@debug "Precompiling the test environment failed" exception = (err, catch_backtrace())
end
end

return TestItemServerProtocol.ActivateEnvResult(
status = "success",
error = missing
Expand Down
Loading