Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tweak how Pkg is loaded for precompiling when testing #3606

Merged
merged 1 commit into from
Sep 5, 2023
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
14 changes: 8 additions & 6 deletions src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1651,13 +1651,15 @@ function gen_test_code(source_path::String; coverage, julia_args::Cmd, test_args
end

function gen_test_precompile_code(source_path::String; coverage, julia_args::Cmd, test_args::Cmd)
# Note that we cannot load the dev-ed Pkg here during Pkg testing
# so the `Pkg.precompile` that is run here is the one in the sysimage
pkgdir = joinpath(@__DIR__, "..")
code = """
Pkg = Base.require(Base.PkgId(Base.UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f"), "Pkg"))
$(Base.load_path_setup_code(false))
append!(empty!(ARGS), $(repr(test_args.exec)))
Pkg.precompile(warn_loaded = false)
pushfirst!(LOAD_PATH, $(repr(pkgdir)))
try using Pkg
catch
@warn "Pkg failed to load, skipping precompilation."
else
Pkg.precompile(warn_loaded = false)
end
"""
return gen_subprocess_cmd(code, source_path; coverage, julia_args)
end
Expand Down
Loading