Skip to content

Commit

Permalink
Fix environment activation.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Dec 16, 2024
1 parent c421e11 commit 732231e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
28 changes: 17 additions & 11 deletions scripts/evaluate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ print("\n\n", '#'^80, "\n# Set-up\n#\n\n")

t0 = cpu_time()

# we install PkgEval dependencies in a separate environment
try
Pkg.DEFAULT_IO[] = devnull
Pkg.activate("pkgeval"; shared=true)
finally
Pkg.DEFAULT_IO[] = nothing
end

deps = String[]

if config.goal === :test
Expand All @@ -36,11 +28,20 @@ if config.rr == RREnabled
# the dependencies of the package under evaluation. However, in the session
# where we load BugReporting.jl we'll never actually load the package we
# want to test, only re-start Julia under rr, so this should be fine.
println(io, "pushfirst!(LOAD_PATH, $(repr(Base.ACTIVE_PROJECT[])))")
println(io, """
project = Base.active_project()
prepend!(LOAD_PATH, $(repr(LOAD_PATH)))
using Pkg
Pkg.activate("pkgeval"; shared=true)
using BugReporting
Pkg.activate(project)
""")

# this code is essentially what --bug-report from InteractiveUtils does
println(io, """
using BugReporting
ENV["ENABLE_GDBLISTENER"] = "1"
println("Switching execution to under rr")
BugReporting.make_interactive_report("rr-local", ARGS)
Expand All @@ -54,6 +55,10 @@ if !isempty(deps)
Pkg.DEFAULT_IO[] = io
try
println("Installing PkgEval dependencies (", join(deps, ", "), ")...")

# we install PkgEval dependencies in a separate environment
Pkg.activate("pkgeval"; shared=true)

Pkg.add(deps)
catch
# something went wrong installing PkgEval's dependencies
Expand Down Expand Up @@ -183,7 +188,8 @@ t0 = cpu_time()
io0 = io_bytes()
try
# we load the package in a session mimicking Pkg's sandbox,
# because that's what we previously precompiled the package in.
# because that's what we previously precompiled the package for.
println("Loading $(pkg.name)...")
run(```$(Base.julia_cmd())
--check-bounds=yes
--inline=$(Bool(Base.JLOptions().can_inline) ? "yes" : "no")
Expand Down
4 changes: 4 additions & 0 deletions scripts/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ if config.goal === :test
Pkg.activate()
Pkg.DEFAULT_IO[] = nothing
end
else
Pkg.DEFAULT_IO[] = devnull
Pkg.activate()
Pkg.DEFAULT_IO[] = nothing
end

println("Precompiling package dependencies...")
Expand Down

0 comments on commit 732231e

Please sign in to comment.